/
asias
/
new
Обзор
Документация
Войти
/
asias
/
new
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/underscore/amd/_wrapArrayMutator.js
28 строк
1020 B
AnastasyaDemina
project
07 дек 2025, 23:03
07 дек 2025, 23:03
7c21e25
Код
Авторство
О чём код?
define(['exports', './_setup', './_getLength', './identity', './restArguments'], function (exports, _setup, _getLength, identity, restArguments) { // Internal function to work around a bug in IE < 9. See // https://github.com/jashkenas/underscore/issues/397. function removeGhostHead(array) { if (!_getLength(array)) delete array[0]; return array; } // Internal function to wrap `Array.prototype` methods that modify // the context in place so they can be directly invoked as standalone // functions. Works for `pop`, `push`, `reverse`, `shift`, `sort`, // `splice` and `unshift`. function wrapArrayMutator(name, fixup) { var method = _setup.ArrayProto[name]; fixup || (fixup = identity); return restArguments(function(array, args) { if (array != null) method.apply(array, args); return fixup(array); }); } exports.default = wrapArrayMutator; exports.removeGhostHead = removeGhostHead; Object.defineProperty(exports, '__esModule', { value: true }); });