Install yarn
This commit is contained in:
parent
0453e84836
commit
1fde8a81be
1927 changed files with 82144 additions and 83317 deletions
27
node_modules/define-property/index.js
generated
vendored
27
node_modules/define-property/index.js
generated
vendored
|
@ -1,38 +1,31 @@
|
|||
/*!
|
||||
* define-property <https://github.com/jonschlinkert/define-property>
|
||||
*
|
||||
* Copyright (c) 2015-2018, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
* Copyright (c) 2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var isobject = require('isobject');
|
||||
var isDescriptor = require('is-descriptor');
|
||||
var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty)
|
||||
? Reflect.defineProperty
|
||||
: Object.defineProperty;
|
||||
|
||||
module.exports = function defineProperty(obj, key, val) {
|
||||
if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
|
||||
throw new TypeError('expected an object, function, or array');
|
||||
module.exports = function defineProperty(obj, prop, val) {
|
||||
if (typeof obj !== 'object' && typeof obj !== 'function') {
|
||||
throw new TypeError('expected an object or function.');
|
||||
}
|
||||
|
||||
if (typeof key !== 'string') {
|
||||
throw new TypeError('expected "key" to be a string');
|
||||
if (typeof prop !== 'string') {
|
||||
throw new TypeError('expected `prop` to be a string.');
|
||||
}
|
||||
|
||||
if (isDescriptor(val)) {
|
||||
define(obj, key, val);
|
||||
return obj;
|
||||
if (isDescriptor(val) && ('set' in val || 'get' in val)) {
|
||||
return Object.defineProperty(obj, prop, val);
|
||||
}
|
||||
|
||||
define(obj, key, {
|
||||
return Object.defineProperty(obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: val
|
||||
});
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue