Comparing version 1.0.0 to 1.1.0
11
index.js
@@ -83,3 +83,4 @@ #!/usr/bin/env node | ||
.option('-e --extract [property]', 'extract a property from the response using a property chain e.g. \'supplier.primaryContact.tel\' ') | ||
.option('-m --map [func]', 'map over an array, extracting property using a property chain e.g. \'name.email\'') | ||
.option('-m --map [func]', `map over an array, extracting property using a property chain e.g. \'name.email\' | ||
Will output multiple values if -m is specified multiple times`, collect, []) | ||
// .option('-u [user]', 'authenticate with basic auth') | ||
@@ -110,3 +111,9 @@ .action(function (url, options) { | ||
if (options.map) { | ||
json = json.map(item => extractProperty(item, options.map)) | ||
if (options.map.length === 1) { | ||
json = json.map(item => extractProperty(item, options.map[0])) | ||
} else { | ||
json = json.map(item => | ||
options.map.map(propChain => extractProperty(item, propChain)) | ||
) | ||
} | ||
} | ||
@@ -113,0 +120,0 @@ console.log(JSON.stringify(json, null, 2)) |
{ | ||
"name": "ferl", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "The unholy union of fetch and curl", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
4732
108