
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
inquirer-parse-json-file
Advanced tools
A selector for Inquirer.js to pick a JSON file and return the Javascript object
Json File prompt for inquirer
Parses the JSON file and returns the object as it's answer.
npm install --save inquirer-parse-json-file
up
/down
arrow keys or k
/j
to navigateenter
to select optionThis prompt is anonymous, meaning you can register this prompt with the type name you please:
inquirer.registerPrompt('jsonFile', require('inquirer-parse-json-file'));
inquirer.prompt({
type: 'jsonFile',
...
})
Change jsonFile
to whatever you might prefer.
Takes type
, name
, message
, filter
, basePath
properties.
See inquirer readme for meaning of all except basePath.
basePath is the relative path from your current working directory
inquirer.registerPrompt("jsonFile", require("inquirer-parse-json-file"));
inquirer
.prompt([
{
type: "jsonFile",
name: "json",
message: "Select a json file?",
basePath: "./src",
},
])
.then(function (answers) {
// (answers.from is the path chosen)
});
See also example.js for a working example
Unit test
Unit test are written in Mocha. Please add a unit test for every new feature or bug fix. npm test
to run the test suite.
Documentation Add documentation for every API change. Feel free to send typo fixes and better docs!
MIT
Thanks to bmbarker90 and their inquirer-file-path repo that this is adapted from.
FAQs
A selector for Inquirer.js to pick a JSON file and return the Javascript object
We found that inquirer-parse-json-file 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.