@randlabs/js-config-reader
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "@randlabs/js-config-reader", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Configuration settings loader", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"src/**/*.ts" | ||
], | ||
"scripts": { | ||
"build": "rimraf lib && tsc", | ||
"build": "rimraf dist && rollup -c", | ||
"prepack": "npm run build", | ||
@@ -32,3 +36,2 @@ "test": "npm run build && node ./node_modules/ava/cli.js --verbose" | ||
"dependencies": { | ||
"@types/json5": "0.0.30", | ||
"ajv": "^6.12.5", | ||
@@ -39,10 +42,18 @@ "ajv-formats-draft2019": "^1.4.3", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@types/json5": "0.0.30", | ||
"@types/node": "^14.11.2", | ||
"@typescript-eslint/eslint-plugin": "^3.10.1", | ||
"@typescript-eslint/parser": "^3.10.1", | ||
"@wessberg/rollup-plugin-ts": "^1.3.5", | ||
"ava": "^3.13.0", | ||
"eslint": "^7.10.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.32.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"tslib": "^2.0.3", | ||
"typescript": "^4.0.3" | ||
} | ||
} |
@@ -52,3 +52,4 @@ import Ajv from "ajv"; | ||
* @param {Options} options - Initialization options including the settings' source. Can be a filename or url depending on the used loader. | ||
* @param {string} options.source - Source location of the configuration settings. | ||
* Optional. | ||
* @param {string} options.source - Source location of the configuration settings. Optional. | ||
* @param {string} options.envVar - Environment variable name used to find the source. Optional. | ||
@@ -64,8 +65,13 @@ * @param {string} options.cmdLineParam - Command-line parameter to use to find the source. Optional. | ||
*/ | ||
export async function initialize<S = DefaultSettings>(options: Options<S>): Promise<S> { | ||
export async function initialize<S = DefaultSettings>(options?: Options<S>): Promise<S> { | ||
let source: string | undefined; | ||
if (!options) { | ||
throw new Error("Options not set"); | ||
if (typeof options !== "undefined") { | ||
if (typeof options !== "object" || Array.isArray(options)) { | ||
throw new Error("Options not set"); | ||
} | ||
} | ||
else { | ||
options = {}; | ||
} | ||
@@ -72,0 +78,0 @@ // if a source was passed, use it |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
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
3
32274
15
8
218
1
- Removed@types/json5@0.0.30
- Removed@types/json5@0.0.30(transitive)