-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
33 lines (33 loc) · 5.3 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
"name": "yamljs",
"version": "0.1.4",
"description": "Standalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.",
"keywords": [
"yaml",
"json",
"yaml2json",
"json2yaml"
],
"author": {
"name": "Jeremy Faivre",
"email": "contact@jeremyfa.com"
},
"main": "./bin/yaml.js",
"dependencies": {
"argparse": "~0.1.4",
"glob": "~3.1.11"
},
"bin": {
"yaml2json": "./bin/yaml2json",
"json2yaml": "./bin/json2yaml"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git://github.com/jeremyfa/yaml.js.git"
},
"readme": "yaml.js\n=======\n\nStandalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.\n\nMainly inspired from [Symfony Yaml Component](https://github.com/symfony/Yaml).\n\nHow to use\n----------\n\nImport yaml.js in your html page:\n\n``` html\n<script type=\"text/javascript\" src=\"yaml.js\"></script>\n```\n\nParse yaml string:\n\n``` js\nnativeObject = YAML.parse(yamlString);\n```\n\nDump native object into yaml string:\n\n``` js\nyamlString = YAML.stringify(nativeObject[, inline /* @integer depth to start using inline notation at */[, spaces /* @integer number of spaces to use for indentation */] ]);\n```\n\nLoad yaml file:\n\n``` js\nnativeObject = YAML.load('file.yml');\n```\n\nLoad yaml file:\n\n``` js\nYAML.load('file.yml', function(result)\n{\n nativeObject = result;\n});\n```\n\nUse with node.js\n----------------\n\nInstall module:\n\n``` bash\nnpm install yamljs\n```\n\nUse it:\n\n``` js\nYAML = require('yamljs');\n\n// parse YAML string\nnativeObject = YAML.parse(yamlString);\n\n// Generate YAML\nyamlString = YAML.stringify(nativeObject, 4);\n\n// Load yaml file using require\nnativeObject = require('./myfile.yml');\n\n// Load yaml file using YAML.load\nnativeObject = YAML.load('myfile.yml');\n```\n\nCommand line tools\n------------------\n\nYou can enable the command line tools by installing yamljs as a global module:\n\n``` bash\nnpm install -g yamljs\n```\n\nThen, two cli commands should become available: **yaml2json** and **json2yaml**. They let you convert YAML to JSON and JSON to YAML very easily.\n\n**yaml2json**\n\n```\nusage: yaml2json [-h] [-v] [-p] [-i INDENTATION] [-s] [-r] [-w] input\n\nPositional arguments:\n input YAML file or directory containing YAML files.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n -v, --version Show program's version number and exit.\n -p, --pretty Output pretty (indented) JSON.\n -i INDENTATION, --indentation INDENTATION\n Number of space characters used to indent code (use \n with --pretty, default: 2).\n -s, --save Save output inside JSON file(s) with the same name.\n -r, --recursive If the input is a directory, also find YAML files in \n sub-directories recursively.\n -w, --watch Watch for changes.\n```\n\n**json2yaml**\n\n```\nusage: json2yaml [-h] [-v] [-d DEPTH] [-i INDENTATION] [-s] [-r] [-w] input\n\nPositional arguments:\n input JSON file or directory containing JSON files.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n -v, --version Show program's version number and exit.\n -d DEPTH, --depth DEPTH\n Set minimum level of depth before generating inline \n YAML (default: 2).\n -i INDENTATION, --indentation INDENTATION\n Number of space characters used to indent code \n (default: 2).\n -s, --save Save output inside YML file(s) with the same name.\n -r, --recursive If the input is a directory, also find JSON files in \n sub-directories recursively.\n -w, --watch Watch for changes.\n```\n\n**examples**\n\n``` bash\n# Convert YAML to JSON and output resulting JSON on the console\nyaml2json myfile.yml\n\n# Store output inside a JSON file\nyaml2json myfile.yml > ouput.json\n\n# Output \"pretty\" (indented) JSON\nyaml2json myfile.yml --pretty\n\n# Save the output inside a file called myfile.json\nyaml2json myfile.yml --pretty --save\n\n# Watch a full directory and convert any YAML file into its JSON equivalent\nyaml2json mydirectory --pretty --save --recursive\n\n# Convert JSON to YAML and store output inside a JSON file\njson2yaml myfile.json > ouput.yml\n\n# Output YAML that will be inlined only after 8 levels of indentation\njson2yaml myfile.json --depth 8\n\n# Save the output inside a file called myfile.json with 4 spaces for each indentation\njson2yaml myfile.json --indentation 4\n\n# Watch a full directory and convert any JSON file into its YAML equivalent\njson2yaml mydirectory --pretty --save --recursive\n```\n\nImportant\n---------\n\nSymfony dropped support for YAML 1.1 spec. This means that `yes`, `no` and similar no longer convert to their *boolean* equivalents.\n\nThe internal `Yaml().load()` and `Yaml().loadFile()` methods renamed to `Yaml().parse()` and `Yaml().parseFile()` respectively. Exceptions replaced with `YamlParseException` object.\n\n",
"readmeFilename": "README.md",
"_id": "yamljs@0.1.4",
"_from": "yamljs@~0.1.4"
}