Comparing version 0.10.2 to 0.11.0
@@ -0,1 +1,11 @@ | ||
<a name="0.11.0"></a> | ||
# [0.11.0](https://github.com/boosterfuels/archetype/compare/v0.10.2...v0.11.0) (2020-02-27) | ||
### Features | ||
* make `new Type()` clone by default, but allow passing in an option to disable cloning for perf ([3638b57](https://github.com/boosterfuels/archetype/commit/3638b57)) | ||
<a name="0.10.2"></a> | ||
@@ -2,0 +12,0 @@ ## [0.10.2](https://github.com/boosterfuels/archetype/compare/v0.10.0...v0.10.2) (2020-02-25) |
{ | ||
"name": "archetype", | ||
"version": "0.10.2", | ||
"version": "0.11.0", | ||
"author": "Valeri Karpov <val@boosterfuels.com>", | ||
"dependencies": { | ||
"lodash.clonedeep": "4.x", | ||
"lodash.set": "4.x", | ||
@@ -7,0 +8,0 @@ "mpath": "0.5.1", |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const Type = require('./type'); | ||
const cloneDeep = require('lodash.clonedeep'); | ||
const get = require('./get'); | ||
@@ -13,3 +14,3 @@ const set = require('lodash.set'); | ||
constructor(obj) { | ||
this._obj = obj; | ||
this._obj = cloneDeep(obj); | ||
this._paths = {}; | ||
@@ -16,0 +17,0 @@ } |
'use strict'; | ||
const cloneDeep = require('lodash.clonedeep'); | ||
const unmarshal = require('./unmarshal'); | ||
class Type { | ||
constructor(obj, projection) { | ||
constructor(obj, projection, options) { | ||
options = options || {}; | ||
if (options.clone !== false) { | ||
obj = cloneDeep(obj); | ||
} | ||
Object.assign(this, unmarshal(obj, this.constructor.schema, projection)); | ||
@@ -8,0 +14,0 @@ } |
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
43544
806
4
+ Addedlodash.clonedeep@4.x
+ Addedlodash.clonedeep@4.5.0(transitive)