define-properties-x
Advanced tools
Comparing version 1.1.4 to 1.2.0
80
index.js
@@ -45,3 +45,3 @@ /** | ||
* | ||
* @version 1.1.4 | ||
* @version 1.2.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -53,13 +53,17 @@ * @copyright Xotic750 | ||
/*jslint maxlen:80, es6:false, white:true */ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:true, esnext:false, plusplus:true, maxparams:4, maxdepth:2, | ||
maxstatements:12, maxcomplexity:3 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/*global module */ | ||
/* eslint strict: 1, max-statements: 1, id-length: 1, no-restricted-syntax: 1, | ||
no-param-reassign: 1 */ | ||
;(function () { | ||
/* global module */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
@@ -73,7 +77,5 @@ | ||
var $keys = Object.keys; | ||
var $getOwnPropertySymbols = isFunction(Object.getOwnPropertySymbols) && | ||
Object.getOwnPropertySymbols; | ||
var $defineProperty = isFunction(Object.defineProperty) && | ||
Object.defineProperty; | ||
var supportsDescriptors = Boolean($defineProperty) && (function (unused) { | ||
var $getOwnPropertySymbols = isFunction(Object.getOwnPropertySymbols) && Object.getOwnPropertySymbols; | ||
var $defineProperty = isFunction(Object.defineProperty) && Object.defineProperty; | ||
var supportsDescriptors = Boolean($defineProperty) && (function () { | ||
var obj = {}; | ||
@@ -85,4 +87,4 @@ try { | ||
}); | ||
for (unused in obj) { | ||
/*jshint forin:false */ | ||
for (var unused in obj) { | ||
/* jshint forin:false */ | ||
return false; | ||
@@ -94,3 +96,3 @@ } | ||
} | ||
})(); | ||
}()); | ||
@@ -106,3 +108,3 @@ /** | ||
*/ | ||
function property(object, prop, value, force) { | ||
var property = function (object, prop, value, force) { | ||
if (prop in object && !force) { | ||
@@ -121,3 +123,3 @@ return; | ||
} | ||
} | ||
}; | ||
@@ -132,3 +134,3 @@ /** | ||
*/ | ||
function properties(object, map, predicates) { | ||
var properties = function (object, map, predicates) { | ||
var preds = isUndefined(predicates) ? {} : predicates; | ||
@@ -148,24 +150,6 @@ var props = $keys(map); | ||
}); | ||
} | ||
}; | ||
properties(module.exports, { | ||
/** | ||
* Just like `properties` but for defining a single non-enumerable | ||
* property. Useful in environments that do not | ||
* support `Computed property names`. This can be done | ||
* with `properties`, but this method can read a little cleaner. | ||
* | ||
* @function | ||
* @param {Object} object The object on which to define the property. | ||
* @param {string|Symbol} prop The property name. | ||
* @param {*} value The value of the property. | ||
* @param {boolean} [force=false] If `true` then set property regardless. | ||
* @example | ||
* var define = require('define-properties-x'); | ||
* var myString = 'something'; | ||
* define.property(obj, Symbol.iterator, function () {}, true); | ||
* define.property(obj, myString, function () {}, true); | ||
*/ | ||
property: property, | ||
/** | ||
* Define multiple non-enumerable properties at once. | ||
@@ -193,2 +177,20 @@ * Uses `Object.defineProperty` when available; falls back to standard | ||
/** | ||
* Just like `properties` but for defining a single non-enumerable | ||
* property. Useful in environments that do not | ||
* support `Computed property names`. This can be done | ||
* with `properties`, but this method can read a little cleaner. | ||
* | ||
* @function | ||
* @param {Object} object The object on which to define the property. | ||
* @param {string|Symbol} prop The property name. | ||
* @param {*} value The value of the property. | ||
* @param {boolean} [force=false] If `true` then set property regardless. | ||
* @example | ||
* var define = require('define-properties-x'); | ||
* var myString = 'something'; | ||
* define.property(obj, Symbol.iterator, function () {}, true); | ||
* define.property(obj, myString, function () {}, true); | ||
*/ | ||
property: property, | ||
/** | ||
* Boolean indicator as to whether the environments supports descriptors | ||
@@ -195,0 +197,0 @@ * or not. |
@@ -46,3 +46,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.returnExports = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
* | ||
* @version 1.1.4 | ||
* @version 1.2.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -54,13 +54,17 @@ * @copyright Xotic750 | ||
/*jslint maxlen:80, es6:false, white:true */ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:true, esnext:false, plusplus:true, maxparams:4, maxdepth:2, | ||
maxstatements:12, maxcomplexity:3 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/*global module */ | ||
/* eslint strict: 1, max-statements: 1, id-length: 1, no-restricted-syntax: 1, | ||
no-param-reassign: 1 */ | ||
;(function () { | ||
/* global module */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
@@ -74,7 +78,5 @@ | ||
var $keys = Object.keys; | ||
var $getOwnPropertySymbols = isFunction(Object.getOwnPropertySymbols) && | ||
Object.getOwnPropertySymbols; | ||
var $defineProperty = isFunction(Object.defineProperty) && | ||
Object.defineProperty; | ||
var supportsDescriptors = Boolean($defineProperty) && (function (unused) { | ||
var $getOwnPropertySymbols = isFunction(Object.getOwnPropertySymbols) && Object.getOwnPropertySymbols; | ||
var $defineProperty = isFunction(Object.defineProperty) && Object.defineProperty; | ||
var supportsDescriptors = Boolean($defineProperty) && (function () { | ||
var obj = {}; | ||
@@ -86,4 +88,4 @@ try { | ||
}); | ||
for (unused in obj) { | ||
/*jshint forin:false */ | ||
for (var unused in obj) { | ||
/* jshint forin:false */ | ||
return false; | ||
@@ -95,3 +97,3 @@ } | ||
} | ||
})(); | ||
}()); | ||
@@ -107,3 +109,3 @@ /** | ||
*/ | ||
function property(object, prop, value, force) { | ||
var property = function (object, prop, value, force) { | ||
if (prop in object && !force) { | ||
@@ -122,3 +124,3 @@ return; | ||
} | ||
} | ||
}; | ||
@@ -133,3 +135,3 @@ /** | ||
*/ | ||
function properties(object, map, predicates) { | ||
var properties = function (object, map, predicates) { | ||
var preds = isUndefined(predicates) ? {} : predicates; | ||
@@ -149,24 +151,6 @@ var props = $keys(map); | ||
}); | ||
} | ||
}; | ||
properties(module.exports, { | ||
/** | ||
* Just like `properties` but for defining a single non-enumerable | ||
* property. Useful in environments that do not | ||
* support `Computed property names`. This can be done | ||
* with `properties`, but this method can read a little cleaner. | ||
* | ||
* @function | ||
* @param {Object} object The object on which to define the property. | ||
* @param {string|Symbol} prop The property name. | ||
* @param {*} value The value of the property. | ||
* @param {boolean} [force=false] If `true` then set property regardless. | ||
* @example | ||
* var define = require('define-properties-x'); | ||
* var myString = 'something'; | ||
* define.property(obj, Symbol.iterator, function () {}, true); | ||
* define.property(obj, myString, function () {}, true); | ||
*/ | ||
property: property, | ||
/** | ||
* Define multiple non-enumerable properties at once. | ||
@@ -194,2 +178,20 @@ * Uses `Object.defineProperty` when available; falls back to standard | ||
/** | ||
* Just like `properties` but for defining a single non-enumerable | ||
* property. Useful in environments that do not | ||
* support `Computed property names`. This can be done | ||
* with `properties`, but this method can read a little cleaner. | ||
* | ||
* @function | ||
* @param {Object} object The object on which to define the property. | ||
* @param {string|Symbol} prop The property name. | ||
* @param {*} value The value of the property. | ||
* @param {boolean} [force=false] If `true` then set property regardless. | ||
* @example | ||
* var define = require('define-properties-x'); | ||
* var myString = 'something'; | ||
* define.property(obj, Symbol.iterator, function () {}, true); | ||
* define.property(obj, myString, function () {}, true); | ||
*/ | ||
property: property, | ||
/** | ||
* Boolean indicator as to whether the environments supports descriptors | ||
@@ -252,3 +254,3 @@ * or not. | ||
* | ||
* @version 1.0.11 | ||
* @version 1.1.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -260,13 +262,16 @@ * @copyright Xotic750 | ||
/*jslint maxlen:80, es6:true, white:true */ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:1, maxcomplexity:1 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/*global module */ | ||
/* eslint strict: 1, max-statements: 1, symbol-description: 1 */ | ||
;(function () { | ||
/* global module */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
@@ -327,3 +332,3 @@ | ||
* | ||
* @version 1.0.10 | ||
* @version 1.1.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -335,13 +340,16 @@ * @copyright Xotic750 | ||
/*jslint maxlen:80, es6:true, white:true */ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:1, maxcomplexity:1 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/*global module */ | ||
/* eslint strict: 1, max-statements: 1 */ | ||
;(function () { | ||
/* global module */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
@@ -355,4 +363,3 @@ | ||
*/ | ||
module.exports = _dereq_('has-symbol-support-x') && | ||
typeof Symbol.toStringTag === 'symbol'; | ||
module.exports = _dereq_('has-symbol-support-x') && typeof Symbol.toStringTag === 'symbol'; | ||
}()); | ||
@@ -404,3 +411,3 @@ | ||
* | ||
* @version 1.0.6 | ||
* @version 1.1.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -412,13 +419,16 @@ * @copyright Xotic750 | ||
/*jslint maxlen:80, es6:false, white:true */ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:true, esnext:false, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:8, maxcomplexity:4 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/*global module */ | ||
/* eslint strict: 1, max-statements: 1 */ | ||
;(function () { | ||
/* global module */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
@@ -441,3 +451,3 @@ | ||
*/ | ||
function tryFunctionObject(value) { | ||
var tryFunctionObject = function (value) { | ||
try { | ||
@@ -448,3 +458,3 @@ fToString.call(value); | ||
return false; | ||
} | ||
}; | ||
@@ -586,3 +596,3 @@ /** | ||
* | ||
* @version 1.0.11 | ||
* @version 1.1.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -594,13 +604,16 @@ * @copyright Xotic750 | ||
/*jslint maxlen:80, es6:false, white:true */ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:true, esnext:false, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:6, maxcomplexity:3 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/*global module */ | ||
/* eslint strict: 1, max-statements: 1 */ | ||
;(function () { | ||
/* global module */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
@@ -607,0 +620,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.returnExports=t()}}(function(){return function e(t,n,r){function s(i,u){if(!n[i]){if(!t[i]){var f="function"==typeof require&&require;if(!u&&f)return f(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[i]={exports:{}};t[i][0].call(p.exports,function(e){var n=t[i][1][e];return s(n?n:e)},p,p.exports,e,t,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;i<r.length;i++)s(r[i]);return s}({1:[function(t,e,n){!function(){"use strict";function property(t,e,n,r){e in t&&!r||(p?c(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n)}function properties(t,e,c){var p=o(c)?{}:c,l=s(e);n&&f&&(l=i.call(l,f(e))),u.call(l,function(n){var o=p[n];property(t,n,e[n],r(o)&&o())})}var n=t("has-symbol-support-x"),r=t("is-function-x"),o=t("validate.io-undefined"),i=Array.prototype.concat,u=Array.prototype.forEach,s=Object.keys,f=r(Object.getOwnPropertySymbols)&&Object.getOwnPropertySymbols,c=r(Object.defineProperty)&&Object.defineProperty,p=Boolean(c)&&function(t){var e={};try{c(e,"x",{enumerable:!1,value:e});for(t in e)return!1;return e.x===e}catch(n){return!1}}();properties(e.exports,{property:property,properties:properties,supportsDescriptors:p})}()},{"has-symbol-support-x":2,"is-function-x":4,"validate.io-undefined":8}],2:[function(t,e,n){!function(){"use strict";e.exports="function"==typeof Symbol&&"symbol"==typeof Symbol()}()},{}],3:[function(t,e,n){!function(){"use strict";e.exports=t("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag}()},{"has-symbol-support-x":2}],4:[function(t,e,n){!function(){"use strict";function tryFunctionObject(t){try{return n.call(t),!0}catch(e){}return!1}var n=Function.prototype.toString,r=t("to-string-tag-x"),o=t("has-to-string-tag-x"),i=t("is-primitive"),u="[object Function]",s="[object GeneratorFunction]";e.exports=function isFunction(t){if(i(t))return!1;if(o)return tryFunctionObject(t);var e=r(t);return e===u||e===s}}()},{"has-to-string-tag-x":3,"is-primitive":5,"to-string-tag-x":7}],5:[function(t,e,n){"use strict";e.exports=function isPrimitive(t){return null==t||"function"!=typeof t&&"object"!=typeof t}},{}],6:[function(t,e,n){function isNull(t){return null===t}e.exports=isNull},{}],7:[function(t,e,n){!function(){"use strict";var n=Object.prototype.toString,r=t("lodash.isnull"),o=t("validate.io-undefined"),i="[object Null]",u="[object Undefined]";e.exports=function toStringTag(t){return r(t)?i:o(t)?u:n.call(t)}}()},{"lodash.isnull":6,"validate.io-undefined":8}],8:[function(t,e,n){"use strict";function isUndefined(t){return void 0===t}e.exports=isUndefined},{}]},{},[1])(1)}); | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.returnExports=t()}}(function(){return function e(t,n,o){function s(i,u){if(!n[i]){if(!t[i]){var f="function"==typeof require&&require;if(!u&&f)return f(i,!0);if(r)return r(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[i]={exports:{}};t[i][0].call(l.exports,function(e){var n=t[i][1][e];return s(n?n:e)},l,l.exports,e,t,n,o)}return n[i].exports}for(var r="function"==typeof require&&require,i=0;i<o.length;i++)s(o[i]);return s}({1:[function(t,e,n){!function(){"use strict";var n=t("has-symbol-support-x"),o=t("is-function-x"),r=t("validate.io-undefined"),i=Array.prototype.concat,u=Array.prototype.forEach,s=Object.keys,f=o(Object.getOwnPropertySymbols)&&Object.getOwnPropertySymbols,c=o(Object.defineProperty)&&Object.defineProperty,l=Boolean(c)&&function(){var t={};try{c(t,"x",{enumerable:!1,value:t});for(var e in t)return!1;return t.x===t}catch(t){return!1}}(),a=function(t,e,n,o){e in t&&!o||(l?c(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n)},p=function(t,e,c){var l=r(c)?{}:c,p=s(e);n&&f&&(p=i.call(p,f(e))),u.call(p,function(n){var r=l[n];a(t,n,e[n],o(r)&&r())})};p(e.exports,{properties:p,property:a,supportsDescriptors:l})}()},{"has-symbol-support-x":2,"is-function-x":4,"validate.io-undefined":8}],2:[function(t,e,n){!function(){"use strict";e.exports="function"==typeof Symbol&&"symbol"==typeof Symbol()}()},{}],3:[function(t,e,n){!function(){"use strict";e.exports=t("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag}()},{"has-symbol-support-x":2}],4:[function(t,e,n){!function(){"use strict";var n=Function.prototype.toString,o=t("to-string-tag-x"),r=t("has-to-string-tag-x"),i=t("is-primitive"),u="[object Function]",s="[object GeneratorFunction]",f=function(t){try{return n.call(t),!0}catch(t){}return!1};e.exports=function isFunction(t){if(i(t))return!1;if(r)return f(t);var e=o(t);return e===u||e===s}}()},{"has-to-string-tag-x":3,"is-primitive":5,"to-string-tag-x":7}],5:[function(t,e,n){"use strict";e.exports=function isPrimitive(t){return null==t||"function"!=typeof t&&"object"!=typeof t}},{}],6:[function(t,e,n){function isNull(t){return null===t}e.exports=isNull},{}],7:[function(t,e,n){!function(){"use strict";var n=Object.prototype.toString,o=t("lodash.isnull"),r=t("validate.io-undefined"),i="[object Null]",u="[object Undefined]";e.exports=function toStringTag(t){return o(t)?i:r(t)?u:n.call(t)}}()},{"lodash.isnull":6,"validate.io-undefined":8}],8:[function(t,e,n){"use strict";function isUndefined(t){return void 0===t}e.exports=isUndefined},{}]},{},[1])(1)}); | ||
//# sourceMappingURL=lib/define-properties-x.map |
{ | ||
"name": "define-properties-x", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"description": "Based on the original work by Jordan Harband https://www.npmjs.com/package/define-properties", | ||
@@ -36,17 +36,21 @@ "homepage": "https://github.com/Xotic750/define-properties-x", | ||
"dependencies": { | ||
"has-symbol-support-x": "^1.0.11", | ||
"is-function-x": "^1.0.6", | ||
"has-symbol-support-x": "^1.1.0", | ||
"is-function-x": "^1.1.0", | ||
"validate.io-undefined": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"es5-shim": "^4.5.4", | ||
"es6-shim": "^0.34.4", | ||
"@ljharb/eslint-config": "^11.0.0", | ||
"es5-shim": "^4.5.9", | ||
"es6-shim": "^0.35.3", | ||
"es7-shim": "^6.0.0", | ||
"eslint": "^3.16.1", | ||
"eslint-plugin-import": "^2.2.0", | ||
"json3": "^3.3.2", | ||
"jscs": "^2.9.0", | ||
"uglify-js": "^2.6.1", | ||
"browserify": "^13.0.0", | ||
"jscs": "^3.0.7", | ||
"uglify-js": "^2.7.5", | ||
"browserify": "^14.1.0", | ||
"browserify-derequire": "^0.9.4", | ||
"jasmine-node": "^1.14.5", | ||
"jsdoc-to-markdown": "^1.3.3", | ||
"nsp": "^2.2.0" | ||
"jsdoc-to-markdown": "^3.0.0", | ||
"nsp": "^2.6.2" | ||
}, | ||
@@ -57,2 +61,3 @@ "scripts": { | ||
"style": "jscs index.js", | ||
"eslint": "eslint *.js tests/spec/*.js", | ||
"docs": "jsdoc2md --name-format --example-lang js index.js > README.md", | ||
@@ -59,0 +64,0 @@ "build": "browserify -p browserify-derequire -e index.js -o lib/define-properties-x.js -u 'crypto' -s returnExports", |
<a name="module_define-properties-x"></a> | ||
## define-properties-x | ||
@@ -45,3 +46,3 @@ <a href="https://travis-ci.org/Xotic750/define-properties-x" | ||
**Version**: 1.1.4 | ||
**Version**: 1.2.0 | ||
**Author:** Xotic750 <Xotic750@gmail.com> | ||
@@ -53,6 +54,7 @@ **License**: [MIT](<https://opensource.org/licenses/MIT>) | ||
* [`~supportsDescriptors`](#module_define-properties-x..supportsDescriptors) : <code>boolean</code> | ||
* [`~properties(object, map, [predicates])`](#module_define-properties-x..properties) | ||
* [`~property(object, prop, value, [force])`](#module_define-properties-x..property) | ||
* [`~properties(object, map, [predicates])`](#module_define-properties-x..properties) | ||
<a name="module_define-properties-x..supportsDescriptors"></a> | ||
### `define-properties-x~supportsDescriptors` : <code>boolean</code> | ||
@@ -68,26 +70,4 @@ Boolean indicator as to whether the environments supports descriptors | ||
``` | ||
<a name="module_define-properties-x..property"></a> | ||
### `define-properties-x~property(object, prop, value, [force])` | ||
Just like `properties` but for defining a single non-enumerable | ||
property. Useful in environments that do not | ||
support `Computed property names`. This can be done | ||
with `properties`, but this method can read a little cleaner. | ||
<a name="module_define-properties-x..properties"></a> | ||
**Kind**: inner method of <code>[define-properties-x](#module_define-properties-x)</code> | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| object | <code>Object</code> | | The object on which to define the property. | | ||
| prop | <code>string</code> | <code>Symbol</code> | | The property name. | | ||
| value | <code>\*</code> | | The value of the property. | | ||
| [force] | <code>boolean</code> | <code>false</code> | If `true` then set property regardless. | | ||
**Example** | ||
```js | ||
var define = require('define-properties-x'); | ||
var myString = 'something'; | ||
define.property(obj, Symbol.iterator, function () {}, true); | ||
define.property(obj, myString, function () {}, true); | ||
``` | ||
<a name="module_define-properties-x..properties"></a> | ||
### `define-properties-x~properties(object, map, [predicates])` | ||
@@ -119,1 +99,25 @@ Define multiple non-enumerable properties at once. | ||
``` | ||
<a name="module_define-properties-x..property"></a> | ||
### `define-properties-x~property(object, prop, value, [force])` | ||
Just like `properties` but for defining a single non-enumerable | ||
property. Useful in environments that do not | ||
support `Computed property names`. This can be done | ||
with `properties`, but this method can read a little cleaner. | ||
**Kind**: inner method of <code>[define-properties-x](#module_define-properties-x)</code> | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| object | <code>Object</code> | | The object on which to define the property. | | ||
| prop | <code>string</code> | <code>Symbol</code> | | The property name. | | ||
| value | <code>\*</code> | | The value of the property. | | ||
| [force] | <code>boolean</code> | <code>false</code> | If `true` then set property regardless. | | ||
**Example** | ||
```js | ||
var define = require('define-properties-x'); | ||
var myString = 'something'; | ||
define.property(obj, Symbol.iterator, function () {}, true); | ||
define.property(obj, myString, function () {}, true); | ||
``` |
@@ -1,12 +0,16 @@ | ||
/*jslint maxlen:80, es6:true, white:true */ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:2, | ||
maxstatements:15, maxcomplexity:6 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:2, | ||
maxstatements:12, maxcomplexity:4 */ | ||
/*global JSON:true, expect, module, require, describe, it, xit, returnExports */ | ||
/* eslint strict: 1, max-lines: 1, symbol-description: 1, max-nested-callbacks: 1, | ||
max-statements: 1, id-length: 1 */ | ||
(function () { | ||
/* global JSON:true, expect, module, require, describe, xit, it, returnExports */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
@@ -23,2 +27,9 @@ | ||
require('es6-shim'); | ||
var es7 = require('es7-shim'); | ||
Object.keys(es7).forEach(function (key) { | ||
var obj = es7[key]; | ||
if (typeof obj.shim === 'function') { | ||
obj.shim(); | ||
} | ||
}); | ||
lib = require('../../index.js'); | ||
@@ -30,9 +41,5 @@ } else { | ||
var arePropertyDescriptorsSupported = function () { | ||
var obj = { | ||
a: 1 | ||
}; | ||
var obj = { a: 1 }; | ||
try { | ||
Object.defineProperty(obj, 'x', { | ||
value: obj | ||
}); | ||
Object.defineProperty(obj, 'x', { value: obj }); | ||
return obj.x === obj; | ||
@@ -42,6 +49,4 @@ } catch (ignore) {} /* this is IE 8. */ | ||
}, | ||
descriptorsSupported = Boolean(Object.defineProperty) && | ||
arePropertyDescriptorsSupported(), | ||
hasSymbols = typeof Symbol === 'function' && | ||
typeof Symbol() === 'symbol', | ||
descriptorsSupported = Boolean(Object.defineProperty) && arePropertyDescriptorsSupported(), | ||
hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol', | ||
ifHasSymbolsIt = hasSymbols ? it : xit, | ||
@@ -248,7 +253,7 @@ ifDescriptorsSupportedIt = descriptorsSupported ? it : xit, | ||
expect(obj).toEqual({ | ||
a: 1, | ||
b: 2, | ||
c: 3, | ||
d: 5 | ||
}, | ||
a: 1, | ||
b: 2, | ||
c: 3, | ||
d: 5 | ||
}, | ||
'existing properties were not overridden, new properties were added' | ||
@@ -282,5 +287,3 @@ ); | ||
var bValue = {}; | ||
var properties = { | ||
a: aValue | ||
}; | ||
var properties = { a: aValue }; | ||
properties[sym] = bValue; | ||
@@ -287,0 +290,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165240
14
1244
120
14
Updatedhas-symbol-support-x@^1.1.0
Updatedis-function-x@^1.1.0