expand-object
Advanced tools
Comparing version 0.2.0 to 0.2.1
10
index.js
@@ -18,3 +18,3 @@ 'use strict'; | ||
if (!/[.|:]/.test(str) && /,/.test(str)) { | ||
return str.split(','); | ||
return toArray(str); | ||
} | ||
@@ -64,3 +64,3 @@ | ||
function expandArray(str) { | ||
return str.split(',').map(function (ele) { | ||
return toArray(str).map(function (ele) { | ||
return expandObject({}, ele); | ||
@@ -70,5 +70,9 @@ }); | ||
function toArray(str) { | ||
return (str || '').split(',').filter(Boolean); | ||
} | ||
function expandObject(res, str) { | ||
var segs = str.split(':'); | ||
var parts = (segs[1] || '').split(','); | ||
var parts = toArray(segs[1]); | ||
if (parts.length > 1) { | ||
@@ -75,0 +79,0 @@ setValue(res, segs[0], parts); |
{ | ||
"name": "expand-object", | ||
"description": "Expand a string into a JavaScript object using a simple notation. Use the CLI or as a node.js lib.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/jonschlinkert/expand-object", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
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
8812
115