node-opcua-assert
Advanced tools
Comparing version
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/*** | ||
* @module node-opcua-assert | ||
*/ | ||
const chalk_1 = require("chalk"); | ||
const displayAssert = process.env.DISPLAY_ASSERT ? true : false; | ||
function assert(cond, message) { | ||
if (!cond) { | ||
const err = new Error(message); | ||
console.log(chalk_1.default.whiteBright.bgRed("-----------------------------------------------------------")); | ||
console.log(err); | ||
console.log(chalk_1.default.whiteBright.bgRed("-----------------------------------------------------------")); | ||
if (displayAssert) { | ||
// tslint:disable:no-console | ||
console.log(chalk_1.default.whiteBright.bgRed("-----------------------------------------------------------")); | ||
console.log(chalk_1.default.whiteBright.bgRed(message)); | ||
console.log(err); | ||
console.log(chalk_1.default.whiteBright.bgRed("-----------------------------------------------------------")); | ||
} | ||
throw err; | ||
@@ -15,3 +23,2 @@ } | ||
exports.default = assert; | ||
exports.assert = assert; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "node-opcua-assert", | ||
"version": "0.5.0", | ||
"version": "2.0.0-alpha.2", | ||
"description": "pure nodejs OPCUA SDK - module -assert", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "echo nothing to do" | ||
"test": "echo nothing to do", | ||
"clean": "node -e \"require('rimraf').sync('dist');\"", | ||
"lint": "tslint source/**/*.ts" | ||
}, | ||
"dependencies": { | ||
"better-assert": "^1.0.2", | ||
"better-assert": "1.0.2", | ||
"chalk": "^2.4.1" | ||
@@ -30,3 +32,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "7c2f2dcb6ebdc49e57da1a028406a307df502d4e" | ||
"gitHead": "7f57dd90e9d8bd1abcb8d330b3470999ac51e33f" | ||
} |
@@ -0,9 +1,18 @@ | ||
/*** | ||
* @module node-opcua-assert | ||
*/ | ||
import chalk from "chalk"; | ||
const displayAssert = process.env.DISPLAY_ASSERT ? true : false; | ||
export function assert(cond: boolean | object | null | undefined | Function, message?: string): void { | ||
if (!cond) { | ||
const err = new Error(message); | ||
console.log(chalk.whiteBright.bgRed("-----------------------------------------------------------")); | ||
console.log(err); | ||
console.log(chalk.whiteBright.bgRed("-----------------------------------------------------------")); | ||
if (displayAssert) { | ||
// tslint:disable:no-console | ||
console.log(chalk.whiteBright.bgRed("-----------------------------------------------------------")); | ||
console.log(chalk.whiteBright.bgRed(message!)); | ||
console.log(err); | ||
console.log(chalk.whiteBright.bgRed("-----------------------------------------------------------")); | ||
} | ||
throw err; | ||
@@ -13,2 +22,1 @@ } | ||
export default assert; | ||
exports.assert = assert; |
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"skipLibCheck": true, | ||
"target": "es6", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"outDir": "./dist", | ||
"sourceMap": true, | ||
"sourceRoot": "./source", | ||
"strict": true | ||
} | ||
} | ||
"rootDir": "source", | ||
"outDir": "dist" | ||
}, | ||
"files": [ | ||
"./source/index.ts" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
4489
18.38%53
32.5%1
Infinity%Updated