110 lines
13 KiB
JSON
110 lines
13 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "levn@~0.3.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "levn",
|
||
|
"name": "levn",
|
||
|
"rawSpec": "~0.3.0",
|
||
|
"spec": ">=0.3.0 <0.4.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/optionator"
|
||
|
]
|
||
|
],
|
||
|
"_from": "levn@>=0.3.0 <0.4.0",
|
||
|
"_id": "levn@0.3.0",
|
||
|
"_inCache": true,
|
||
|
"_location": "/levn",
|
||
|
"_nodeVersion": "4.2.4",
|
||
|
"_npmUser": {
|
||
|
"name": "gkz",
|
||
|
"email": "z@georgezahariev.com"
|
||
|
},
|
||
|
"_npmVersion": "2.14.12",
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "levn@~0.3.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "levn",
|
||
|
"name": "levn",
|
||
|
"rawSpec": "~0.3.0",
|
||
|
"spec": ">=0.3.0 <0.4.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/optionator"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
|
||
|
"_shasum": "3b09924edf9f083c0490fdd4c0bc4421e04764ee",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "levn@~0.3.0",
|
||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/optionator",
|
||
|
"author": {
|
||
|
"name": "George Zahariev",
|
||
|
"email": "z@georgezahariev.com"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/gkz/levn/issues"
|
||
|
},
|
||
|
"dependencies": {
|
||
|
"prelude-ls": "~1.1.2",
|
||
|
"type-check": "~0.3.2"
|
||
|
},
|
||
|
"description": "Light ECMAScript (JavaScript) Value Notation - human written, concise, typed, flexible",
|
||
|
"devDependencies": {
|
||
|
"istanbul": "~0.4.1",
|
||
|
"livescript": "~1.4.0",
|
||
|
"mocha": "~2.3.4"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"shasum": "3b09924edf9f083c0490fdd4c0bc4421e04764ee",
|
||
|
"tarball": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz"
|
||
|
},
|
||
|
"engines": {
|
||
|
"node": ">= 0.8.0"
|
||
|
},
|
||
|
"files": [
|
||
|
"lib",
|
||
|
"README.md",
|
||
|
"LICENSE"
|
||
|
],
|
||
|
"gitHead": "a92b9acf928282ba81134b4ae8e6a5f29e1f5e1e",
|
||
|
"homepage": "https://github.com/gkz/levn",
|
||
|
"keywords": [
|
||
|
"levn",
|
||
|
"light",
|
||
|
"ecmascript",
|
||
|
"value",
|
||
|
"notation",
|
||
|
"json",
|
||
|
"typed",
|
||
|
"human",
|
||
|
"concise",
|
||
|
"typed",
|
||
|
"flexible"
|
||
|
],
|
||
|
"license": "MIT",
|
||
|
"main": "./lib/",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "gkz",
|
||
|
"email": "z@georgezahariev.com"
|
||
|
}
|
||
|
],
|
||
|
"name": "levn",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "# levn [![Build Status](https://travis-ci.org/gkz/levn.png)](https://travis-ci.org/gkz/levn) <a name=\"levn\" />\n__Light ECMAScript (JavaScript) Value Notation__\nLevn is a library which allows you to parse a string into a JavaScript value based on an expected type. It is meant for short amounts of human entered data (eg. config files, command line arguments).\n\nLevn aims to concisely describe JavaScript values in text, and allow for the extraction and validation of those values. Levn uses [type-check](https://github.com/gkz/type-check) for its type format, and to validate the results. MIT license. Version 0.3.0.\n\n__How is this different than JSON?__ levn is meant to be written by humans only, is (due to the previous point) much more concise, can be validated against supplied types, has regex and date literals, and can easily be extended with custom types. On the other hand, it is probably slower and thus less efficient at transporting large amounts of data, which is fine since this is not its purpose.\n\n npm install levn\n\nFor updates on levn, [follow me on twitter](https://twitter.com/gkzahariev).\n\n\n## Quick Examples\n\n```js\nvar parse = require('levn').parse;\nparse('Number', '2'); // 2\nparse('String', '2'); // '2'\nparse('String', 'levn'); // 'levn'\nparse('String', 'a b'); // 'a b'\nparse('Boolean', 'true'); // true\n\nparse('Date', '#2011-11-11#'); // (Date object)\nparse('Date', '2011-11-11'); // (Date object)\nparse('RegExp', '/[a-z]/gi'); // /[a-z]/gi\nparse('RegExp', 're'); // /re/\nparse('Int', '2'); // 2\n\nparse('Number | String', 'str'); // 'str'\nparse('Number | String', '2'); // 2\n\nparse('[Number]', '[1,2,3]'); // [1,2,3]\nparse('(String, Boolean)', '(hi, false)'); // ['hi', false]\nparse('{a: String, b: Number}', '{a: str, b: 2}'); // {a: 'str', b: 2}\n\n// at the top level, you can ommit surrounding delimiters\nparse('[Number]', '1,2,3'); // [1,2,3]\nparse('(String, Boolean)', 'hi, false'); // ['hi', false]\nparse('{a: String, b: Number}', 'a: str, b: 2'); // {a: 'str', b: 2}\n\n// wildcard - auto choose type\nparse('*', '[hi,(null,[42]),{k: true}]'); // ['hi', [null, [42]], {k: true}]\n```\n## Usage\n\n`require('levn');` returns an object that exposes three properties. `VERSION` is the current version of the library as a string. `parse` and `parsedTypeParse` are functions.\n\n```js\n// parse(type, input, options);\nparse('[Number]', '1,2,3'); // [1, 2, 3]\n\n// parsedTypeParse(parsedType, input, options);\nvar parsedType = require('type-check').parseType('[Number]');\nparsedTypeParse(parsedType, '1,2,3'); // [1, 2, 3]\n```\n\n### parse(type, input, options)\n\n`parse` casts the string `input` into a JavaScript value according to the specified `type` in the [type format](https://github.com/gkz/type-check#type-format) (and taking account the optional `options`) and returns the resulting JavaScript value.\n\n##### arguments\n* type - `String` - the type written in the [type format](https://github.com/gkz/type-check#type-format) which to check against\n* input - `String` - the value written in the [levn format](#levn-format)\n* options - `Maybe Object` - an optional parameter specifying additional [options](#options)\n\n##### returns\n`*` - the resulting JavaScript value\n\n##### example\n```js\nparse('[Number]', '1,2,3'); // [1, 2, 3]\n```\n\n### parsedTypeParse(parsedType, input, options)\n\n`parsedTypeParse` casts the string `input` into a JavaScript value according to the specified `type` which has already been parsed (and taking account the optional `options`) and returns the resulting JavaScript value. You can parse a type using the [type-check](https://github.com/gkz/type-check) library's `parseType` function.\n\n##### arguments\n* type - `Object` - the type in the parsed type format which to check against\n* input - `String` - the value written in the [levn format](#levn-format)\n* options - `Maybe Object` - an optional parameter specifying additional [options](#options)\
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git://github.com/gkz/levn.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"test": "make test"
|
||
|
},
|
||
|
"version": "0.3.0"
|
||
|
}
|