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

neuron-tree

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neuron-tree - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

test/fixtures/expected.js

9

package.json
{
"name": "neuron-tree",
"version": "0.1.0",
"version": "0.1.1",
"description": "Generates the config.tree of neuron",

@@ -20,3 +20,3 @@ "main": "index.js",

],
"engines": {
"engines": {
"node": ">=0.11.0"

@@ -31,4 +31,7 @@ },

"mocha": "*",
"chai": "*"
"chai": "*",
"shrinked": "~0.1.3",
"test-fixture": "~1.0.1",
"jsonfile": "~1.1.1"
}
}

@@ -18,6 +18,16 @@ # neuron-tree [![NPM version](https://badge.fury.io/js/neuron-tree.svg)](http://badge.fury.io/js/neuron-tree) [![Build Status](https://travis-ci.org/cortexjs/neuron-tree.svg?branch=master)](https://travis-ci.org/cortexjs/neuron-tree) [![Dependency Status](https://gemnasium.com/cortexjs/neuron-tree.svg)](https://gemnasium.com/cortexjs/neuron-tree)

### tree.parse(shrinked)
### tree.parse(shrinked, types)
- shrinked `Object` the shrinked object of [shrinked](https://www.npmjs.org/package/shrinked)
- types `Array.<type>` the array of types of dependencies, default to
[
"dependencies",
"asyncDependencies"
]
you could include other types of dependencies in the array.
- type `String` available types: `'dependencies'`, `'asyncDependencies'`, `'engines'`, `devDependencies`
Parses the shrinked B+ tree, and generates a simpler tree for `config.tree` of neuron.

@@ -24,0 +34,0 @@

'use strict';
var expect = require('chai').expect;
var neuron_tree = require('../');
var tree = require('../');
var shrinked = require('shrinked');
var fixture = require('test-fixture')();
var jf = require('jsonfile');
var cases = {
full: {
types: [
'devDependencies',
'asyncDependencies',
'dependencies',
'engines'
],
e: function (tree, e) {
expect(tree).to.deep.equal(e);
}
},
pro: {
types: [
'asyncDependencies',
'dependencies',
'engines'
],
e: function (tree, e) {
expect(tree).to.deep.equal(e);
}
},
pro_no_engine: {
tree: [
'asyncDependencies',
'dependencies'
],
e: function (tree, e) {
expect(tree).to.deep.equal(e);
}
}
};
var shrinkwrap = jf.readFileSync(fixture.resolve('shrink.json'));
var expected = require(fixture.resolve('expected'));
Object.keys(cases).forEach(function (type) {
var c = cases[type];
describe(type, function(){
it("tree.parse()", function(){
var parsed = shrinked.parse(shrinkwrap, {
dependencyKeys: c.types
});
var t = tree.parse(parsed, c.types);
c.e(t, expected[type]);
});
});
});
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