| Server IP : 82.148.16.210 / Your IP : 216.73.216.32 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/projects/env4/src/dev/frontend5/node_modules/store2/src/ |
Upload File : |
/**
* Copyright (c) 2017 ESHA Research
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Adds shortcut for safely applying all available Array functions to stored values. If there is no
* value, the functions will act as if upon an empty one. If there is a non, array value, it is put
* into an array before the function is applied. If the function results in an empty array, the
* key/value is removed from the storage, otherwise the array is restored.
*
* store.push('array', 'a', 1, true);// == store.set('array', (store.get('array')||[]).push('a', 1, true]));
* store.indexOf('array', true);// === store.get('array').indexOf(true)
*
* This will add all functions of Array.prototype that are specific to the Array interface and have no
* conflict with existing store functions.
*
* Status: BETA - useful, but adds more functions than reasonable
*/
;(function(_, Array) {
// expose internals on the underscore to allow extensibility
_.array = function(fnName, key, args) {
var value = this.get(key, []),
array = Array.isArray(value) ? value : [value],
ret = array[fnName].apply(array, args);
if (array.length > 0) {
this.set(key, array.length > 1 ? array : array[0]);
} else {
this.remove(key);
}
return ret;
};
_.arrayFn = function(fnName) {
return function(key) {
return this.array(fnName, key,
arguments.length > 1 ? Array.prototype.slice.call(arguments, 1) : null);
};
};
// add function(s) to the store interface
_.fn('array', _.array);
Object.getOwnPropertyNames(Array.prototype).forEach(function(name) {
// add Array interface functions w/o existing conflicts
if (typeof Array.prototype[name] === "function") {
if (!(name in _.storeAPI)) {
_.fn(name, _.array[name] = _.arrayFn(name));
}
}
});
})(window.store._, window.Array);