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

arbre-node

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arbre-node - npm Package Compare versions

Comparing version 0.0.0-alpha.0a71f0d4 to 0.0.0-alpha.0a71f0d4-alpha.1fae31d4

6

index.es.js

@@ -1,6 +0,6 @@

import merge from 'merge-deep';
import clone from 'clone';
class Node {
constructor(props) {
merge(this, props);
constructor(value) {
this.value = clone(value);
this.parent = null;

@@ -7,0 +7,0 @@ this.children = [];

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('merge-deep')) :
typeof define === 'function' && define.amd ? define(['merge-deep'], factory) :
(global.arbreNode = factory(global.merge));
}(this, (function (merge) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('clone')) :
typeof define === 'function' && define.amd ? define(['clone'], factory) :
(global.arbreNode = factory(global.clone));
}(this, (function (clone) { 'use strict';
merge = 'default' in merge ? merge['default'] : merge;
clone = 'default' in clone ? clone['default'] : clone;
class Node {
constructor(props) {
merge(this, props);
constructor(value) {
this.value = clone(value);
this.parent = null;

@@ -13,0 +13,0 @@ this.children = [];

@@ -1,6 +0,6 @@

import merge from 'merge-deep'
import clone from 'clone'
export default class Node {
constructor(props) {
merge(this, props)
constructor(value) {
this.value = clone(value)
this.parent = null

@@ -7,0 +7,0 @@ this.children = []

{
"name": "arbre-node",
"version": "0.0.0-alpha.0a71f0d4",
"version": "0.0.0-alpha.0a71f0d4-alpha.1fae31d4",
"main": "index.js",

@@ -23,3 +23,6 @@ "jsnext:main": "index.es.js",

"build": "simple"
},
"dependencies": {
"clone": "^1.0.2"
}
}
import test from 'ava'
import Node from '../lib/node'
test('mix props into node', t => {
const node = new Node({ foo: 'bar' })
test('set value', t => {
const value = 'foo'
const node = new Node(value)
t.is(node.foo, 'bar')
t.is(node.value, value)
})
test('clone props', t => {
const props = { foo: { bar: 'baz' }}
const node = new Node(props)
test('clone value', t => {
const value = { foo: { bar: 'baz' }}
const node = new Node(value)
t.not(node.foo, props.foo)
t.deepEqual(node.foo, props.foo)
t.not(node.value, value)
t.not(node.value.foo, value.foo)
t.deepEqual(node.value, value)
})
test('set undefined value by default', t => {
const node = new Node()
t.is(node.value, undefined)
})
test('set parent to null', t => {
const node = new Node()
t.is(node.parent, null)
})
test('set children to empty array', t => {
const node = new Node()
t.true(Array.isArray(node.children))
t.is(node.children.length, 0)
})
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