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

@buggyorg/checker

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

@buggyorg/checker - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

12

lib/checker.js

@@ -6,4 +6,5 @@ 'use strict';

});
exports.errors = errors;
exports.check = check;
function check(graph) {
function errors(graph) {
var edges = graph.edges();

@@ -29,2 +30,11 @@ var nodes = graph.nodes();

return errorList;
}
function check(graph) {
var errs = errors(graph);
if (errs.length === 0) {
return graph;
} else {
throw new Error('Found problems while checking graph\n ' + JSON.stringify(errs, null, 2));
}
}

2

package.json
{
"name": "@buggyorg/checker",
"version": "0.1.0",
"version": "0.1.1",
"description": "A buggy graph consistency checker.",

@@ -5,0 +5,0 @@ "main": "lib/api.js",

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

export function check (graph) {
export function errors (graph) {
var edges = graph.edges()

@@ -23,1 +23,10 @@ var nodes = graph.nodes()

}
export function check (graph) {
var errs = errors(graph)
if (errs.length === 0) {
return graph
} else {
throw new Error(`Found problems while checking graph\n ${JSON.stringify(errs, null, 2)}`)
}
}

@@ -14,3 +14,3 @@ /* global describe, it */

it('Find errors in the graph', function () {
var d = checker.check(graph)
var d = checker.errors(graph)
expect(d).to.have.length(3)

@@ -23,7 +23,17 @@ d = _.flatten(d)

it('throws an exception if an error occurs while checking', () => {
expect(() => checker.check(graph)).to.throw(Error)
})
it('returns an empty array if no errors occur', () => {
var g = grlib.json.read(JSON.parse(fs.readFileSync('./test/fixtures/inc.json')))
var res = checker.check(g)
var res = checker.errors(g)
expect(res).to.have.length(0)
})
it('returns the same graph if no error occurs', () => {
var g = grlib.json.read(JSON.parse(fs.readFileSync('./test/fixtures/inc.json')))
var newG = checker.check(g)
expect(grlib.json.write(newG)).to.deep.equal(grlib.json.write(g))
})
})
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