New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eik/common

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eik/common - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/schemas/validation-error.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.2.0](https://github.com/eik-lib/common/compare/v1.1.0...v1.2.0) (2020-09-14)
### Features
* expose validation error ([66585ef](https://github.com/eik-lib/common/commit/66585ef3de7e6e272fcb4ec7ffa8649f2fff0598))
# [1.1.0](https://github.com/eik-lib/common/compare/v1.0.1...v1.1.0) (2020-09-10)

@@ -2,0 +9,0 @@

35

lib/schemas/assert.js

@@ -12,29 +12,22 @@ 'use strict';

} = require('./validate');
const ValidationError = require('./validation-error');
class ValidationError extends Error {
constructor(message, err) {
let m = message;
if (err && err.message) m += `: ${err.message}`;
super(m);
this.name = this.constructor.name;
Error.captureStackTrace(this, this.constructor);
}
}
const assert = (validate, message) => {
return (value) => {
return value => {
const valid = validate(value);
if (valid.error) {
const errorMessage = valid.error.map(err => err.message).join(',')
const errorMessage = valid.error.map(err => err.message).join(',');
throw new ValidationError(`${message}: ${errorMessage}`);
}
}
}
};
};
module.exports.eikJSON = assert(eikJSON, 'Invalid eik.json schema');
module.exports.name = assert(name, 'Parameter "name" is not valid');
module.exports.version = assert(version, 'Parameter "version" is not valid');
module.exports.server = assert(server, 'Parameter "server" is not valid');
module.exports.files = assert(files, 'Parameter "files" is not valid');
module.exports.importMap = assert(importMap, 'Parameter "import-map" is not valid');
module.exports.out = assert(out, 'Parameter "out" is not valid');
module.exports = {
eikJSON: assert(eikJSON, 'Invalid eik.json schema'),
name: assert(name, 'Parameter "name" is not valid'),
version: assert(version, 'Parameter "version" is not valid'),
server: assert(server, 'Parameter "server" is not valid'),
files: assert(files, 'Parameter "files" is not valid'),
importMap: assert(importMap, 'Parameter "import-map" is not valid'),
out: assert(out, 'Parameter "out" is not valid'),
};

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

const assert = require('./assert');
const ValidationError = require('./validation-error');
module.exports.schema = schema;
module.exports.validate = validate;
module.exports.assert = assert;
module.exports = { schema, validate, assert, ValidationError };

6

package.json
{
"name": "@eik/common",
"version": "1.1.0",
"version": "1.2.0",
"description": "Common utilities for Eik modules",

@@ -36,6 +36,6 @@ "main": "lib/index.js",

"@semantic-release/git": "9.0.0",
"@semantic-release/github": "7.0.7",
"@semantic-release/github": "7.1.1",
"@semantic-release/npm": "7.0.6",
"@semantic-release/release-notes-generator": "9.0.1",
"eslint": "7.8.1",
"eslint": "7.9.0",
"eslint-config-airbnb-base": "14.2.0",

@@ -42,0 +42,0 @@ "eslint-config-prettier": "6.11.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