summaryrefslogtreecommitdiff
path: root/node_modules/lodash/pullAt.js
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
commit703e03aba33f234712206769f57717ba7d92d23d (patch)
tree0041f04ccb75bd5379c764e9fe42249fffe75fc3 /node_modules/lodash/pullAt.js
parentab6e257e6e9d9a483d7e86f220d8b209a2cd7753 (diff)
downloadFlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.gz
FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.zst
Added export_allowed file to make repository visible in cgit
Diffstat (limited to 'node_modules/lodash/pullAt.js')
-rw-r--r--node_modules/lodash/pullAt.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/node_modules/lodash/pullAt.js b/node_modules/lodash/pullAt.js
new file mode 100644
index 0000000..6ed84e0
--- /dev/null
+++ b/node_modules/lodash/pullAt.js
@@ -0,0 +1,43 @@
+var arrayMap = require('./_arrayMap'),
+ baseAt = require('./_baseAt'),
+ basePullAt = require('./_basePullAt'),
+ compareAscending = require('./_compareAscending'),
+ flatRest = require('./_flatRest'),
+ isIndex = require('./_isIndex');
+
+/**
+ * Removes elements from `array` corresponding to `indexes` and returns an
+ * array of removed elements.
+ *
+ * **Note:** Unlike `_.at`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {...(number|number[])} [indexes] The indexes of elements to remove.
+ * @returns {Array} Returns the new array of removed elements.
+ * @example
+ *
+ * var array = ['a', 'b', 'c', 'd'];
+ * var pulled = _.pullAt(array, [1, 3]);
+ *
+ * console.log(array);
+ * // => ['a', 'c']
+ *
+ * console.log(pulled);
+ * // => ['b', 'd']
+ */
+var pullAt = flatRest(function(array, indexes) {
+ var length = array == null ? 0 : array.length,
+ result = baseAt(array, indexes);
+
+ basePullAt(array, arrayMap(indexes, function(index) {
+ return isIndex(index, length) ? +index : index;
+ }).sort(compareAscending));
+
+ return result;
+});
+
+module.exports = pullAt;