Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

archetype

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archetype - npm Package Compare versions

Comparing version 0.8.2 to 0.8.3

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.8.3"></a>
## [0.8.3](https://github.com/boosterfuels/archetype/compare/v0.8.2...v0.8.3) (2018-03-21)
### Features
* support inPlace updates for recursive schemas ([8f61d32](https://github.com/boosterfuels/archetype/commit/8f61d32)), closes [#11](https://github.com/boosterfuels/archetype/issues/11)
<a name="0.8.2"></a>

@@ -2,0 +12,0 @@ ## [0.8.2](https://github.com/boosterfuels/archetype/compare/v0.8.1...v0.8.2) (2017-12-03)

8

package.json
{
"name": "archetype",
"version": "0.8.2",
"version": "0.8.3",
"author": "Valeri Karpov <val@boosterfuels.com>",

@@ -12,5 +12,5 @@ "dependencies": {

"devDependencies": {
"acquit": "0.4.1",
"acquit": "0.6.1",
"acquit-ignore": "0.0.3",
"acquit-markdown": "0.0.2",
"acquit-markdown": "0.0.8",
"co": "4.6.0",

@@ -21,3 +21,3 @@ "gulp": "3.8.11",

"mocha": "3.5.0",
"mongodb": "~2.2",
"mongodb": "~3.0",
"standard-changelog": "1.0.1"

@@ -24,0 +24,0 @@ },

@@ -54,2 +54,4 @@ # archetype

* 20180112: [Virtual Types with Archetype](https://gist.github.com/vkarpov15/32abd9f72dfb2ba1558e9e6a1060c768)
* 20180105: [Transform an Archetype So All Properties are Not Required](https://gist.github.com/vkarpov15/6c49c0bc5ed0eab42633645bf03e8fa7)
* 20171124: [Embedding Only Certain Fields in an Embedded Archetype](https://gist.github.com/vkarpov15/37622608b33eb144acfda5d3ad936be6)

@@ -56,0 +58,0 @@ * 20171117: [Async/Await with Archetype](https://gist.github.com/vkarpov15/f10b560468f49166bcc14c6e41bb755e)

@@ -28,3 +28,3 @@ 'use strict';

type.path = (path, props) => this.path(path, props);
type.path = (path, props, opts) => this.path(path, props, opts);
type.omit = path => this.omit(path);

@@ -42,6 +42,10 @@ type.pick = paths => this.pick(paths);

path(path, props) {
path(path, props, options) {
if (!props) {
return _.get(this._obj, path);
}
if (_.get(options, 'inPlace')) {
_.set(this._obj, path, props);
return this;
}
const newSchema = new Archetype(this._obj);

@@ -48,0 +52,0 @@ _.set(newSchema._obj, path, props);

@@ -345,2 +345,27 @@ 'use strict';

it('recursive', function() {
let NodeType = new Archetype({
value: { $type: null }
}).compile('NodeType');
NodeType.
path('left', { $type: NodeType }, { inPlace: true }).
path('right', { $type: NodeType }, { inPlace: true }).
compile('NodeType');
const raw = {
value: 'root',
left: {
value: 'left'
},
right: {
left: {
value: 'right->left'
},
value: 'right'
}
};
assert.deepEqual(raw, new NodeType(raw));
assert.equal(raw.right.left.value, 'right->left');
});
it('required function', function() {

@@ -347,0 +372,0 @@ const Person = new Archetype({

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