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

apw

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apw - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

39

lib/arch.js

@@ -1,2 +0,3 @@

var Q = require('q'),
var UTIL = require('util'),
Q = require('q'),
INHERIT = require('inherit'),

@@ -188,6 +189,6 @@ ASSERTS = require('./asserts'),

*/
removeNode: function(id, leaveInChildren) {
removeNode: function(id) {
id = U.getNodeId(id);
U.removeNode(this.children, this.parents, id, leaveInChildren);
U.removeNode(this.children, this.parents, id);

@@ -475,2 +476,10 @@ delete this.nodes[id];

/**
* Returns arch in the JSON form used by the arch visualization feature.
* @return {String}
*/
toJson: function() {
return U.toJson(this);
},
/**
* Dump node with its children to string.

@@ -517,4 +526,28 @@ *

return s;
},
/**
* Returns arch in the JSON form used by the arch visualization feature.
* @param {String} id Id of the root node
* @return {String}
*/
nodeToJson: function(id) {
var nodes = {},
links = {};
this._traverse(id, nodes, links);
return U.toJson(this, nodes, links);
},
_traverse: function(id, nodes, links) {
links[id] = this.children[id];
nodes[id] = this.getNode(id);
_this.children[id].forEach(function(c) {
traverse(c, nodes, links)
}, this);
}
});

@@ -1,2 +0,3 @@

var INHERIT = require('inherit'),
var UTIL = require('util'),
INHERIT = require('inherit'),
ASSERTS = require('./asserts'),

@@ -658,2 +659,10 @@ U = require('./util'),

/**
* Returns plan in the JSON form used by the arch visualization feature.
* @return {String}
*/
toJson: function() {
return U.toJson(this.arch, this.arch.nodes, this.children);
},
/**
* Dump node with its children to string.

@@ -660,0 +669,0 @@ *

@@ -0,1 +1,3 @@

var UTIL = require('util');
/**

@@ -217,1 +219,41 @@ * Wrap object in array if it is not array already.

};
/**
* Returns arch in the JSON form used by the arch visualization feature.
* @param {Object} arch Arch (or Plan) to visualize.
* @param {Object} [nodes] Hash of nodes (required when first argument is Plan).
* @param {Object} [children] Hash of links (required when first argument is Plan).
* @return {String}
*/
exports.toJson = function(arch, nodes, children) {
var nodes = nodes || arch.nodes,
children = children || arch.children,
nodesIds = Object.keys(nodes),
links = [];
Object.keys(children)
.filter(function(parent) {
return children[parent] && children[parent].length > 0;
})
.forEach(function(parent) {
children[parent]
.forEach(function(c) {
links.push({
source: nodesIds.indexOf(parent),
target: nodesIds.indexOf(c)
});
});
});
return JSON.stringify({
nodes: nodesIds.map(function(r) {
var node = arch.getNode(r);
return {
name: node.getId(),
type: node.nodeType
};
}),
links: links
});
}

2

package.json
{
"name": "apw",
"version": "0.3.4",
"version": "0.3.5",
"homepage": "http://github.com/bem/apw",

@@ -5,0 +5,0 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (http://github.com/afelix)",

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