New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

optimal

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optimal - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

lib/BoolBuilder.js

60

package.json
{
"name": "optimal",
"version": "0.1.0",
"description": "Kickass JS arguments parser",
"directories": {
"test": "test"
},
"devDependencies": {
"mocha": ">= 0.0.0",
"should": ">= 0.0.0"
},
"version": "0.2.0",
"description": "Options object builder and validator.",
"main": "./lib/index.js",
"scripts": {
"test": "mocha -R spec -r should test/optimal.js"
"babel": "build-lib ./src -d ./lib",
"coverage": "run-coverage",
"eslint": "run-linter ./bin ./src ./tests",
"flow": "type-check",
"jest": "run-tests",
"posttest": "yarn run flow",
"pretest": "yarn run eslint",
"preversion": "yarn test && yarn run babel",
"test": "yarn run jest"
},
"repository": {
"type": "git",
"url": "git://github.com/Numbee/Optimal.git"
"url": "git+https://github.com/milesj/optimal.git"
},
"author": "stoke <stoke@autistici.org>",
"license": "MIT"
"keywords": [
"opts",
"options",
"builder",
"validator",
"config",
"defaults",
"object",
"params"
],
"author": {
"name": "Miles Johnson",
"url": "http://milesj.me"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/milesj/optimal/issues"
},
"homepage": "https://github.com/milesj/optimal#readme",
"dependencies": {
"babel-runtime": "^6.23.0"
},
"devDependencies": {
"@milesj/build-tool-config": "^0.11.1"
},
"babel": {
"extends": "./node_modules/@milesj/build-tool-config/babel.json5"
},
"eslintConfig": {
"extends": "./node_modules/@milesj/build-tool-config/eslint.json5"
},
"jest": {
"preset": "@milesj/build-tool-config"
}
}

@@ -1,12 +0,38 @@

Optimal
=======
# Optimal [DEV]
![travis](https://secure.travis-ci.org/Numbee/Optimal.png?branch=master)
Options object builder and validator.
### Documentation
## Usage
Check ```example/```
Pass a plain object and a factory function to `Options`. The factory defines a
blueprint for every property, and its value, within the options object.
### Install
The plain object is then validated, built, and returned.
`npm install optimal`
```js
const baseOptions = {
bool: false,
number: 10,
};
const options = new Options(baseOptions, ({ bool, string, number, func }) => ({
bool: bool(true),
string: string('foo').notEmpty(),
number: number(5).between(0, 10),
func: func(),
}));
/*
{
bool: true,
string: 'foo',
number: 10,
func: null,
}
*/
const {
string, // foo
number, // 10
} = options;
```
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