@phc/format
Advanced tools
Comparing version 0.4.3 to 0.5.0
13
index.js
@@ -79,3 +79,3 @@ /* eslint-disable max-params,capitalized-comments,complexity,prefer-destructuring */ | ||
// Parameters Validation | ||
if (typeof opts.params !== 'undefined' && typeof opts.raw === 'undefined') { | ||
if (typeof opts.params !== 'undefined') { | ||
if (typeof opts.params !== 'object' || opts.params === null) { | ||
@@ -88,8 +88,9 @@ throw new TypeError('params must be an object'); | ||
} | ||
// Convert Numbers into Numeric Strings | ||
// Convert Numbers into Numeric Strings and Buffers into B64 encoded strings. | ||
pk.forEach(k => { | ||
opts.params[k] = | ||
typeof opts.params[k] === 'number' | ||
? opts.params[k].toString() | ||
: opts.params[k]; | ||
if (typeof opts.params[k] === 'number') { | ||
opts.params[k] = opts.params[k].toString(); | ||
} else if (Buffer.isBuffer(opts.params[k])) { | ||
opts.params[k] = opts.params[k].toString('base64').split('=')[0]; | ||
} | ||
}); | ||
@@ -96,0 +97,0 @@ const pv = objectValues(opts.params); |
{ | ||
"name": "@phc/format", | ||
"version": "0.4.3", | ||
"version": "0.5.0", | ||
"description": "PHC string format serializer/deserializer", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
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
15275
195