Comparing version 3.0.1 to 3.1.0
@@ -1,18 +0,8 @@ | ||
// Import | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports.custom = custom; | ||
exports.extend = extend; | ||
exports.deep = deep; | ||
exports.defaults = defaults; | ||
exports.deepDefaults = deepDefaults; | ||
exports.clone = clone; | ||
exports.dereferenceJSON = dereferenceJSON; | ||
// Import | ||
var typeChecker = require('typechecker'); | ||
// Internal use only: Extend with customisations | ||
function custom(_ref, target) { | ||
@@ -27,2 +17,7 @@ var _ref$defaults = _ref.defaults; | ||
} | ||
for (var _len = arguments.length, objs = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
objs[_key - 2] = arguments[_key]; | ||
} | ||
var _iteratorNormalCompletion = true; | ||
@@ -33,6 +28,2 @@ var _didIteratorError = false; | ||
try { | ||
for (var _len = arguments.length, objs = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
objs[_key - 2] = arguments[_key]; | ||
} | ||
for (var _iterator = objs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
@@ -85,4 +76,4 @@ var obj = _step.value; | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator['return']) { | ||
_iterator['return'](); | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
@@ -100,3 +91,2 @@ } finally { | ||
// Extend without customisations | ||
function extend() { | ||
@@ -111,3 +101,2 @@ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
// Extend +traverse | ||
function deep() { | ||
@@ -122,3 +111,2 @@ for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
// Extend +defaults | ||
function defaults() { | ||
@@ -133,3 +121,2 @@ for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
// Extend +traverse +defaults | ||
function deepDefaults() { | ||
@@ -144,3 +131,2 @@ for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
// Extend to new object +traverse | ||
function clone() { | ||
@@ -155,5 +141,15 @@ for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { | ||
// Will not keep functions | ||
function dereferenceJSON(source) { | ||
return JSON.parse(JSON.stringify(source)); | ||
} | ||
} | ||
// Export | ||
module.exports = { | ||
custom: custom, | ||
extend: extend, | ||
deep: deep, | ||
defaults: defaults, | ||
deepDefaults: deepDefaults, | ||
clone: clone, | ||
dereferenceJSON: dereferenceJSON | ||
}; |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
// Import | ||
@@ -5,3 +7,3 @@ const typeChecker = require('typechecker') | ||
// Internal use only: Extend with customisations | ||
export function custom ({defaults = false, traverse = false}, target, ...objs) { | ||
function custom ({defaults = false, traverse = false}, target, ...objs) { | ||
if ( !typeChecker.isPlainObject(target) ) { | ||
@@ -21,3 +23,3 @@ throw new Error('extendr only supports extending plain objects, target was not a plain object') | ||
// get the new value | ||
let newValue = obj[key] | ||
const newValue = obj[key] | ||
@@ -58,3 +60,3 @@ // ensure everything is new | ||
// Extend without customisations | ||
export function extend (...args) { | ||
function extend (...args) { | ||
return custom({}, ...args) | ||
@@ -64,3 +66,3 @@ } | ||
// Extend +traverse | ||
export function deep (...args) { | ||
function deep (...args) { | ||
return custom({traverse: true}, ...args) | ||
@@ -70,3 +72,3 @@ } | ||
// Extend +defaults | ||
export function defaults (...args) { | ||
function defaults (...args) { | ||
return custom({defaults: true}, ...args) | ||
@@ -76,3 +78,3 @@ } | ||
// Extend +traverse +defaults | ||
export function deepDefaults (...args) { | ||
function deepDefaults (...args) { | ||
return custom({traverse: true, defaults: true}, ...args) | ||
@@ -82,3 +84,3 @@ } | ||
// Extend to new object +traverse | ||
export function clone (...args) { | ||
function clone (...args) { | ||
return custom({traverse: true}, {}, ...args) | ||
@@ -88,4 +90,15 @@ } | ||
// Will not keep functions | ||
export function dereferenceJSON (source) { | ||
function dereferenceJSON (source) { | ||
return JSON.parse(JSON.stringify(source)) | ||
} | ||
// Export | ||
module.exports = { | ||
custom, | ||
extend, | ||
deep, | ||
defaults, | ||
deepDefaults, | ||
clone, | ||
dereferenceJSON | ||
} |
@@ -1,3 +0,8 @@ | ||
// 18 September 2015 | ||
// https://github.com/bevry/base | ||
module.exports = require('esnextguardian')('./esnext/lib/extendr.js', './es5/lib/extendr.js', require) | ||
// 2015 December 8 | ||
// https://github.com/bevry/esnextguardian | ||
'use strict' | ||
module.exports = require('esnextguardian')( | ||
require('path').join(__dirname, 'esnext', 'lib', 'extendr.js'), | ||
require('path').join(__dirname, 'es5', 'lib', 'extendr.js'), | ||
require | ||
) |
@@ -1,17 +0,20 @@ | ||
## History | ||
# History | ||
## v3.0.1 September 21, 2015 | ||
## v3.1.0 2015 December 9 | ||
- Updated internal conventions | ||
## v3.0.1 2015 September 21 | ||
- Updated dependencies | ||
## v3.0.0 September 11, 2015 | ||
## v3.0.0 2015 September 11 | ||
- Moved from CoffeeScript to ES6+ | ||
- Rewrote to ensure reference consistency | ||
## v2.1.0 June 29, 2013 | ||
## v2.1.0 2013 June 29 | ||
- Arrays now correctly deep extend | ||
## v2.0.1 March 28, 2013 | ||
## v2.0.1 2013 March 28 | ||
- Added `deepExtend` alias for `deepExtendPlainObjects` | ||
## v2.0.0 March 28, 2013 | ||
## v2.0.0 2013 March 28 | ||
- Split away from [bal-util](https://github.com/balupton/bal-util') |
{ | ||
"name": "extendr", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Utilities for cloning, extending, and de-referencing objects in shallow, deep, and safe ways", | ||
@@ -48,3 +48,4 @@ "homepage": "https://github.com/bevry/extendr", | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)", | ||
"Sean Fridman <fridman@mail.sfsu.edu> (www.seanfridman.com)" | ||
"Sean Fridman <fridman@mail.sfsu.edu> (www.seanfridman.com)", | ||
"Sean Fridman <mail@seanfridman.com> (http://seanfridman.com)" | ||
], | ||
@@ -61,2 +62,3 @@ "bugs": { | ||
}, | ||
"browsers": true, | ||
"dependencies": { | ||
@@ -68,4 +70,4 @@ "esnextguardian": "^1.1.0", | ||
"assert-helpers": "^4.0.1", | ||
"babel": "^5.8.23", | ||
"babel-eslint": "^4.1.3", | ||
"babel-cli": "^6.3.15", | ||
"babel-preset-es2015": "^6.3.13", | ||
"eslint": "^1.5.0", | ||
@@ -79,3 +81,3 @@ "joe": "^1.6.0", | ||
"jspm": { | ||
"main": "./esnext/lib/extendr.js" | ||
"main": "./es5/lib/extendr.js" | ||
}, | ||
@@ -82,0 +84,0 @@ "scripts": { |
@@ -45,3 +45,3 @@ <!-- TITLE/ --> | ||
<li>Use: <code>require('extendr')</code></li> | ||
<li>CDN URL: <code>//wzrd.in/bundle/extendr@3.0.1</code></li></ul> | ||
<li>CDN URL: <code>//wzrd.in/bundle/extendr@3.1.0</code></li></ul> | ||
@@ -117,3 +117,4 @@ <a href="http://enderjs.com" title="Ender is a full featured package manager for your browser"><h3>Ender</h3></a><ul> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/extendr/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/extendr">view contributions</a></li> | ||
<li><a href="www.seanfridman.com">Sean Fridman</a> — <a href="https://github.com/bevry/extendr/commits?author=sfrdmn" title="View the GitHub contributions of Sean Fridman on repository bevry/extendr">view contributions</a></li></ul> | ||
<li><a href="www.seanfridman.com">Sean Fridman</a></li> | ||
<li><a href="http://seanfridman.com">Sean Fridman</a> — <a href="https://github.com/bevry/extendr/commits?author=sfrdmn" title="View the GitHub contributions of Sean Fridman on repository bevry/extendr">view contributions</a></li></ul> | ||
@@ -120,0 +121,0 @@ <a href="https://github.com/bevry/extendr/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a> |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
39294
10
707
138