Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ferl

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ferl - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

23

index.js

@@ -73,2 +73,12 @@ #!/usr/bin/env node

function filterProperty (json, query) {
let [all, props, val] = /([\w-\.]+)(?:\=(.*))/.exec(query)
const prop = extractProperty(json, props);
if (typeof val === 'undefined') {
return !!prop;
}
return prop == val;
}
program

@@ -78,3 +88,3 @@ .version('0.2.1')

.arguments('<URL>')
.description('subset of curl with added json parsing')
.description('subset of curl with added json traversal')
.option('-X --method [method]', 'http method to use')

@@ -85,4 +95,6 @@ .option('-L --redirect', 'follow redirects')

.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 [property]', `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('-f --filter [property=value]', `filter an array, checking property using a property chain e.g. \'name.email\'
Will filter on multiple values if -f is specified multiple times`, collect, [])
// .option('-u [user]', 'authenticate with basic auth')

@@ -112,3 +124,8 @@ .action(function (url, options) {

}
if (options.map) {
if (options.filter.length) {
options.filter.forEach(filter => {
json = json.filter(item => filterProperty(item, filter))
})
}
if (options.map.length) {
if (options.map.length === 1) {

@@ -115,0 +132,0 @@ json = json.map(item => extractProperty(item, options.map[0]))

2

package.json
{
"name": "ferl",
"version": "1.1.1",
"version": "1.2.0",
"description": "The unholy union of fetch and curl",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,15 +7,17 @@ # ferl

subset of curl with added json parsing
subset of curl with added json traversal
Options:
-h, --help output usage information
-V, --version output the version number
-X --method [method] http method to use
-L --redirect follow redirects
-H --headers [header] set a header
-d --data [data] send form data (of type application/x-www-form-urlencoded if it doesn't look like json)
-e --extract [property] extract a property from the response using a property chain e.g. 'supplier.primaryContact.tel'
-m --map [func] map over an array, extracting property using a property chain e.g. 'name.email'
-h, --help output usage information
-V, --version output the version number
-X --method [method] http method to use
-L --redirect follow redirects
-H --headers [header] set a header
-d --data [data] send form data (of type application/x-www-form-urlencoded if it doesn't look like json)
-e --extract [property] extract a property from the response using a property chain e.g. 'supplier.primaryContact.tel'
-m --map [property] map over an array, extracting property using a property chain e.g. 'name.email'
Will output multiple values if -m is specified multiple times
-f --filter [property=value] filter an array, checking property using a property chain e.g. 'name.email'
Will filter on multiple values if -f is specified multiple times
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc