Sha256: 8ca718ceb70ea295c2fdf72b3305c8fbf661b3dbabb9039a7a38aa72267310d3

Contents?: true

Size: 759 Bytes

Versions: 137

Compression:

Stored size: 759 Bytes

Contents

/*!
 * define-property <https://github.com/jonschlinkert/define-property>
 *
 * Copyright (c) 2015, 2017, Jon Schlinkert.
 * Released under the MIT License.
 */

'use strict';

var isDescriptor = require('is-descriptor');

module.exports = function defineProperty(obj, prop, val) {
  if (typeof obj !== 'object' && typeof obj !== 'function') {
    throw new TypeError('expected an object or function.');
  }

  if (typeof prop !== 'string') {
    throw new TypeError('expected `prop` to be a string.');
  }

  if (isDescriptor(val) && ('set' in val || 'get' in val)) {
    return Object.defineProperty(obj, prop, val);
  }

  return Object.defineProperty(obj, prop, {
    configurable: true,
    enumerable: false,
    writable: true,
    value: val
  });
};

Version data entries

137 entries across 38 versions & 12 rubygems

Version Path
ilog-0.4.1 node_modules/snapdragon-node/node_modules/define-property/index.js
ilog-0.4.1 node_modules/readdirp/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.1 node_modules/http-proxy-middleware/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.1 node_modules/browser-sync/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.0 node_modules/browser-sync/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.0 node_modules/webpack-dev-server/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.0 node_modules/watchpack/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.0 node_modules/snapdragon-node/node_modules/define-property/index.js
ilog-0.4.0 node_modules/readdirp/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.0 node_modules/http-proxy-middleware/node_modules/extglob/node_modules/define-property/index.js
ilog-0.4.0 node_modules/base/node_modules/define-property/index.js
ilog-0.3.3 node_modules/browser-sync/node_modules/extglob/node_modules/define-property/index.js
ilog-0.3.3 node_modules/webpack-dev-server/node_modules/extglob/node_modules/define-property/index.js
ilog-0.3.3 node_modules/watchpack/node_modules/extglob/node_modules/define-property/index.js
ilog-0.3.3 node_modules/snapdragon-node/node_modules/define-property/index.js
ilog-0.3.3 node_modules/readdirp/node_modules/extglob/node_modules/define-property/index.js
ilog-0.3.3 node_modules/http-proxy-middleware/node_modules/extglob/node_modules/define-property/index.js
ilog-0.3.3 node_modules/base/node_modules/define-property/index.js
jester-data-8.0.0 node_modules/extglob/node_modules/define-property/index.js
jester-data-8.0.0 node_modules/snapdragon-node/node_modules/define-property/index.js