Socket
Socket
Sign inDemoInstall

define-properties-x

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

define-properties-x - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

46

index.js

@@ -45,3 +45,3 @@ /**

*
* @version 1.0.2
* @version 1.1.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -94,16 +94,16 @@ * @copyright Xotic750

/**
* Method `defineProperty`.
* Method `property`.
*
* @private
* @param {Object} object The object on which to define the property.
* @param {string|Symbol} property The property name.
* @param {string|Symbol} prop The property name.
* @param {*} value The value of the property.
* @param {boolean} [force=false] If `true` then set property regardless.
*/
function defineProperty(object, property, value, force) {
if (property in object && !force) {
function property(object, prop, value, force) {
if (prop in object && !force) {
return;
}
if (supportsDescriptors) {
$defineProperty(object, property, {
$defineProperty(object, prop, {
configurable: true,

@@ -115,3 +115,3 @@ enumerable: false,

} else {
object[property] = value;
object[prop] = value;
}

@@ -121,3 +121,3 @@ }

/**
* Method `defineProperties`.
* Method `properties`.
*

@@ -129,3 +129,3 @@ * @private

*/
function defineProperties(object, map, predicates) {
function properties(object, map, predicates) {
var preds = isUndefined(predicates) ? {} : predicates;

@@ -138,3 +138,3 @@ var props = $keys(map);

var predicate = preds[name];
defineProperty(
property(
object,

@@ -148,21 +148,21 @@ name,

defineProperties(module.exports, {
properties(module.exports, {
/**
* Just like `defineProperties` but for defining a single non-enumerable
* 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 `defineProperties`, but this method can read a little cleaner.
* 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} property The property name.
* @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 lib = require('define-properties-x');
* var define = require('define-properties-x');
* var myString = 'something';
* lib.defineProperty(obj, Symbol.iterator, function () {}, true);
* lib.defineProperty(obj, myString, function () {}, true);
* define.property(obj, Symbol.iterator, function () {}, true);
* define.property(obj, myString, function () {}, true);
*/
defineProperty: defineProperty,
property: property,
/**

@@ -180,4 +180,4 @@ * Define multiple non-enumerable properties at once.

* @example
* var lib = require('define-properties-x');
* lib.defineProperties({
* var define = require('define-properties-x');
* define.properties({
* a: 1,

@@ -190,3 +190,3 @@ * b: 2

*/
defineProperties: defineProperties,
properties: properties,
/**

@@ -198,4 +198,4 @@ * Boolean indicator as to whether the environments supports descriptors

* @example
* var lib = require('define-properties-x');
* lib.supportsDescriptors; // true or false
* var define = require('define-properties-x');
* define.supportsDescriptors; // true or false
*/

@@ -202,0 +202,0 @@ supportsDescriptors: supportsDescriptors

@@ -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.0.2
* @version 1.1.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -95,16 +95,16 @@ * @copyright Xotic750

/**
* Method `defineProperty`.
* Method `property`.
*
* @private
* @param {Object} object The object on which to define the property.
* @param {string|Symbol} property The property name.
* @param {string|Symbol} prop The property name.
* @param {*} value The value of the property.
* @param {boolean} [force=false] If `true` then set property regardless.
*/
function defineProperty(object, property, value, force) {
if (property in object && !force) {
function property(object, prop, value, force) {
if (prop in object && !force) {
return;
}
if (supportsDescriptors) {
$defineProperty(object, property, {
$defineProperty(object, prop, {
configurable: true,

@@ -116,3 +116,3 @@ enumerable: false,

} else {
object[property] = value;
object[prop] = value;
}

@@ -122,3 +122,3 @@ }

/**
* Method `defineProperties`.
* Method `properties`.
*

@@ -130,3 +130,3 @@ * @private

*/
function defineProperties(object, map, predicates) {
function properties(object, map, predicates) {
var preds = isUndefined(predicates) ? {} : predicates;

@@ -139,3 +139,3 @@ var props = $keys(map);

var predicate = preds[name];
defineProperty(
property(
object,

@@ -149,21 +149,21 @@ name,

defineProperties(module.exports, {
properties(module.exports, {
/**
* Just like `defineProperties` but for defining a single non-enumerable
* 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 `defineProperties`, but this method can read a little cleaner.
* 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} property The property name.
* @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 lib = require('define-properties-x');
* var define = require('define-properties-x');
* var myString = 'something';
* lib.defineProperty(obj, Symbol.iterator, function () {}, true);
* lib.defineProperty(obj, myString, function () {}, true);
* define.property(obj, Symbol.iterator, function () {}, true);
* define.property(obj, myString, function () {}, true);
*/
defineProperty: defineProperty,
property: property,
/**

@@ -181,4 +181,4 @@ * Define multiple non-enumerable properties at once.

* @example
* var lib = require('define-properties-x');
* lib.defineProperties({
* var define = require('define-properties-x');
* define.properties({
* a: 1,

@@ -191,3 +191,3 @@ * b: 2

*/
defineProperties: defineProperties,
properties: properties,
/**

@@ -199,4 +199,4 @@ * Boolean indicator as to whether the environments supports descriptors

* @example
* var lib = require('define-properties-x');
* lib.supportsDescriptors; // true or false
* var define = require('define-properties-x');
* define.supportsDescriptors; // true or false
*/

@@ -203,0 +203,0 @@ supportsDescriptors: supportsDescriptors

@@ -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 defineProperty(t,e,n,r){e in t&&!r||(p?c(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n)}function defineProperties(t,e,c){var p=o(c)?{}:c,l=f(e);n&&s&&(l=i.call(l,s(e))),u.call(l,function(n){var o=p[n];defineProperty(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,f=Object.keys,s=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}}();defineProperties(e.exports,{defineProperty:defineProperty,defineProperties:defineProperties,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]",f="[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===f}}()},{"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,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)});
//# sourceMappingURL=lib/define-properties-x.map
{
"name": "define-properties-x",
"version": "1.0.2",
"version": "1.1.0",
"description": "Based on the original work by Jordan Harband https://www.npmjs.com/package/define-properties",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/Xotic750/define-properties-x",

@@ -45,3 +45,3 @@ <a name="module_define-properties-x"></a>

**Version**: 1.0.2
**Version**: 1.1.0
**Author:** Xotic750 <Xotic750@gmail.com>

@@ -53,4 +53,4 @@ **License**: [MIT](&lt;https://opensource.org/licenses/MIT&gt;)

* [`~supportsDescriptors`](#module_define-properties-x..supportsDescriptors) : <code>boolean</code>
* [`~defineProperty(object, property, value, [force])`](#module_define-properties-x..defineProperty)
* [`~defineProperties(object, map, [predicates])`](#module_define-properties-x..defineProperties)
* [`~property(object, prop, value, [force])`](#module_define-properties-x..property)
* [`~properties(object, map, [predicates])`](#module_define-properties-x..properties)

@@ -65,11 +65,11 @@ <a name="module_define-properties-x..supportsDescriptors"></a>

```js
var lib = require('define-properties-x');
lib.supportsDescriptors; // true or false
var define = require('define-properties-x');
define.supportsDescriptors; // true or false
```
<a name="module_define-properties-x..defineProperty"></a>
### `define-properties-x~defineProperty(object, property, value, [force])`
Just like `defineProperties` but for defining a single non-enumerable
<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 `defineProperties`, but this method can read a little cleaner.
with `properties`, but this method can read a little cleaner.

@@ -81,3 +81,3 @@ **Kind**: inner method of <code>[define-properties-x](#module_define-properties-x)</code>

| object | <code>Object</code> | | The object on which to define the property. |
| property | <code>string</code> &#124; <code>Symbol</code> | | The property name. |
| prop | <code>string</code> &#124; <code>Symbol</code> | | The property name. |
| value | <code>\*</code> | | The value of the property. |

@@ -88,9 +88,9 @@ | [force] | <code>boolean</code> | <code>false</code> | If `true` then set property regardless. |

```js
var lib = require('define-properties-x');
var define = require('define-properties-x');
var myString = 'something';
lib.defineProperty(obj, Symbol.iterator, function () {}, true);
lib.defineProperty(obj, myString, function () {}, true);
define.property(obj, Symbol.iterator, function () {}, true);
define.property(obj, myString, function () {}, true);
```
<a name="module_define-properties-x..defineProperties"></a>
### `define-properties-x~defineProperties(object, map, [predicates])`
<a name="module_define-properties-x..properties"></a>
### `define-properties-x~properties(object, map, [predicates])`
Define multiple non-enumerable properties at once.

@@ -112,4 +112,4 @@ Uses `Object.defineProperty` when available; falls back to standard

```js
var lib = require('define-properties-x');
lib.defineProperties({
var define = require('define-properties-x');
define.properties({
a: 1,

@@ -116,0 +116,0 @@ b: 2

@@ -74,4 +74,4 @@ /*jslint maxlen:80, es6:true, white:true */

);
lib.defineProperty(obj, 'c', 4);
lib.defineProperty(obj, 'd', 5);
lib.property(obj, 'c', 4);
lib.property(obj, 'd', 5);
expect(obj).toEqual({

@@ -91,5 +91,5 @@ a: 1,

lib.defineProperty(obj, 'a', 2, true);
lib.defineProperty(obj, 'b', 3, false);
lib.defineProperty(obj, 'c', 4);
lib.property(obj, 'a', 2, true);
lib.property(obj, 'b', 3, false);
lib.property(obj, 'c', 4);
expect(obj).toEqual({

@@ -119,5 +119,5 @@ b: 2,

};
lib.defineProperty(obj, 'b', 3);
lib.defineProperty(obj, 'c', 4);
lib.defineProperty(obj, 'd', 5);
lib.property(obj, 'b', 3);
lib.property(obj, 'c', 4);
lib.property(obj, 'd', 5);
expect(obj).toEqual({

@@ -130,5 +130,5 @@ a: 1,

lib.defineProperty(obj, 'a', 2, true);
lib.defineProperty(obj, 'b', 3, false);
lib.defineProperty(obj, 'c', 4);
lib.property(obj, 'a', 2, true);
lib.property(obj, 'b', 3, false);
lib.property(obj, 'c', 4);
expect(obj).toEqual({

@@ -148,4 +148,4 @@ a: 2,

lib.defineProperty(obj, 'a', aValue);
lib.defineProperty(obj, sym, bValue);
lib.property(obj, 'a', aValue);
lib.property(obj, sym, bValue);

@@ -189,3 +189,3 @@ expect(Object.keys(obj)).toEqual(

);
lib.defineProperties(obj, {
lib.properties(obj, {
b: 3,

@@ -209,3 +209,3 @@ c: 4,

lib.defineProperties(obj, {
lib.properties(obj, {
a: 2,

@@ -246,3 +246,3 @@ b: 3,

};
lib.defineProperties(obj, {
lib.properties(obj, {
b: 3,

@@ -261,3 +261,3 @@ c: 4,

lib.defineProperties(obj, {
lib.properties(obj, {
a: 2,

@@ -292,3 +292,3 @@ b: 3,

lib.defineProperties(obj, properties);
lib.properties(obj, properties);

@@ -295,0 +295,0 @@ expect(Object.keys(obj)).toEqual([], 'object has no enumerable keys');

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc