@phc/format
Advanced tools
Comparing version 0.3.2 to 0.3.3
17
index.js
@@ -28,6 +28,9 @@ /* eslint-disable max-params,capitalized-comments,complexity */ | ||
function objectKeys(object) { | ||
/* istanbul ignore next */ | ||
return Object.keys(object); | ||
} | ||
function objectValues(object) { | ||
/* istanbul ignore next */ | ||
if (typeof Object.values === 'function') return Object.values(object); | ||
/* istanbul ignore next */ | ||
return objectKeys(object).map(k => object[k]); | ||
@@ -134,13 +137,13 @@ } | ||
if (typeof phcstr !== 'string') { | ||
throw new TypeError('pchstr must be a string'); | ||
if (typeof phcstr !== 'string' || phcstr === '') { | ||
throw new TypeError('pchstr must be a non-empty string'); | ||
} | ||
if (phcstr[0] !== '$') { | ||
throw new TypeError('pchstr must contain a $ as first char'); | ||
} | ||
const fields = phcstr.split('$'); | ||
// Remove first empty $ | ||
fields.shift(); | ||
// Parse Fields | ||
if (fields.length === 1) { | ||
throw new TypeError('pchstr must contain at least one $ char'); | ||
} | ||
// Remove first empty $ | ||
fields.shift(); | ||
let maxf = 5; | ||
@@ -147,0 +150,0 @@ if (strict) maxf--; |
{ | ||
"name": "@phc/format", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "PHC string format serializer/deserializer", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"keywords": [ | ||
"mfc", | ||
"mcf", | ||
"phc", | ||
@@ -20,0 +20,0 @@ "modular", |
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
17333
212