$
This commit is contained in:
501
node_modules/js-yaml/CHANGELOG.md
generated
vendored
Normal file
501
node_modules/js-yaml/CHANGELOG.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
node_modules/js-yaml/LICENSE
generated
vendored
Normal file
21
node_modules/js-yaml/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (C) 2011-2015 by Vitaly Puzrin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
314
node_modules/js-yaml/README.md
generated
vendored
Normal file
314
node_modules/js-yaml/README.md
generated
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
JS-YAML - YAML 1.2 parser / writer for JavaScript
|
||||
=================================================
|
||||
|
||||
[](https://travis-ci.org/nodeca/js-yaml)
|
||||
[](https://www.npmjs.org/package/js-yaml)
|
||||
|
||||
__[Online Demo](http://nodeca.github.com/js-yaml/)__
|
||||
|
||||
|
||||
This is an implementation of [YAML](http://yaml.org/), a human-friendly data
|
||||
serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was
|
||||
completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
### YAML module for node.js
|
||||
|
||||
```
|
||||
npm install js-yaml
|
||||
```
|
||||
|
||||
|
||||
### CLI executable
|
||||
|
||||
If you want to inspect your YAML files from CLI, install js-yaml globally:
|
||||
|
||||
```
|
||||
npm install -g js-yaml
|
||||
```
|
||||
|
||||
#### Usage
|
||||
|
||||
```
|
||||
usage: js-yaml [-h] [-v] [-c] [-t] file
|
||||
|
||||
Positional arguments:
|
||||
file File with YAML document(s)
|
||||
|
||||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-v, --version Show program's version number and exit.
|
||||
-c, --compact Display errors in compact mode
|
||||
-t, --trace Show stack trace on error
|
||||
```
|
||||
|
||||
|
||||
### Bundled YAML library for browsers
|
||||
|
||||
``` html
|
||||
<!-- esprima required only for !!js/function -->
|
||||
<script src="esprima.js"></script>
|
||||
<script src="js-yaml.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var doc = jsyaml.load('greeting: hello\nname: world');
|
||||
</script>
|
||||
```
|
||||
|
||||
Browser support was done mostly for the online demo. If you find any errors - feel
|
||||
free to send pull requests with fixes. Also note, that IE and other old browsers
|
||||
needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate.
|
||||
|
||||
Notes:
|
||||
|
||||
1. We have no resources to support browserified version. Don't expect it to be
|
||||
well tested. Don't expect fast fixes if something goes wrong there.
|
||||
2. `!!js/function` in browser bundle will not work by default. If you really need
|
||||
it - load `esprima` parser first (via amd or directly).
|
||||
3. `!!bin` in browser will return `Array`, because browsers do not support
|
||||
node.js `Buffer` and adding Buffer shims is completely useless on practice.
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
Here we cover the most 'useful' methods. If you need advanced details (creating
|
||||
your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and
|
||||
[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more
|
||||
info.
|
||||
|
||||
``` javascript
|
||||
yaml = require('js-yaml');
|
||||
fs = require('fs');
|
||||
|
||||
// Get document, or throw exception on error
|
||||
try {
|
||||
var doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
|
||||
console.log(doc);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### safeLoad (string [ , options ])
|
||||
|
||||
**Recommended loading way.** Parses `string` as single YAML document. Returns a JavaScript
|
||||
object or throws `YAMLException` on error. By default, does not support regexps,
|
||||
functions and undefined. This method is safe for untrusted data.
|
||||
|
||||
options:
|
||||
|
||||
- `filename` _(default: null)_ - string to be used as a file path in
|
||||
error/warning messages.
|
||||
- `onWarning` _(default: null)_ - function to call on warning messages.
|
||||
Loader will call this function with an instance of `YAMLException` for each warning.
|
||||
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use.
|
||||
- `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
|
||||
http://www.yaml.org/spec/1.2/spec.html#id2802346
|
||||
- `JSON_SCHEMA` - all JSON-supported types:
|
||||
http://www.yaml.org/spec/1.2/spec.html#id2803231
|
||||
- `CORE_SCHEMA` - same as `JSON_SCHEMA`:
|
||||
http://www.yaml.org/spec/1.2/spec.html#id2804923
|
||||
- `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones
|
||||
(`!!js/undefined`, `!!js/regexp` and `!!js/function`):
|
||||
http://yaml.org/type/
|
||||
- `DEFAULT_FULL_SCHEMA` - all supported YAML types.
|
||||
- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
|
||||
|
||||
NOTE: This function **does not** understand multi-document sources, it throws
|
||||
exception on those.
|
||||
|
||||
NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
|
||||
So, the JSON schema is not as strictly defined in the YAML specification.
|
||||
It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
|
||||
The core schema also has no such restrictions. It allows binary notation for integers.
|
||||
|
||||
|
||||
### load (string [ , options ])
|
||||
|
||||
**Use with care with untrusted sources**. The same as `safeLoad()` but uses
|
||||
`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types:
|
||||
`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources, you
|
||||
must additionally validate object structure to avoid injections:
|
||||
|
||||
``` javascript
|
||||
var untrusted_code = '"toString": !<tag:yaml.org,2002:js/function> "function (){very_evil_thing();}"';
|
||||
|
||||
// I'm just converting that string, what could possibly go wrong?
|
||||
require('js-yaml').load(untrusted_code) + ''
|
||||
```
|
||||
|
||||
|
||||
### safeLoadAll (string [, iterator] [, options ])
|
||||
|
||||
Same as `safeLoad()`, but understands multi-document sources. Applies
|
||||
`iterator` to each document if specified, or returns array of documents.
|
||||
|
||||
``` javascript
|
||||
var yaml = require('js-yaml');
|
||||
|
||||
yaml.safeLoadAll(data, function (doc) {
|
||||
console.log(doc);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### loadAll (string [, iterator] [ , options ])
|
||||
|
||||
Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default.
|
||||
|
||||
|
||||
### safeDump (object [ , options ])
|
||||
|
||||
Serializes `object` as a YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will
|
||||
throw an exception if you try to dump regexps or functions. However, you can
|
||||
disable exceptions by setting the `skipInvalid` option to `true`.
|
||||
|
||||
options:
|
||||
|
||||
- `indent` _(default: 2)_ - indentation width to use (in spaces).
|
||||
- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements
|
||||
- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
|
||||
in the safe schema) and skip pairs and single values with such types.
|
||||
- `flowLevel` (default: -1) - specifies level of nesting, when to switch from
|
||||
block to flow style for collections. -1 means block style everwhere
|
||||
- `styles` - "tag" => "style" map. Each tag may have own set of styles.
|
||||
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use.
|
||||
- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
|
||||
function, use the function to sort the keys.
|
||||
- `lineWidth` _(default: `80`)_ - set max line width.
|
||||
- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
|
||||
- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
|
||||
yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
|
||||
- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
|
||||
|
||||
The following table show availlable styles (e.g. "canonical",
|
||||
"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
|
||||
output is shown on the right side after `=>` (default setting) or `->`:
|
||||
|
||||
``` none
|
||||
!!null
|
||||
"canonical" -> "~"
|
||||
"lowercase" => "null"
|
||||
"uppercase" -> "NULL"
|
||||
"camelcase" -> "Null"
|
||||
|
||||
!!int
|
||||
"binary" -> "0b1", "0b101010", "0b1110001111010"
|
||||
"octal" -> "01", "052", "016172"
|
||||
"decimal" => "1", "42", "7290"
|
||||
"hexadecimal" -> "0x1", "0x2A", "0x1C7A"
|
||||
|
||||
!!bool
|
||||
"lowercase" => "true", "false"
|
||||
"uppercase" -> "TRUE", "FALSE"
|
||||
"camelcase" -> "True", "False"
|
||||
|
||||
!!float
|
||||
"lowercase" => ".nan", '.inf'
|
||||
"uppercase" -> ".NAN", '.INF'
|
||||
"camelcase" -> ".NaN", '.Inf'
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
``` javascript
|
||||
safeDump (object, {
|
||||
'styles': {
|
||||
'!!null': 'canonical' // dump null as ~
|
||||
},
|
||||
'sortKeys': true // sort object keys
|
||||
});
|
||||
```
|
||||
|
||||
### dump (object [ , options ])
|
||||
|
||||
Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default).
|
||||
|
||||
|
||||
Supported YAML types
|
||||
--------------------
|
||||
|
||||
The list of standard YAML tags and corresponding JavaScipt types. See also
|
||||
[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and
|
||||
[YAML types repository](http://yaml.org/type/).
|
||||
|
||||
```
|
||||
!!null '' # null
|
||||
!!bool 'yes' # bool
|
||||
!!int '3...' # number
|
||||
!!float '3.14...' # number
|
||||
!!binary '...base64...' # buffer
|
||||
!!timestamp 'YYYY-...' # date
|
||||
!!omap [ ... ] # array of key-value pairs
|
||||
!!pairs [ ... ] # array or array pairs
|
||||
!!set { ... } # array of objects with given keys and null values
|
||||
!!str '...' # string
|
||||
!!seq [ ... ] # array
|
||||
!!map { ... } # object
|
||||
```
|
||||
|
||||
**JavaScript-specific tags**
|
||||
|
||||
```
|
||||
!!js/regexp /pattern/gim # RegExp
|
||||
!!js/undefined '' # Undefined
|
||||
!!js/function 'function () {...}' # Function
|
||||
```
|
||||
|
||||
Caveats
|
||||
-------
|
||||
|
||||
Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
|
||||
or arrays as keys, and stringifies (by calling `toString()` method) them at the
|
||||
moment of adding them.
|
||||
|
||||
``` yaml
|
||||
---
|
||||
? [ foo, bar ]
|
||||
: - baz
|
||||
? { foo: bar }
|
||||
: - baz
|
||||
- baz
|
||||
```
|
||||
|
||||
``` javascript
|
||||
{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
|
||||
```
|
||||
|
||||
Also, reading of properties on implicit block mapping keys is not supported yet.
|
||||
So, the following YAML document cannot be loaded.
|
||||
|
||||
``` yaml
|
||||
&anchor foo:
|
||||
foo: bar
|
||||
*anchor: duplicate key
|
||||
baz: bat
|
||||
*anchor: duplicate key
|
||||
```
|
||||
|
||||
|
||||
Breaking changes in 2.x.x -> 3.x.x
|
||||
----------------------------------
|
||||
|
||||
If you have not used __custom__ tags or loader classes and not loaded yaml
|
||||
files via `require()`, no changes are needed. Just upgrade the library.
|
||||
|
||||
Otherwise, you should:
|
||||
|
||||
1. Replace all occurrences of `require('xxxx.yml')` by `fs.readFileSync()` +
|
||||
`yaml.safeLoad()`.
|
||||
2. rewrite your custom tags constructors and custom loader
|
||||
classes, to conform the new API. See
|
||||
[examples](https://github.com/nodeca/js-yaml/tree/master/examples) and
|
||||
[wiki](https://github.com/nodeca/js-yaml/wiki) for details.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
View the [LICENSE](https://github.com/nodeca/js-yaml/blob/master/LICENSE) file
|
||||
(MIT).
|
132
node_modules/js-yaml/bin/js-yaml.js
generated
vendored
Normal file
132
node_modules/js-yaml/bin/js-yaml.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
/*eslint-disable no-console*/
|
||||
|
||||
|
||||
// stdlib
|
||||
var fs = require('fs');
|
||||
|
||||
|
||||
// 3rd-party
|
||||
var argparse = require('argparse');
|
||||
|
||||
|
||||
// internal
|
||||
var yaml = require('..');
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var cli = new argparse.ArgumentParser({
|
||||
prog: 'js-yaml',
|
||||
version: require('../package.json').version,
|
||||
addHelp: true
|
||||
});
|
||||
|
||||
|
||||
cli.addArgument([ '-c', '--compact' ], {
|
||||
help: 'Display errors in compact mode',
|
||||
action: 'storeTrue'
|
||||
});
|
||||
|
||||
|
||||
// deprecated (not needed after we removed output colors)
|
||||
// option suppressed, but not completely removed for compatibility
|
||||
cli.addArgument([ '-j', '--to-json' ], {
|
||||
help: argparse.Const.SUPPRESS,
|
||||
dest: 'json',
|
||||
action: 'storeTrue'
|
||||
});
|
||||
|
||||
|
||||
cli.addArgument([ '-t', '--trace' ], {
|
||||
help: 'Show stack trace on error',
|
||||
action: 'storeTrue'
|
||||
});
|
||||
|
||||
cli.addArgument([ 'file' ], {
|
||||
help: 'File to read, utf-8 encoded without BOM',
|
||||
nargs: '?',
|
||||
defaultValue: '-'
|
||||
});
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var options = cli.parseArgs();
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function readFile(filename, encoding, callback) {
|
||||
if (options.file === '-') {
|
||||
// read from stdin
|
||||
|
||||
var chunks = [];
|
||||
|
||||
process.stdin.on('data', function (chunk) {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
|
||||
process.stdin.on('end', function () {
|
||||
return callback(null, Buffer.concat(chunks).toString(encoding));
|
||||
});
|
||||
} else {
|
||||
fs.readFile(filename, encoding, callback);
|
||||
}
|
||||
}
|
||||
|
||||
readFile(options.file, 'utf8', function (error, input) {
|
||||
var output, isYaml;
|
||||
|
||||
if (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
console.error('File not found: ' + options.file);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
console.error(
|
||||
options.trace && error.stack ||
|
||||
error.message ||
|
||||
String(error));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
output = JSON.parse(input);
|
||||
isYaml = false;
|
||||
} catch (err) {
|
||||
if (err instanceof SyntaxError) {
|
||||
try {
|
||||
output = [];
|
||||
yaml.loadAll(input, function (doc) { output.push(doc); }, {});
|
||||
isYaml = true;
|
||||
|
||||
if (output.length === 0) output = null;
|
||||
else if (output.length === 1) output = output[0];
|
||||
|
||||
} catch (e) {
|
||||
if (options.trace && err.stack) console.error(e.stack);
|
||||
else console.error(e.toString(options.compact));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
console.error(
|
||||
options.trace && err.stack ||
|
||||
err.message ||
|
||||
String(err));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (isYaml) console.log(JSON.stringify(output, null, ' '));
|
||||
else console.log(yaml.dump(output));
|
||||
});
|
3946
node_modules/js-yaml/dist/js-yaml.js
generated
vendored
Normal file
3946
node_modules/js-yaml/dist/js-yaml.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/js-yaml/dist/js-yaml.min.js
generated
vendored
Normal file
1
node_modules/js-yaml/dist/js-yaml.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/js-yaml/index.js
generated
vendored
Normal file
7
node_modules/js-yaml/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var yaml = require('./lib/js-yaml.js');
|
||||
|
||||
|
||||
module.exports = yaml;
|
39
node_modules/js-yaml/lib/js-yaml.js
generated
vendored
Normal file
39
node_modules/js-yaml/lib/js-yaml.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var loader = require('./js-yaml/loader');
|
||||
var dumper = require('./js-yaml/dumper');
|
||||
|
||||
|
||||
function deprecated(name) {
|
||||
return function () {
|
||||
throw new Error('Function ' + name + ' is deprecated and cannot be used.');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
module.exports.Type = require('./js-yaml/type');
|
||||
module.exports.Schema = require('./js-yaml/schema');
|
||||
module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
|
||||
module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
|
||||
module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
|
||||
module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
|
||||
module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
|
||||
module.exports.load = loader.load;
|
||||
module.exports.loadAll = loader.loadAll;
|
||||
module.exports.safeLoad = loader.safeLoad;
|
||||
module.exports.safeLoadAll = loader.safeLoadAll;
|
||||
module.exports.dump = dumper.dump;
|
||||
module.exports.safeDump = dumper.safeDump;
|
||||
module.exports.YAMLException = require('./js-yaml/exception');
|
||||
|
||||
// Deprecated schema names from JS-YAML 2.0.x
|
||||
module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
|
||||
module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
|
||||
module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
|
||||
|
||||
// Deprecated functions from JS-YAML 1.x.x
|
||||
module.exports.scan = deprecated('scan');
|
||||
module.exports.parse = deprecated('parse');
|
||||
module.exports.compose = deprecated('compose');
|
||||
module.exports.addConstructor = deprecated('addConstructor');
|
59
node_modules/js-yaml/lib/js-yaml/common.js
generated
vendored
Normal file
59
node_modules/js-yaml/lib/js-yaml/common.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
function isNothing(subject) {
|
||||
return (typeof subject === 'undefined') || (subject === null);
|
||||
}
|
||||
|
||||
|
||||
function isObject(subject) {
|
||||
return (typeof subject === 'object') && (subject !== null);
|
||||
}
|
||||
|
||||
|
||||
function toArray(sequence) {
|
||||
if (Array.isArray(sequence)) return sequence;
|
||||
else if (isNothing(sequence)) return [];
|
||||
|
||||
return [ sequence ];
|
||||
}
|
||||
|
||||
|
||||
function extend(target, source) {
|
||||
var index, length, key, sourceKeys;
|
||||
|
||||
if (source) {
|
||||
sourceKeys = Object.keys(source);
|
||||
|
||||
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
||||
key = sourceKeys[index];
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
function repeat(string, count) {
|
||||
var result = '', cycle;
|
||||
|
||||
for (cycle = 0; cycle < count; cycle += 1) {
|
||||
result += string;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function isNegativeZero(number) {
|
||||
return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
|
||||
}
|
||||
|
||||
|
||||
module.exports.isNothing = isNothing;
|
||||
module.exports.isObject = isObject;
|
||||
module.exports.toArray = toArray;
|
||||
module.exports.repeat = repeat;
|
||||
module.exports.isNegativeZero = isNegativeZero;
|
||||
module.exports.extend = extend;
|
827
node_modules/js-yaml/lib/js-yaml/dumper.js
generated
vendored
Normal file
827
node_modules/js-yaml/lib/js-yaml/dumper.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
43
node_modules/js-yaml/lib/js-yaml/exception.js
generated
vendored
Normal file
43
node_modules/js-yaml/lib/js-yaml/exception.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
// YAML error class. http://stackoverflow.com/questions/8458984
|
||||
//
|
||||
'use strict';
|
||||
|
||||
function YAMLException(reason, mark) {
|
||||
// Super constructor
|
||||
Error.call(this);
|
||||
|
||||
this.name = 'YAMLException';
|
||||
this.reason = reason;
|
||||
this.mark = mark;
|
||||
this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
|
||||
|
||||
// Include stack trace in error object
|
||||
if (Error.captureStackTrace) {
|
||||
// Chrome and NodeJS
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
// FF, IE 10+ and Safari 6+. Fallback for others
|
||||
this.stack = (new Error()).stack || '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Inherit from Error
|
||||
YAMLException.prototype = Object.create(Error.prototype);
|
||||
YAMLException.prototype.constructor = YAMLException;
|
||||
|
||||
|
||||
YAMLException.prototype.toString = function toString(compact) {
|
||||
var result = this.name + ': ';
|
||||
|
||||
result += this.reason || '(unknown reason)';
|
||||
|
||||
if (!compact && this.mark) {
|
||||
result += ' ' + this.mark.toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
module.exports = YAMLException;
|
1625
node_modules/js-yaml/lib/js-yaml/loader.js
generated
vendored
Normal file
1625
node_modules/js-yaml/lib/js-yaml/loader.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
76
node_modules/js-yaml/lib/js-yaml/mark.js
generated
vendored
Normal file
76
node_modules/js-yaml/lib/js-yaml/mark.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var common = require('./common');
|
||||
|
||||
|
||||
function Mark(name, buffer, position, line, column) {
|
||||
this.name = name;
|
||||
this.buffer = buffer;
|
||||
this.position = position;
|
||||
this.line = line;
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
|
||||
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
||||
var head, start, tail, end, snippet;
|
||||
|
||||
if (!this.buffer) return null;
|
||||
|
||||
indent = indent || 4;
|
||||
maxLength = maxLength || 75;
|
||||
|
||||
head = '';
|
||||
start = this.position;
|
||||
|
||||
while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
|
||||
start -= 1;
|
||||
if (this.position - start > (maxLength / 2 - 1)) {
|
||||
head = ' ... ';
|
||||
start += 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tail = '';
|
||||
end = this.position;
|
||||
|
||||
while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
|
||||
end += 1;
|
||||
if (end - this.position > (maxLength / 2 - 1)) {
|
||||
tail = ' ... ';
|
||||
end -= 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
snippet = this.buffer.slice(start, end);
|
||||
|
||||
return common.repeat(' ', indent) + head + snippet + tail + '\n' +
|
||||
common.repeat(' ', indent + this.position - start + head.length) + '^';
|
||||
};
|
||||
|
||||
|
||||
Mark.prototype.toString = function toString(compact) {
|
||||
var snippet, where = '';
|
||||
|
||||
if (this.name) {
|
||||
where += 'in "' + this.name + '" ';
|
||||
}
|
||||
|
||||
where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
|
||||
|
||||
if (!compact) {
|
||||
snippet = this.getSnippet();
|
||||
|
||||
if (snippet) {
|
||||
where += ':\n' + snippet;
|
||||
}
|
||||
}
|
||||
|
||||
return where;
|
||||
};
|
||||
|
||||
|
||||
module.exports = Mark;
|
108
node_modules/js-yaml/lib/js-yaml/schema.js
generated
vendored
Normal file
108
node_modules/js-yaml/lib/js-yaml/schema.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
'use strict';
|
||||
|
||||
/*eslint-disable max-len*/
|
||||
|
||||
var common = require('./common');
|
||||
var YAMLException = require('./exception');
|
||||
var Type = require('./type');
|
||||
|
||||
|
||||
function compileList(schema, name, result) {
|
||||
var exclude = [];
|
||||
|
||||
schema.include.forEach(function (includedSchema) {
|
||||
result = compileList(includedSchema, name, result);
|
||||
});
|
||||
|
||||
schema[name].forEach(function (currentType) {
|
||||
result.forEach(function (previousType, previousIndex) {
|
||||
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
||||
exclude.push(previousIndex);
|
||||
}
|
||||
});
|
||||
|
||||
result.push(currentType);
|
||||
});
|
||||
|
||||
return result.filter(function (type, index) {
|
||||
return exclude.indexOf(index) === -1;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function compileMap(/* lists... */) {
|
||||
var result = {
|
||||
scalar: {},
|
||||
sequence: {},
|
||||
mapping: {},
|
||||
fallback: {}
|
||||
}, index, length;
|
||||
|
||||
function collectType(type) {
|
||||
result[type.kind][type.tag] = result['fallback'][type.tag] = type;
|
||||
}
|
||||
|
||||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
||||
arguments[index].forEach(collectType);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function Schema(definition) {
|
||||
this.include = definition.include || [];
|
||||
this.implicit = definition.implicit || [];
|
||||
this.explicit = definition.explicit || [];
|
||||
|
||||
this.implicit.forEach(function (type) {
|
||||
if (type.loadKind && type.loadKind !== 'scalar') {
|
||||
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
|
||||
}
|
||||
});
|
||||
|
||||
this.compiledImplicit = compileList(this, 'implicit', []);
|
||||
this.compiledExplicit = compileList(this, 'explicit', []);
|
||||
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
||||
}
|
||||
|
||||
|
||||
Schema.DEFAULT = null;
|
||||
|
||||
|
||||
Schema.create = function createSchema() {
|
||||
var schemas, types;
|
||||
|
||||
switch (arguments.length) {
|
||||
case 1:
|
||||
schemas = Schema.DEFAULT;
|
||||
types = arguments[0];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
schemas = arguments[0];
|
||||
types = arguments[1];
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new YAMLException('Wrong number of arguments for Schema.create function');
|
||||
}
|
||||
|
||||
schemas = common.toArray(schemas);
|
||||
types = common.toArray(types);
|
||||
|
||||
if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
|
||||
throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
|
||||
}
|
||||
|
||||
if (!types.every(function (type) { return type instanceof Type; })) {
|
||||
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
|
||||
}
|
||||
|
||||
return new Schema({
|
||||
include: schemas,
|
||||
explicit: types
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Schema;
|
18
node_modules/js-yaml/lib/js-yaml/schema/core.js
generated
vendored
Normal file
18
node_modules/js-yaml/lib/js-yaml/schema/core.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Standard YAML's Core schema.
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2804923
|
||||
//
|
||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
||||
// So, Core schema has no distinctions from JSON schema is JS-YAML.
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var Schema = require('../schema');
|
||||
|
||||
|
||||
module.exports = new Schema({
|
||||
include: [
|
||||
require('./json')
|
||||
]
|
||||
});
|
25
node_modules/js-yaml/lib/js-yaml/schema/default_full.js
generated
vendored
Normal file
25
node_modules/js-yaml/lib/js-yaml/schema/default_full.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// JS-YAML's default schema for `load` function.
|
||||
// It is not described in the YAML specification.
|
||||
//
|
||||
// This schema is based on JS-YAML's default safe schema and includes
|
||||
// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
|
||||
//
|
||||
// Also this schema is used as default base schema at `Schema.create` function.
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var Schema = require('../schema');
|
||||
|
||||
|
||||
module.exports = Schema.DEFAULT = new Schema({
|
||||
include: [
|
||||
require('./default_safe')
|
||||
],
|
||||
explicit: [
|
||||
require('../type/js/undefined'),
|
||||
require('../type/js/regexp'),
|
||||
require('../type/js/function')
|
||||
]
|
||||
});
|
28
node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
generated
vendored
Normal file
28
node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// JS-YAML's default schema for `safeLoad` function.
|
||||
// It is not described in the YAML specification.
|
||||
//
|
||||
// This schema is based on standard YAML's Core schema and includes most of
|
||||
// extra types described at YAML tag repository. (http://yaml.org/type/)
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var Schema = require('../schema');
|
||||
|
||||
|
||||
module.exports = new Schema({
|
||||
include: [
|
||||
require('./core')
|
||||
],
|
||||
implicit: [
|
||||
require('../type/timestamp'),
|
||||
require('../type/merge')
|
||||
],
|
||||
explicit: [
|
||||
require('../type/binary'),
|
||||
require('../type/omap'),
|
||||
require('../type/pairs'),
|
||||
require('../type/set')
|
||||
]
|
||||
});
|
17
node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
generated
vendored
Normal file
17
node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Standard YAML's Failsafe schema.
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2802346
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var Schema = require('../schema');
|
||||
|
||||
|
||||
module.exports = new Schema({
|
||||
explicit: [
|
||||
require('../type/str'),
|
||||
require('../type/seq'),
|
||||
require('../type/map')
|
||||
]
|
||||
});
|
25
node_modules/js-yaml/lib/js-yaml/schema/json.js
generated
vendored
Normal file
25
node_modules/js-yaml/lib/js-yaml/schema/json.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Standard YAML's JSON schema.
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2803231
|
||||
//
|
||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
||||
// So, this schema is not such strict as defined in the YAML specification.
|
||||
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var Schema = require('../schema');
|
||||
|
||||
|
||||
module.exports = new Schema({
|
||||
include: [
|
||||
require('./failsafe')
|
||||
],
|
||||
implicit: [
|
||||
require('../type/null'),
|
||||
require('../type/bool'),
|
||||
require('../type/int'),
|
||||
require('../type/float')
|
||||
]
|
||||
});
|
61
node_modules/js-yaml/lib/js-yaml/type.js
generated
vendored
Normal file
61
node_modules/js-yaml/lib/js-yaml/type.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
var YAMLException = require('./exception');
|
||||
|
||||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
||||
'kind',
|
||||
'resolve',
|
||||
'construct',
|
||||
'instanceOf',
|
||||
'predicate',
|
||||
'represent',
|
||||
'defaultStyle',
|
||||
'styleAliases'
|
||||
];
|
||||
|
||||
var YAML_NODE_KINDS = [
|
||||
'scalar',
|
||||
'sequence',
|
||||
'mapping'
|
||||
];
|
||||
|
||||
function compileStyleAliases(map) {
|
||||
var result = {};
|
||||
|
||||
if (map !== null) {
|
||||
Object.keys(map).forEach(function (style) {
|
||||
map[style].forEach(function (alias) {
|
||||
result[String(alias)] = style;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function Type(tag, options) {
|
||||
options = options || {};
|
||||
|
||||
Object.keys(options).forEach(function (name) {
|
||||
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
||||
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: Add tag format check.
|
||||
this.tag = tag;
|
||||
this.kind = options['kind'] || null;
|
||||
this.resolve = options['resolve'] || function () { return true; };
|
||||
this.construct = options['construct'] || function (data) { return data; };
|
||||
this.instanceOf = options['instanceOf'] || null;
|
||||
this.predicate = options['predicate'] || null;
|
||||
this.represent = options['represent'] || null;
|
||||
this.defaultStyle = options['defaultStyle'] || null;
|
||||
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
|
||||
|
||||
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
||||
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Type;
|
138
node_modules/js-yaml/lib/js-yaml/type/binary.js
generated
vendored
Normal file
138
node_modules/js-yaml/lib/js-yaml/type/binary.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
'use strict';
|
||||
|
||||
/*eslint-disable no-bitwise*/
|
||||
|
||||
var NodeBuffer;
|
||||
|
||||
try {
|
||||
// A trick for browserified version, to not include `Buffer` shim
|
||||
var _require = require;
|
||||
NodeBuffer = _require('buffer').Buffer;
|
||||
} catch (__) {}
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
|
||||
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
|
||||
var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
|
||||
|
||||
|
||||
function resolveYamlBinary(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
||||
|
||||
// Convert one by one.
|
||||
for (idx = 0; idx < max; idx++) {
|
||||
code = map.indexOf(data.charAt(idx));
|
||||
|
||||
// Skip CR/LF
|
||||
if (code > 64) continue;
|
||||
|
||||
// Fail on illegal characters
|
||||
if (code < 0) return false;
|
||||
|
||||
bitlen += 6;
|
||||
}
|
||||
|
||||
// If there are any bits left, source was corrupted
|
||||
return (bitlen % 8) === 0;
|
||||
}
|
||||
|
||||
function constructYamlBinary(data) {
|
||||
var idx, tailbits,
|
||||
input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
|
||||
max = input.length,
|
||||
map = BASE64_MAP,
|
||||
bits = 0,
|
||||
result = [];
|
||||
|
||||
// Collect by 6*4 bits (3 bytes)
|
||||
|
||||
for (idx = 0; idx < max; idx++) {
|
||||
if ((idx % 4 === 0) && idx) {
|
||||
result.push((bits >> 16) & 0xFF);
|
||||
result.push((bits >> 8) & 0xFF);
|
||||
result.push(bits & 0xFF);
|
||||
}
|
||||
|
||||
bits = (bits << 6) | map.indexOf(input.charAt(idx));
|
||||
}
|
||||
|
||||
// Dump tail
|
||||
|
||||
tailbits = (max % 4) * 6;
|
||||
|
||||
if (tailbits === 0) {
|
||||
result.push((bits >> 16) & 0xFF);
|
||||
result.push((bits >> 8) & 0xFF);
|
||||
result.push(bits & 0xFF);
|
||||
} else if (tailbits === 18) {
|
||||
result.push((bits >> 10) & 0xFF);
|
||||
result.push((bits >> 2) & 0xFF);
|
||||
} else if (tailbits === 12) {
|
||||
result.push((bits >> 4) & 0xFF);
|
||||
}
|
||||
|
||||
// Wrap into Buffer for NodeJS and leave Array for browser
|
||||
if (NodeBuffer) {
|
||||
// Support node 6.+ Buffer API when available
|
||||
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function representYamlBinary(object /*, style*/) {
|
||||
var result = '', bits = 0, idx, tail,
|
||||
max = object.length,
|
||||
map = BASE64_MAP;
|
||||
|
||||
// Convert every three bytes to 4 ASCII characters.
|
||||
|
||||
for (idx = 0; idx < max; idx++) {
|
||||
if ((idx % 3 === 0) && idx) {
|
||||
result += map[(bits >> 18) & 0x3F];
|
||||
result += map[(bits >> 12) & 0x3F];
|
||||
result += map[(bits >> 6) & 0x3F];
|
||||
result += map[bits & 0x3F];
|
||||
}
|
||||
|
||||
bits = (bits << 8) + object[idx];
|
||||
}
|
||||
|
||||
// Dump tail
|
||||
|
||||
tail = max % 3;
|
||||
|
||||
if (tail === 0) {
|
||||
result += map[(bits >> 18) & 0x3F];
|
||||
result += map[(bits >> 12) & 0x3F];
|
||||
result += map[(bits >> 6) & 0x3F];
|
||||
result += map[bits & 0x3F];
|
||||
} else if (tail === 2) {
|
||||
result += map[(bits >> 10) & 0x3F];
|
||||
result += map[(bits >> 4) & 0x3F];
|
||||
result += map[(bits << 2) & 0x3F];
|
||||
result += map[64];
|
||||
} else if (tail === 1) {
|
||||
result += map[(bits >> 2) & 0x3F];
|
||||
result += map[(bits << 4) & 0x3F];
|
||||
result += map[64];
|
||||
result += map[64];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function isBinary(object) {
|
||||
return NodeBuffer && NodeBuffer.isBuffer(object);
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:binary', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlBinary,
|
||||
construct: constructYamlBinary,
|
||||
predicate: isBinary,
|
||||
represent: representYamlBinary
|
||||
});
|
35
node_modules/js-yaml/lib/js-yaml/type/bool.js
generated
vendored
Normal file
35
node_modules/js-yaml/lib/js-yaml/type/bool.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlBoolean(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
var max = data.length;
|
||||
|
||||
return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
|
||||
(max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
|
||||
}
|
||||
|
||||
function constructYamlBoolean(data) {
|
||||
return data === 'true' ||
|
||||
data === 'True' ||
|
||||
data === 'TRUE';
|
||||
}
|
||||
|
||||
function isBoolean(object) {
|
||||
return Object.prototype.toString.call(object) === '[object Boolean]';
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:bool', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlBoolean,
|
||||
construct: constructYamlBoolean,
|
||||
predicate: isBoolean,
|
||||
represent: {
|
||||
lowercase: function (object) { return object ? 'true' : 'false'; },
|
||||
uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
|
||||
camelcase: function (object) { return object ? 'True' : 'False'; }
|
||||
},
|
||||
defaultStyle: 'lowercase'
|
||||
});
|
116
node_modules/js-yaml/lib/js-yaml/type/float.js
generated
vendored
Normal file
116
node_modules/js-yaml/lib/js-yaml/type/float.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
'use strict';
|
||||
|
||||
var common = require('../common');
|
||||
var Type = require('../type');
|
||||
|
||||
var YAML_FLOAT_PATTERN = new RegExp(
|
||||
// 2.5e4, 2.5 and integers
|
||||
'^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
|
||||
// .2e4, .2
|
||||
// special case, seems not from spec
|
||||
'|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
|
||||
// 20:59
|
||||
'|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
|
||||
// .inf
|
||||
'|[-+]?\\.(?:inf|Inf|INF)' +
|
||||
// .nan
|
||||
'|\\.(?:nan|NaN|NAN))$');
|
||||
|
||||
function resolveYamlFloat(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
if (!YAML_FLOAT_PATTERN.test(data) ||
|
||||
// Quick hack to not allow integers end with `_`
|
||||
// Probably should update regexp & check speed
|
||||
data[data.length - 1] === '_') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlFloat(data) {
|
||||
var value, sign, base, digits;
|
||||
|
||||
value = data.replace(/_/g, '').toLowerCase();
|
||||
sign = value[0] === '-' ? -1 : 1;
|
||||
digits = [];
|
||||
|
||||
if ('+-'.indexOf(value[0]) >= 0) {
|
||||
value = value.slice(1);
|
||||
}
|
||||
|
||||
if (value === '.inf') {
|
||||
return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
||||
|
||||
} else if (value === '.nan') {
|
||||
return NaN;
|
||||
|
||||
} else if (value.indexOf(':') >= 0) {
|
||||
value.split(':').forEach(function (v) {
|
||||
digits.unshift(parseFloat(v, 10));
|
||||
});
|
||||
|
||||
value = 0.0;
|
||||
base = 1;
|
||||
|
||||
digits.forEach(function (d) {
|
||||
value += d * base;
|
||||
base *= 60;
|
||||
});
|
||||
|
||||
return sign * value;
|
||||
|
||||
}
|
||||
return sign * parseFloat(value, 10);
|
||||
}
|
||||
|
||||
|
||||
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
||||
|
||||
function representYamlFloat(object, style) {
|
||||
var res;
|
||||
|
||||
if (isNaN(object)) {
|
||||
switch (style) {
|
||||
case 'lowercase': return '.nan';
|
||||
case 'uppercase': return '.NAN';
|
||||
case 'camelcase': return '.NaN';
|
||||
}
|
||||
} else if (Number.POSITIVE_INFINITY === object) {
|
||||
switch (style) {
|
||||
case 'lowercase': return '.inf';
|
||||
case 'uppercase': return '.INF';
|
||||
case 'camelcase': return '.Inf';
|
||||
}
|
||||
} else if (Number.NEGATIVE_INFINITY === object) {
|
||||
switch (style) {
|
||||
case 'lowercase': return '-.inf';
|
||||
case 'uppercase': return '-.INF';
|
||||
case 'camelcase': return '-.Inf';
|
||||
}
|
||||
} else if (common.isNegativeZero(object)) {
|
||||
return '-0.0';
|
||||
}
|
||||
|
||||
res = object.toString(10);
|
||||
|
||||
// JS stringifier can build scientific format without dots: 5e-100,
|
||||
// while YAML requres dot: 5.e-100. Fix it with simple hack
|
||||
|
||||
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
|
||||
}
|
||||
|
||||
function isFloat(object) {
|
||||
return (Object.prototype.toString.call(object) === '[object Number]') &&
|
||||
(object % 1 !== 0 || common.isNegativeZero(object));
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:float', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlFloat,
|
||||
construct: constructYamlFloat,
|
||||
predicate: isFloat,
|
||||
represent: representYamlFloat,
|
||||
defaultStyle: 'lowercase'
|
||||
});
|
173
node_modules/js-yaml/lib/js-yaml/type/int.js
generated
vendored
Normal file
173
node_modules/js-yaml/lib/js-yaml/type/int.js
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
'use strict';
|
||||
|
||||
var common = require('../common');
|
||||
var Type = require('../type');
|
||||
|
||||
function isHexCode(c) {
|
||||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
|
||||
((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
|
||||
((0x61/* a */ <= c) && (c <= 0x66/* f */));
|
||||
}
|
||||
|
||||
function isOctCode(c) {
|
||||
return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
|
||||
}
|
||||
|
||||
function isDecCode(c) {
|
||||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
|
||||
}
|
||||
|
||||
function resolveYamlInteger(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
var max = data.length,
|
||||
index = 0,
|
||||
hasDigits = false,
|
||||
ch;
|
||||
|
||||
if (!max) return false;
|
||||
|
||||
ch = data[index];
|
||||
|
||||
// sign
|
||||
if (ch === '-' || ch === '+') {
|
||||
ch = data[++index];
|
||||
}
|
||||
|
||||
if (ch === '0') {
|
||||
// 0
|
||||
if (index + 1 === max) return true;
|
||||
ch = data[++index];
|
||||
|
||||
// base 2, base 8, base 16
|
||||
|
||||
if (ch === 'b') {
|
||||
// base 2
|
||||
index++;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (ch !== '0' && ch !== '1') return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
}
|
||||
|
||||
|
||||
if (ch === 'x') {
|
||||
// base 16
|
||||
index++;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (!isHexCode(data.charCodeAt(index))) return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
}
|
||||
|
||||
// base 8
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (!isOctCode(data.charCodeAt(index))) return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
}
|
||||
|
||||
// base 10 (except 0) or base 60
|
||||
|
||||
// value should not start with `_`;
|
||||
if (ch === '_') return false;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (ch === ':') break;
|
||||
if (!isDecCode(data.charCodeAt(index))) {
|
||||
return false;
|
||||
}
|
||||
hasDigits = true;
|
||||
}
|
||||
|
||||
// Should have digits and should not end with `_`
|
||||
if (!hasDigits || ch === '_') return false;
|
||||
|
||||
// if !base60 - done;
|
||||
if (ch !== ':') return true;
|
||||
|
||||
// base60 almost not used, no needs to optimize
|
||||
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
||||
}
|
||||
|
||||
function constructYamlInteger(data) {
|
||||
var value = data, sign = 1, ch, base, digits = [];
|
||||
|
||||
if (value.indexOf('_') !== -1) {
|
||||
value = value.replace(/_/g, '');
|
||||
}
|
||||
|
||||
ch = value[0];
|
||||
|
||||
if (ch === '-' || ch === '+') {
|
||||
if (ch === '-') sign = -1;
|
||||
value = value.slice(1);
|
||||
ch = value[0];
|
||||
}
|
||||
|
||||
if (value === '0') return 0;
|
||||
|
||||
if (ch === '0') {
|
||||
if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
|
||||
if (value[1] === 'x') return sign * parseInt(value, 16);
|
||||
return sign * parseInt(value, 8);
|
||||
}
|
||||
|
||||
if (value.indexOf(':') !== -1) {
|
||||
value.split(':').forEach(function (v) {
|
||||
digits.unshift(parseInt(v, 10));
|
||||
});
|
||||
|
||||
value = 0;
|
||||
base = 1;
|
||||
|
||||
digits.forEach(function (d) {
|
||||
value += (d * base);
|
||||
base *= 60;
|
||||
});
|
||||
|
||||
return sign * value;
|
||||
|
||||
}
|
||||
|
||||
return sign * parseInt(value, 10);
|
||||
}
|
||||
|
||||
function isInteger(object) {
|
||||
return (Object.prototype.toString.call(object)) === '[object Number]' &&
|
||||
(object % 1 === 0 && !common.isNegativeZero(object));
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:int', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlInteger,
|
||||
construct: constructYamlInteger,
|
||||
predicate: isInteger,
|
||||
represent: {
|
||||
binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
|
||||
octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
|
||||
decimal: function (obj) { return obj.toString(10); },
|
||||
/* eslint-disable max-len */
|
||||
hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
|
||||
},
|
||||
defaultStyle: 'decimal',
|
||||
styleAliases: {
|
||||
binary: [ 2, 'bin' ],
|
||||
octal: [ 8, 'oct' ],
|
||||
decimal: [ 10, 'dec' ],
|
||||
hexadecimal: [ 16, 'hex' ]
|
||||
}
|
||||
});
|
92
node_modules/js-yaml/lib/js-yaml/type/js/function.js
generated
vendored
Normal file
92
node_modules/js-yaml/lib/js-yaml/type/js/function.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
|
||||
var esprima;
|
||||
|
||||
// Browserified version does not have esprima
|
||||
//
|
||||
// 1. For node.js just require module as deps
|
||||
// 2. For browser try to require mudule via external AMD system.
|
||||
// If not found - try to fallback to window.esprima. If not
|
||||
// found too - then fail to parse.
|
||||
//
|
||||
try {
|
||||
// workaround to exclude package from browserify list.
|
||||
var _require = require;
|
||||
esprima = _require('esprima');
|
||||
} catch (_) {
|
||||
/*global window */
|
||||
if (typeof window !== 'undefined') esprima = window.esprima;
|
||||
}
|
||||
|
||||
var Type = require('../../type');
|
||||
|
||||
function resolveJavascriptFunction(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
try {
|
||||
var source = '(' + data + ')',
|
||||
ast = esprima.parse(source, { range: true });
|
||||
|
||||
if (ast.type !== 'Program' ||
|
||||
ast.body.length !== 1 ||
|
||||
ast.body[0].type !== 'ExpressionStatement' ||
|
||||
(ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
|
||||
ast.body[0].expression.type !== 'FunctionExpression')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function constructJavascriptFunction(data) {
|
||||
/*jslint evil:true*/
|
||||
|
||||
var source = '(' + data + ')',
|
||||
ast = esprima.parse(source, { range: true }),
|
||||
params = [],
|
||||
body;
|
||||
|
||||
if (ast.type !== 'Program' ||
|
||||
ast.body.length !== 1 ||
|
||||
ast.body[0].type !== 'ExpressionStatement' ||
|
||||
(ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
|
||||
ast.body[0].expression.type !== 'FunctionExpression')) {
|
||||
throw new Error('Failed to resolve function');
|
||||
}
|
||||
|
||||
ast.body[0].expression.params.forEach(function (param) {
|
||||
params.push(param.name);
|
||||
});
|
||||
|
||||
body = ast.body[0].expression.body.range;
|
||||
|
||||
// Esprima's ranges include the first '{' and the last '}' characters on
|
||||
// function expressions. So cut them out.
|
||||
if (ast.body[0].expression.body.type === 'BlockStatement') {
|
||||
/*eslint-disable no-new-func*/
|
||||
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
||||
}
|
||||
// ES6 arrow functions can omit the BlockStatement. In that case, just return
|
||||
// the body.
|
||||
/*eslint-disable no-new-func*/
|
||||
return new Function(params, 'return ' + source.slice(body[0], body[1]));
|
||||
}
|
||||
|
||||
function representJavascriptFunction(object /*, style*/) {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
function isFunction(object) {
|
||||
return Object.prototype.toString.call(object) === '[object Function]';
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:js/function', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveJavascriptFunction,
|
||||
construct: constructJavascriptFunction,
|
||||
predicate: isFunction,
|
||||
represent: representJavascriptFunction
|
||||
});
|
60
node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
generated
vendored
Normal file
60
node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../../type');
|
||||
|
||||
function resolveJavascriptRegExp(data) {
|
||||
if (data === null) return false;
|
||||
if (data.length === 0) return false;
|
||||
|
||||
var regexp = data,
|
||||
tail = /\/([gim]*)$/.exec(data),
|
||||
modifiers = '';
|
||||
|
||||
// if regexp starts with '/' it can have modifiers and must be properly closed
|
||||
// `/foo/gim` - modifiers tail can be maximum 3 chars
|
||||
if (regexp[0] === '/') {
|
||||
if (tail) modifiers = tail[1];
|
||||
|
||||
if (modifiers.length > 3) return false;
|
||||
// if expression starts with /, is should be properly terminated
|
||||
if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructJavascriptRegExp(data) {
|
||||
var regexp = data,
|
||||
tail = /\/([gim]*)$/.exec(data),
|
||||
modifiers = '';
|
||||
|
||||
// `/foo/gim` - tail can be maximum 4 chars
|
||||
if (regexp[0] === '/') {
|
||||
if (tail) modifiers = tail[1];
|
||||
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
||||
}
|
||||
|
||||
return new RegExp(regexp, modifiers);
|
||||
}
|
||||
|
||||
function representJavascriptRegExp(object /*, style*/) {
|
||||
var result = '/' + object.source + '/';
|
||||
|
||||
if (object.global) result += 'g';
|
||||
if (object.multiline) result += 'm';
|
||||
if (object.ignoreCase) result += 'i';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function isRegExp(object) {
|
||||
return Object.prototype.toString.call(object) === '[object RegExp]';
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:js/regexp', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveJavascriptRegExp,
|
||||
construct: constructJavascriptRegExp,
|
||||
predicate: isRegExp,
|
||||
represent: representJavascriptRegExp
|
||||
});
|
28
node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
generated
vendored
Normal file
28
node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../../type');
|
||||
|
||||
function resolveJavascriptUndefined() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructJavascriptUndefined() {
|
||||
/*eslint-disable no-undefined*/
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function representJavascriptUndefined() {
|
||||
return '';
|
||||
}
|
||||
|
||||
function isUndefined(object) {
|
||||
return typeof object === 'undefined';
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:js/undefined', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveJavascriptUndefined,
|
||||
construct: constructJavascriptUndefined,
|
||||
predicate: isUndefined,
|
||||
represent: representJavascriptUndefined
|
||||
});
|
8
node_modules/js-yaml/lib/js-yaml/type/map.js
generated
vendored
Normal file
8
node_modules/js-yaml/lib/js-yaml/type/map.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:map', {
|
||||
kind: 'mapping',
|
||||
construct: function (data) { return data !== null ? data : {}; }
|
||||
});
|
12
node_modules/js-yaml/lib/js-yaml/type/merge.js
generated
vendored
Normal file
12
node_modules/js-yaml/lib/js-yaml/type/merge.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlMerge(data) {
|
||||
return data === '<<' || data === null;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:merge', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlMerge
|
||||
});
|
34
node_modules/js-yaml/lib/js-yaml/type/null.js
generated
vendored
Normal file
34
node_modules/js-yaml/lib/js-yaml/type/null.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlNull(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var max = data.length;
|
||||
|
||||
return (max === 1 && data === '~') ||
|
||||
(max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
|
||||
}
|
||||
|
||||
function constructYamlNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function isNull(object) {
|
||||
return object === null;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:null', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlNull,
|
||||
construct: constructYamlNull,
|
||||
predicate: isNull,
|
||||
represent: {
|
||||
canonical: function () { return '~'; },
|
||||
lowercase: function () { return 'null'; },
|
||||
uppercase: function () { return 'NULL'; },
|
||||
camelcase: function () { return 'Null'; }
|
||||
},
|
||||
defaultStyle: 'lowercase'
|
||||
});
|
44
node_modules/js-yaml/lib/js-yaml/type/omap.js
generated
vendored
Normal file
44
node_modules/js-yaml/lib/js-yaml/type/omap.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var _toString = Object.prototype.toString;
|
||||
|
||||
function resolveYamlOmap(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var objectKeys = [], index, length, pair, pairKey, pairHasKey,
|
||||
object = data;
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
pairHasKey = false;
|
||||
|
||||
if (_toString.call(pair) !== '[object Object]') return false;
|
||||
|
||||
for (pairKey in pair) {
|
||||
if (_hasOwnProperty.call(pair, pairKey)) {
|
||||
if (!pairHasKey) pairHasKey = true;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pairHasKey) return false;
|
||||
|
||||
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
||||
else return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlOmap(data) {
|
||||
return data !== null ? data : [];
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:omap', {
|
||||
kind: 'sequence',
|
||||
resolve: resolveYamlOmap,
|
||||
construct: constructYamlOmap
|
||||
});
|
53
node_modules/js-yaml/lib/js-yaml/type/pairs.js
generated
vendored
Normal file
53
node_modules/js-yaml/lib/js-yaml/type/pairs.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _toString = Object.prototype.toString;
|
||||
|
||||
function resolveYamlPairs(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var index, length, pair, keys, result,
|
||||
object = data;
|
||||
|
||||
result = new Array(object.length);
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
|
||||
if (_toString.call(pair) !== '[object Object]') return false;
|
||||
|
||||
keys = Object.keys(pair);
|
||||
|
||||
if (keys.length !== 1) return false;
|
||||
|
||||
result[index] = [ keys[0], pair[keys[0]] ];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlPairs(data) {
|
||||
if (data === null) return [];
|
||||
|
||||
var index, length, pair, keys, result,
|
||||
object = data;
|
||||
|
||||
result = new Array(object.length);
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
|
||||
keys = Object.keys(pair);
|
||||
|
||||
result[index] = [ keys[0], pair[keys[0]] ];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:pairs', {
|
||||
kind: 'sequence',
|
||||
resolve: resolveYamlPairs,
|
||||
construct: constructYamlPairs
|
||||
});
|
8
node_modules/js-yaml/lib/js-yaml/type/seq.js
generated
vendored
Normal file
8
node_modules/js-yaml/lib/js-yaml/type/seq.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:seq', {
|
||||
kind: 'sequence',
|
||||
construct: function (data) { return data !== null ? data : []; }
|
||||
});
|
29
node_modules/js-yaml/lib/js-yaml/type/set.js
generated
vendored
Normal file
29
node_modules/js-yaml/lib/js-yaml/type/set.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
function resolveYamlSet(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var key, object = data;
|
||||
|
||||
for (key in object) {
|
||||
if (_hasOwnProperty.call(object, key)) {
|
||||
if (object[key] !== null) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlSet(data) {
|
||||
return data !== null ? data : {};
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:set', {
|
||||
kind: 'mapping',
|
||||
resolve: resolveYamlSet,
|
||||
construct: constructYamlSet
|
||||
});
|
8
node_modules/js-yaml/lib/js-yaml/type/str.js
generated
vendored
Normal file
8
node_modules/js-yaml/lib/js-yaml/type/str.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:str', {
|
||||
kind: 'scalar',
|
||||
construct: function (data) { return data !== null ? data : ''; }
|
||||
});
|
88
node_modules/js-yaml/lib/js-yaml/type/timestamp.js
generated
vendored
Normal file
88
node_modules/js-yaml/lib/js-yaml/type/timestamp.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var YAML_DATE_REGEXP = new RegExp(
|
||||
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
||||
'-([0-9][0-9])' + // [2] month
|
||||
'-([0-9][0-9])$'); // [3] day
|
||||
|
||||
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
||||
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
||||
'-([0-9][0-9]?)' + // [2] month
|
||||
'-([0-9][0-9]?)' + // [3] day
|
||||
'(?:[Tt]|[ \\t]+)' + // ...
|
||||
'([0-9][0-9]?)' + // [4] hour
|
||||
':([0-9][0-9])' + // [5] minute
|
||||
':([0-9][0-9])' + // [6] second
|
||||
'(?:\\.([0-9]*))?' + // [7] fraction
|
||||
'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
|
||||
'(?::([0-9][0-9]))?))?$'); // [11] tz_minute
|
||||
|
||||
function resolveYamlTimestamp(data) {
|
||||
if (data === null) return false;
|
||||
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
||||
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function constructYamlTimestamp(data) {
|
||||
var match, year, month, day, hour, minute, second, fraction = 0,
|
||||
delta = null, tz_hour, tz_minute, date;
|
||||
|
||||
match = YAML_DATE_REGEXP.exec(data);
|
||||
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
||||
|
||||
if (match === null) throw new Error('Date resolve error');
|
||||
|
||||
// match: [1] year [2] month [3] day
|
||||
|
||||
year = +(match[1]);
|
||||
month = +(match[2]) - 1; // JS month starts with 0
|
||||
day = +(match[3]);
|
||||
|
||||
if (!match[4]) { // no hour
|
||||
return new Date(Date.UTC(year, month, day));
|
||||
}
|
||||
|
||||
// match: [4] hour [5] minute [6] second [7] fraction
|
||||
|
||||
hour = +(match[4]);
|
||||
minute = +(match[5]);
|
||||
second = +(match[6]);
|
||||
|
||||
if (match[7]) {
|
||||
fraction = match[7].slice(0, 3);
|
||||
while (fraction.length < 3) { // milli-seconds
|
||||
fraction += '0';
|
||||
}
|
||||
fraction = +fraction;
|
||||
}
|
||||
|
||||
// match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
|
||||
|
||||
if (match[9]) {
|
||||
tz_hour = +(match[10]);
|
||||
tz_minute = +(match[11] || 0);
|
||||
delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
|
||||
if (match[9] === '-') delta = -delta;
|
||||
}
|
||||
|
||||
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
||||
|
||||
if (delta) date.setTime(date.getTime() - delta);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
function representYamlTimestamp(object /*, style*/) {
|
||||
return object.toISOString();
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:timestamp', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlTimestamp,
|
||||
construct: constructYamlTimestamp,
|
||||
instanceOf: Date,
|
||||
represent: representYamlTimestamp
|
||||
});
|
47
node_modules/js-yaml/package.json
generated
vendored
Normal file
47
node_modules/js-yaml/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "js-yaml",
|
||||
"version": "3.13.1",
|
||||
"description": "YAML 1.2 parser and serializer",
|
||||
"keywords": [
|
||||
"yaml",
|
||||
"parser",
|
||||
"serializer",
|
||||
"pyyaml"
|
||||
],
|
||||
"homepage": "https://github.com/nodeca/js-yaml",
|
||||
"author": "Vladimir Zapparov <dervus.grim@gmail.com>",
|
||||
"contributors": [
|
||||
"Aleksey V Zapparov <ixti@member.fsf.org> (http://www.ixti.net/)",
|
||||
"Vitaly Puzrin <vitaly@rcdesign.ru> (https://github.com/puzrin)",
|
||||
"Martin Grenfell <martin.grenfell@gmail.com> (http://got-ravings.blogspot.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "nodeca/js-yaml",
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/",
|
||||
"bin/",
|
||||
"dist/"
|
||||
],
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ansi": "^0.3.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"browserify": "^16.2.2",
|
||||
"codemirror": "^5.13.4",
|
||||
"eslint": "^4.1.1",
|
||||
"fast-check": "1.1.3",
|
||||
"istanbul": "^0.4.5",
|
||||
"mocha": "^5.2.0",
|
||||
"uglify-js": "^3.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user