Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/copy-descriptor/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /*!
* copy-descriptor <https://github.com/jonschlinkert/copy-descriptor>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
/**
* Copy a descriptor from one object to another.
*
* ```js
* function App() {
* this.cache = {};
* }
* App.prototype.set = function(key, val) {
* this.cache[key] = val;
* return this;
* };
* Object.defineProperty(App.prototype, 'count', {
* get: function() {
* return Object.keys(this.cache).length;
* }
* });
*
* copy(App.prototype, 'count', 'len');
*
* // create an instance
* var app = new App();
*
* app.set('a', true);
* app.set('b', true);
* app.set('c', true);
*
* console.log(app.count);
* //=> 3
* console.log(app.len);
* //=> 3
* ```
* @name copy
* @param {Object} `receiver` The target object
* @param {Object} `provider` The provider object
* @param {String} `from` The key to copy on provider.
* @param {String} `to` Optionally specify a new key name to use.
* @return {Object}
* @api public
*/
module.exports = function copyDescriptor(receiver, provider, from, to) {
if (!isObject(provider) && typeof provider !== 'function') {
to = from;
from = provider;
provider = receiver;
}
if (!isObject(receiver) && typeof receiver !== 'function') {
throw new TypeError('expected the first argument to be an object');
}
if (!isObject(provider) && typeof provider !== 'function') {
throw new TypeError('expected provider to be an object');
}
if (typeof to !== 'string') {
to = from;
}
if (typeof from !== 'string') {
throw new TypeError('expected key to be a string');
}
if (!(from in provider)) {
throw new Error('property "' + from + '" does not exist');
}
var val = Object.getOwnPropertyDescriptor(provider, from);
if (val) Object.defineProperty(receiver, to, val);
};
function isObject(val) {
return {}.toString.call(val) === '[object Object]';
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]-- |