Comparing version 0.2.1 to 0.2.2
@@ -9,2 +9,4 @@ /*! | ||
module.exports = require('./config'); | ||
const {Config} = require('./config'); | ||
module.exports = Config; |
@@ -124,3 +124,3 @@ /*! | ||
* Open a config file. | ||
* @param {String|String[]} file - e.g. `bcoin.conf`, or array of strings | ||
* @param {String|String[]} files - e.g. `bcoin.conf`, or array of strings | ||
* @throws on IO error | ||
@@ -130,2 +130,3 @@ */ | ||
open(files) { | ||
// @ts-ignore | ||
if (fs.unsupported) | ||
@@ -1042,5 +1043,7 @@ return; | ||
if (typeof query !== 'string') { | ||
// @ts-ignore | ||
if (!global.location) | ||
return {}; | ||
// @ts-ignore | ||
query = global.location.search; | ||
@@ -1063,5 +1066,7 @@ | ||
if (typeof hash !== 'string') { | ||
// @ts-ignore | ||
if (!global.location) | ||
return {}; | ||
// @ts-ignore | ||
hash = global.location.hash; | ||
@@ -1194,4 +1199,4 @@ | ||
let hi = str; | ||
let lo = '0'; | ||
let shi = str; | ||
let slo = '0'; | ||
@@ -1201,29 +1206,29 @@ const index = str.indexOf('.'); | ||
if (index !== -1) { | ||
hi = str.substring(0, index); | ||
lo = str.substring(index + 1); | ||
shi = str.substring(0, index); | ||
slo = str.substring(index + 1); | ||
} | ||
hi = hi.replace(/^0+/, ''); | ||
lo = lo.replace(/0+$/, ''); | ||
shi = shi.replace(/^0+/, ''); | ||
slo = slo.replace(/0+$/, ''); | ||
assert(hi.length <= 16 - exp, | ||
assert(shi.length <= 16 - exp, | ||
'Fixed number string exceeds 2^53-1.'); | ||
assert(lo.length <= exp, | ||
assert(slo.length <= exp, | ||
'Too many decimal places in fixed number string.'); | ||
if (hi.length === 0) | ||
hi = '0'; | ||
if (shi.length === 0) | ||
shi = '0'; | ||
while (lo.length < exp) | ||
lo += '0'; | ||
while (slo.length < exp) | ||
slo += '0'; | ||
if (lo.length === 0) | ||
lo = '0'; | ||
if (slo.length === 0) | ||
slo = '0'; | ||
assert(/^\d+$/.test(hi) && /^\d+$/.test(lo), | ||
assert(/^\d+$/.test(shi) && /^\d+$/.test(slo), | ||
'Non-numeric characters in fixed number string.'); | ||
hi = parseInt(hi, 10); | ||
lo = parseInt(lo, 10); | ||
const hi = parseInt(shi, 10); | ||
const lo = parseInt(slo, 10); | ||
@@ -1244,2 +1249,2 @@ const mult = Math.pow(10, exp); | ||
module.exports = Config; | ||
exports.Config = Config; |
'use strict'; | ||
module.exports = require('fs'); | ||
const fs = require('fs'); | ||
module.exports = fs; |
{ | ||
"name": "bcfg", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Config parser for bcoin", | ||
@@ -18,13 +18,15 @@ "keywords": [ | ||
"scripts": { | ||
"lint": "eslint lib/", | ||
"lint": "eslint lib/ test/", | ||
"lint-types": "tsc -p .", | ||
"test": "bmocha --reporter spec test/*-test.js" | ||
}, | ||
"dependencies": { | ||
"bsert": "~0.0.10" | ||
"bsert": "~0.0.12" | ||
}, | ||
"devDependencies": { | ||
"bmocha": "^2.1.0" | ||
"bmocha": "^2.1.0", | ||
"bts-type-deps": "^0.0.3" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=14.0.0" | ||
}, | ||
@@ -31,0 +33,0 @@ "browser": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28236
2
8
966
1
Updatedbsert@~0.0.12