Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
npm -g install jiq
or
yarn global add jiq
Concept: use existing javascript knowledge to query or mutate data
jiq '.dependencies' package.json
jiq '.scripts|keys|.filter(v => /^test/.test(v))' package.json
ls | jiq '.map(v => v.uppercase)' --save list.txt
curl https://api.github.com/users | jiq --json '.map(x => x.login)'
We have a file
package.json
{
"name": "jiq",
"version": "0.0.2",
"description": "Use existing javascript knowledge to query or mutate data",
"keywords": ["javascript inline query", "json query", "json inline query", "json", "yaml", "query"],
"main": "build/index.js",
"author": {
"name": "Adil",
"email": "adil.sudo@gmail.com",
"url": "https://md-adil.github.io"
},
"homepage": "https://md-adil.github.io/jiq/",
"repository": {
"url": "https://md-adil.github.io/jiq/",
"type": "git"
},
"license": "MIT",
"scripts": {
"watch": "tsc -w",
"build": "tsc",
"start": "node ./build"
},
"devDependencies": {
"@types/lodash": "^4.14.165",
"@types/node": "^14.14.6"
},
"dependencies": {
"commander": "^6.2.0",
"lodash": "^4.17.20",
"yaml": "^1.10.0"
},
"bin": "./build/index.js"
}
Getting name property
jiq '.name' package.json
output
jiq
Getting all dependencies
jiq '.dependencies' package.json
output
{
"commander": "^6.2.0",
"lodash": "^4.17.20",
"yaml": "^1.10.0"
}
Getting keys of dependencies object as an array with the help of pipes
jiq '.dependencies|keys' package.json
output
commander
lodash
yaml
Chain with native javascript array functions on output array
jiq '.dependencies|keys|.map(v => v.uppercase)' package.json
output
COMMANDER
LODASH
YAML
Save output to a file
jiq '.dependencies|keys|.map(v => v.uppercase)' package.json --save deps.json
or
jiq '.dependencies|keys|.map(v => v.uppercase)' package.json --save deps.yaml
data will be converted according to file extension
Some built in helper function for array and string
Getting 2 items from top
jiq '.keywords.head(2)' package.json
output
javascript inline query
json query
$
$
hold current parsed value object
jiq '$' package.json --save package.yaml
Successfully converted json to yaml
curl https://api.github.com/users | jiq --json '.map(x => x.login)'
curl <url>
to get data from remotejiq --json
to tell jiq the file content is json'.map(x => x.login)'
iterate over array, get the login key and build a new array on top of that.Use _
as global variable
curl https://api.github.com/users | jiq --json '.map(x => x.login).map(_.upperFirst)'
'.map(v => v.uppercase)'
.map(v => v.lowercase)
.map(v => v.camelcase)
.map(v => v.upperfirst)
.map(v => v.capitalize)
.map(v => v.kebabcase)
.map(v => v.limit(10))
return max 10 charsRead full documentation here.
FAQs
Use existing javascript knowledge to query or modify data
The npm package jiq receives a total of 2 weekly downloads. As such, jiq popularity was classified as not popular.
We found that jiq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.