Socket
Socket
Sign inDemoInstall

parsec

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsec - npm Package Compare versions

Comparing version 1.5.3 to 2.0.0

39

package.json
{
"name": "parsec",
"version": "1.5.3",
"version": "2.0.0",
"description": "",
"main": "dist/index.js",
"main": "index.js",
"scripts": {
"setup": "npm i && npm run test",
"build": "babel --optional runtime src -d dist",
"test": "npm run build && npm run tape | tspec",
"deploy": "npm run test && git push origin master && npm publish",
"tape": "node --harmony --harmony_arrow_functions ./node_modules/tape/bin/tape test/*.js"
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bucaran/parsec.git"
"url": "git+https://github.com/npm/deprecate-holder.git"
},
"keywords": [
"options",
"argv",
"arguments",
"parser",
"cli",
"es6"
],
"author": "Jorge Bucaran",
"license": "MIT",
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/bucaran/parsec/issues"
"url": "https://github.com/npm/deprecate-holder/issues"
},
"homepage": "https://github.com/bucaran/parsec#readme",
"devDependencies": {
"babel": "^5.3.3",
"babel-eslint": "^3.1.1",
"eslint": "^0.21.0",
"tap-spec": "^3.0.0",
"tape": "^4.0.0"
},
"dependencies": {
"babel-runtime": "^5.8.3"
}
"homepage": "https://github.com/npm/deprecate-holder#readme",
"dependencies": {}
}

@@ -1,225 +0,5 @@

<a name="parsec"></a>
# Deprecated Package
<p align="center">
<a href="https://github.com/bucaran/parsec/blob/master/README.md">
<img width="400px" src="https://cloud.githubusercontent.com/assets/8317250/11606196/b85167b0-9b5b-11e5-81a6-c66e2fc694e2.png">
</a>
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
</p>
<p align="center">
<a href="https://www.npmjs.org/package/parsec">
<img src="https://img.shields.io/npm/v/parsec.svg?style=flat-square"
alt="NPM Version">
</a>
<a href="https://travis-ci.org/bucaran/parsec">
<img src="http://img.shields.io/travis/bucaran/parsec.svg?style=flat-square"
alt="Downloads">
</a>
<a href="https://www.npmjs.org/package/parsec">
<img src="http://img.shields.io/npm/dm/parsec.svg?style=flat-square"
alt="Build Status">
</a>
</p>
<p align="center">
<b><a href="#features">Features</a></b>
|
<b><a href="#install">Install</a></b>
|
<b><a href="#usage">Usage</a></b>
|
<b><a href="#examples">Examples</a></b>
</p>
## About
_Parsec_ is a tiny [CLI parser](https://en.wikipedia.org/wiki/Command-line_interface#Arguments).
## Features
+ Based in the [UNIX Utility Conventions](http://pubs.opengroup.org/onlinepubs/7908799/xbd/utilconv.html)
+ Custom aliases
* Default shorthands
+ Default values / types
+ Handle `--no-*` options
+ Handle unknown options
## Install
```sh
npm install parsec
```
## Usage
```js
// ./index.js -par5ec
parse()
```
```json
{
"p": true,
"a": true,
"r": "5ec"
}
```
Customize:
```js
// ./index.js -s42
parse("secret", ["verbose", "V", { default: true }])
```
```json
{
"s": 42,
"secret": 42,
"V": true,
"verbose": true
}
```
## Usage
> Parse [`process.argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) by default.
```js
import parse from "parsec"
parse(alias1, alias2, ...)
```
+ Custom aliases
```js
// ./index.js --bar
parse(["foo", "bar", "baz"])
```
```json
{
"foo": true,
"bar": true,
"baz": true
}
```
+ Example aliases
```js
"foo" // → ["f", "foo"]
["F", "f", "foo"]
["foo", { default: "./" }]
["baz", { default: true }]
```
+ Default shorthands
```js
// ./index.js -fb
parse("foo", "bar")
```
```json
{
"f": true,
"foo": true,
"b": true,
"bar": true,
}
```
+ Default values and types
```js
// ./index.js --file
parse(["f", "file", { default: "." }])
```
```json
{
"f": ".",
"file": "."
}
```
+ Handle `--no-flags`
```js
// ./index.js --no-foo --no-bar=baz
parse()
```
```json
{
"foo": false,
"no-bar": "baz"
}
```
+ Handle unknown options
```js
// ./index.js --bar
parse("foo", (option) => {
throw new RangeError(`unknown option ${option}`) // bar
})
```
+ Bare operands and arguments after `--` are added to `._`. To override:
```js
parse(["_", "alias"])
```
+ Bind `parse` to a different source of arguments:
```js
parse.call(["--foo", "--bar"], [alias1, alias2, ...])
```
## Examples
```js
// ./node index.js -f bar -bp
parse()
```
```json
{
"f": "bar",
"b": true,
"p": "./"
}
```
with custom aliases:
```js
parse("foo", "bar", ["path", { default: "./" }])
```
```json
{
"f": "bar",
"foo": "bar",
"b": true,
"bar": true,
"p": "./",
"path": "./"
}
```
[license]: http://opensource.org/licenses/MIT
[author]: http://about.bucaran.me
[parsec]: https://www.github.com/bucaran/parsec
[npm-pkg-link]: https://www.npmjs.org/package/parsec
[npm-ver-link]: https://img.shields.io/npm/v/parsec.svg?style=flat-square
[dl-badge]: http://img.shields.io/npm/dm/parsec.svg?style=flat-square
[travis-logo]: http://img.shields.io/travis/bucaran/parsec.svg?style=flat-square
[travis]: https://travis-ci.org/bucaran/parsec
[contributors]: https://github.com/bucaran/parsec/graphs/contributors
Please contact support@npmjs.com if you have questions about this package.
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