aboutsummaryrefslogtreecommitdiff
path: root/node_modules/yaml/browser/dist/schema/yaml-1.1
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
committerMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
commit383285ecd5292bf9a825e05904955b937de84cc9 (patch)
tree0a53b6f02c1604b078044567c03dc1b6c944c8c2 /node_modules/yaml/browser/dist/schema/yaml-1.1
downloadequestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.gz
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.bz2
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.zip
Initial commit
Diffstat (limited to 'node_modules/yaml/browser/dist/schema/yaml-1.1')
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js66
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js26
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/float.js46
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/int.js71
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js73
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js78
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js37
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/set.js87
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js101
9 files changed, 585 insertions, 0 deletions
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
new file mode 100644
index 0000000..a700819
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
@@ -0,0 +1,66 @@
+import { Scalar } from '../../nodes/Scalar.js';
+import { stringifyString } from '../../stringify/stringifyString.js';
+
+const binary = {
+ identify: value => value instanceof Uint8Array,
+ default: false,
+ tag: 'tag:yaml.org,2002:binary',
+ /**
+ * Returns a Buffer in node and an Uint8Array in browsers
+ *
+ * To use the resulting buffer as an image, you'll want to do something like:
+ *
+ * const blob = new Blob([buffer], { type: 'image/jpeg' })
+ * document.querySelector('#photo').src = URL.createObjectURL(blob)
+ */
+ resolve(src, onError) {
+ if (typeof Buffer === 'function') {
+ return Buffer.from(src, 'base64');
+ }
+ else if (typeof atob === 'function') {
+ // On IE 11, atob() can't handle newlines
+ const str = atob(src.replace(/[\n\r]/g, ''));
+ const buffer = new Uint8Array(str.length);
+ for (let i = 0; i < str.length; ++i)
+ buffer[i] = str.charCodeAt(i);
+ return buffer;
+ }
+ else {
+ onError('This environment does not support reading binary tags; either Buffer or atob is required');
+ return src;
+ }
+ },
+ stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
+ const buf = value; // checked earlier by binary.identify()
+ let str;
+ if (typeof Buffer === 'function') {
+ str =
+ buf instanceof Buffer
+ ? buf.toString('base64')
+ : Buffer.from(buf.buffer).toString('base64');
+ }
+ else if (typeof btoa === 'function') {
+ let s = '';
+ for (let i = 0; i < buf.length; ++i)
+ s += String.fromCharCode(buf[i]);
+ str = btoa(s);
+ }
+ else {
+ throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
+ }
+ if (!type)
+ type = Scalar.BLOCK_LITERAL;
+ if (type !== Scalar.QUOTE_DOUBLE) {
+ const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
+ const n = Math.ceil(str.length / lineWidth);
+ const lines = new Array(n);
+ for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
+ lines[i] = str.substr(o, lineWidth);
+ }
+ str = lines.join(type === Scalar.BLOCK_LITERAL ? '\n' : ' ');
+ }
+ return stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
+ }
+};
+
+export { binary };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
new file mode 100644
index 0000000..1ced791
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
@@ -0,0 +1,26 @@
+import { Scalar } from '../../nodes/Scalar.js';
+
+function boolStringify({ value, source }, ctx) {
+ const boolObj = value ? trueTag : falseTag;
+ if (source && boolObj.test.test(source))
+ return source;
+ return value ? ctx.options.trueStr : ctx.options.falseStr;
+}
+const trueTag = {
+ identify: value => value === true,
+ default: true,
+ tag: 'tag:yaml.org,2002:bool',
+ test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
+ resolve: () => new Scalar(true),
+ stringify: boolStringify
+};
+const falseTag = {
+ identify: value => value === false,
+ default: true,
+ tag: 'tag:yaml.org,2002:bool',
+ test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
+ resolve: () => new Scalar(false),
+ stringify: boolStringify
+};
+
+export { falseTag, trueTag };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
new file mode 100644
index 0000000..9097266
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
@@ -0,0 +1,46 @@
+import { Scalar } from '../../nodes/Scalar.js';
+import { stringifyNumber } from '../../stringify/stringifyNumber.js';
+
+const floatNaN = {
+ identify: value => typeof value === 'number',
+ default: true,
+ tag: 'tag:yaml.org,2002:float',
+ test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
+ resolve: (str) => str.slice(-3).toLowerCase() === 'nan'
+ ? NaN
+ : str[0] === '-'
+ ? Number.NEGATIVE_INFINITY
+ : Number.POSITIVE_INFINITY,
+ stringify: stringifyNumber
+};
+const floatExp = {
+ identify: value => typeof value === 'number',
+ default: true,
+ tag: 'tag:yaml.org,2002:float',
+ format: 'EXP',
+ test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
+ resolve: (str) => parseFloat(str.replace(/_/g, '')),
+ stringify(node) {
+ const num = Number(node.value);
+ return isFinite(num) ? num.toExponential() : stringifyNumber(node);
+ }
+};
+const float = {
+ identify: value => typeof value === 'number',
+ default: true,
+ tag: 'tag:yaml.org,2002:float',
+ test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
+ resolve(str) {
+ const node = new Scalar(parseFloat(str.replace(/_/g, '')));
+ const dot = str.indexOf('.');
+ if (dot !== -1) {
+ const f = str.substring(dot + 1).replace(/_/g, '');
+ if (f[f.length - 1] === '0')
+ node.minFractionDigits = f.length;
+ }
+ return node;
+ },
+ stringify: stringifyNumber
+};
+
+export { float, floatExp, floatNaN };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
new file mode 100644
index 0000000..f572823
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
@@ -0,0 +1,71 @@
+import { stringifyNumber } from '../../stringify/stringifyNumber.js';
+
+const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);
+function intResolve(str, offset, radix, { intAsBigInt }) {
+ const sign = str[0];
+ if (sign === '-' || sign === '+')
+ offset += 1;
+ str = str.substring(offset).replace(/_/g, '');
+ if (intAsBigInt) {
+ switch (radix) {
+ case 2:
+ str = `0b${str}`;
+ break;
+ case 8:
+ str = `0o${str}`;
+ break;
+ case 16:
+ str = `0x${str}`;
+ break;
+ }
+ const n = BigInt(str);
+ return sign === '-' ? BigInt(-1) * n : n;
+ }
+ const n = parseInt(str, radix);
+ return sign === '-' ? -1 * n : n;
+}
+function intStringify(node, radix, prefix) {
+ const { value } = node;
+ if (intIdentify(value)) {
+ const str = value.toString(radix);
+ return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
+ }
+ return stringifyNumber(node);
+}
+const intBin = {
+ identify: intIdentify,
+ default: true,
+ tag: 'tag:yaml.org,2002:int',
+ format: 'BIN',
+ test: /^[-+]?0b[0-1_]+$/,
+ resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),
+ stringify: node => intStringify(node, 2, '0b')
+};
+const intOct = {
+ identify: intIdentify,
+ default: true,
+ tag: 'tag:yaml.org,2002:int',
+ format: 'OCT',
+ test: /^[-+]?0[0-7_]+$/,
+ resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
+ stringify: node => intStringify(node, 8, '0')
+};
+const int = {
+ identify: intIdentify,
+ default: true,
+ tag: 'tag:yaml.org,2002:int',
+ test: /^[-+]?[0-9][0-9_]*$/,
+ resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
+ stringify: stringifyNumber
+};
+const intHex = {
+ identify: intIdentify,
+ default: true,
+ tag: 'tag:yaml.org,2002:int',
+ format: 'HEX',
+ test: /^[-+]?0x[0-9a-fA-F_]+$/,
+ resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
+ stringify: node => intStringify(node, 16, '0x')
+};
+
+export { int, intBin, intHex, intOct };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js
new file mode 100644
index 0000000..71e2527
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js
@@ -0,0 +1,73 @@
+import { YAMLSeq } from '../../nodes/YAMLSeq.js';
+import { toJS } from '../../nodes/toJS.js';
+import { isScalar, isPair } from '../../nodes/Node.js';
+import { YAMLMap } from '../../nodes/YAMLMap.js';
+import { resolvePairs, createPairs } from './pairs.js';
+
+class YAMLOMap extends YAMLSeq {
+ constructor() {
+ super();
+ this.add = YAMLMap.prototype.add.bind(this);
+ this.delete = YAMLMap.prototype.delete.bind(this);
+ this.get = YAMLMap.prototype.get.bind(this);
+ this.has = YAMLMap.prototype.has.bind(this);
+ this.set = YAMLMap.prototype.set.bind(this);
+ this.tag = YAMLOMap.tag;
+ }
+ /**
+ * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
+ * but TypeScript won't allow widening the signature of a child method.
+ */
+ toJSON(_, ctx) {
+ if (!ctx)
+ return super.toJSON(_);
+ const map = new Map();
+ if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate)
+ ctx.onCreate(map);
+ for (const pair of this.items) {
+ let key, value;
+ if (isPair(pair)) {
+ key = toJS(pair.key, '', ctx);
+ value = toJS(pair.value, key, ctx);
+ }
+ else {
+ key = toJS(pair, '', ctx);
+ }
+ if (map.has(key))
+ throw new Error('Ordered maps must not include duplicate keys');
+ map.set(key, value);
+ }
+ return map;
+ }
+}
+YAMLOMap.tag = 'tag:yaml.org,2002:omap';
+const omap = {
+ collection: 'seq',
+ identify: value => value instanceof Map,
+ nodeClass: YAMLOMap,
+ default: false,
+ tag: 'tag:yaml.org,2002:omap',
+ resolve(seq, onError) {
+ const pairs = resolvePairs(seq, onError);
+ const seenKeys = [];
+ for (const { key } of pairs.items) {
+ if (isScalar(key)) {
+ if (seenKeys.includes(key.value)) {
+ onError(`Ordered maps must not include duplicate keys: ${key.value}`);
+ }
+ else {
+ seenKeys.push(key.value);
+ }
+ }
+ }
+ return Object.assign(new YAMLOMap(), pairs);
+ },
+ createNode(schema, iterable, ctx) {
+ const pairs = createPairs(schema, iterable, ctx);
+ const omap = new YAMLOMap();
+ omap.items = pairs.items;
+ return omap;
+ }
+};
+
+export { YAMLOMap, omap };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
new file mode 100644
index 0000000..5c02478
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
@@ -0,0 +1,78 @@
+import { isSeq, isPair, isMap } from '../../nodes/Node.js';
+import { Pair, createPair } from '../../nodes/Pair.js';
+import { Scalar } from '../../nodes/Scalar.js';
+import { YAMLSeq } from '../../nodes/YAMLSeq.js';
+
+function resolvePairs(seq, onError) {
+ var _a;
+ if (isSeq(seq)) {
+ for (let i = 0; i < seq.items.length; ++i) {
+ let item = seq.items[i];
+ if (isPair(item))
+ continue;
+ else if (isMap(item)) {
+ if (item.items.length > 1)
+ onError('Each pair must have its own sequence indicator');
+ const pair = item.items[0] || new Pair(new Scalar(null));
+ if (item.commentBefore)
+ pair.key.commentBefore = pair.key.commentBefore
+ ? `${item.commentBefore}\n${pair.key.commentBefore}`
+ : item.commentBefore;
+ if (item.comment) {
+ const cn = (_a = pair.value) !== null && _a !== void 0 ? _a : pair.key;
+ cn.comment = cn.comment
+ ? `${item.comment}\n${cn.comment}`
+ : item.comment;
+ }
+ item = pair;
+ }
+ seq.items[i] = isPair(item) ? item : new Pair(item);
+ }
+ }
+ else
+ onError('Expected a sequence for this tag');
+ return seq;
+}
+function createPairs(schema, iterable, ctx) {
+ const { replacer } = ctx;
+ const pairs = new YAMLSeq(schema);
+ pairs.tag = 'tag:yaml.org,2002:pairs';
+ let i = 0;
+ if (iterable && Symbol.iterator in Object(iterable))
+ for (let it of iterable) {
+ if (typeof replacer === 'function')
+ it = replacer.call(iterable, String(i++), it);
+ let key, value;
+ if (Array.isArray(it)) {
+ if (it.length === 2) {
+ key = it[0];
+ value = it[1];
+ }
+ else
+ throw new TypeError(`Expected [key, value] tuple: ${it}`);
+ }
+ else if (it && it instanceof Object) {
+ const keys = Object.keys(it);
+ if (keys.length === 1) {
+ key = keys[0];
+ value = it[key];
+ }
+ else
+ throw new TypeError(`Expected { key: value } tuple: ${it}`);
+ }
+ else {
+ key = it;
+ }
+ pairs.items.push(createPair(key, value, ctx));
+ }
+ return pairs;
+}
+const pairs = {
+ collection: 'seq',
+ default: false,
+ tag: 'tag:yaml.org,2002:pairs',
+ resolve: resolvePairs,
+ createNode: createPairs
+};
+
+export { createPairs, pairs, resolvePairs };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
new file mode 100644
index 0000000..dc5be5f
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
@@ -0,0 +1,37 @@
+import { map } from '../common/map.js';
+import { nullTag } from '../common/null.js';
+import { seq } from '../common/seq.js';
+import { string } from '../common/string.js';
+import { binary } from './binary.js';
+import { trueTag, falseTag } from './bool.js';
+import { floatNaN, floatExp, float } from './float.js';
+import { intBin, intOct, int, intHex } from './int.js';
+import { omap } from './omap.js';
+import { pairs } from './pairs.js';
+import { set } from './set.js';
+import { intTime, floatTime, timestamp } from './timestamp.js';
+
+const schema = [
+ map,
+ seq,
+ string,
+ nullTag,
+ trueTag,
+ falseTag,
+ intBin,
+ intOct,
+ int,
+ intHex,
+ floatNaN,
+ floatExp,
+ float,
+ binary,
+ omap,
+ pairs,
+ set,
+ intTime,
+ floatTime,
+ timestamp
+];
+
+export { schema };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
new file mode 100644
index 0000000..bee6ac6
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
@@ -0,0 +1,87 @@
+import { isMap, isPair, isScalar } from '../../nodes/Node.js';
+import { createPair, Pair } from '../../nodes/Pair.js';
+import { YAMLMap, findPair } from '../../nodes/YAMLMap.js';
+
+class YAMLSet extends YAMLMap {
+ constructor(schema) {
+ super(schema);
+ this.tag = YAMLSet.tag;
+ }
+ add(key) {
+ let pair;
+ if (isPair(key))
+ pair = key;
+ else if (typeof key === 'object' &&
+ 'key' in key &&
+ 'value' in key &&
+ key.value === null)
+ pair = new Pair(key.key, null);
+ else
+ pair = new Pair(key, null);
+ const prev = findPair(this.items, pair.key);
+ if (!prev)
+ this.items.push(pair);
+ }
+ get(key, keepPair) {
+ const pair = findPair(this.items, key);
+ return !keepPair && isPair(pair)
+ ? isScalar(pair.key)
+ ? pair.key.value
+ : pair.key
+ : pair;
+ }
+ set(key, value) {
+ if (typeof value !== 'boolean')
+ throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
+ const prev = findPair(this.items, key);
+ if (prev && !value) {
+ this.items.splice(this.items.indexOf(prev), 1);
+ }
+ else if (!prev && value) {
+ this.items.push(new Pair(key));
+ }
+ }
+ toJSON(_, ctx) {
+ return super.toJSON(_, ctx, Set);
+ }
+ toString(ctx, onComment, onChompKeep) {
+ if (!ctx)
+ return JSON.stringify(this);
+ if (this.hasAllNullValues(true))
+ return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);
+ else
+ throw new Error('Set items must all have null values');
+ }
+}
+YAMLSet.tag = 'tag:yaml.org,2002:set';
+const set = {
+ collection: 'map',
+ identify: value => value instanceof Set,
+ nodeClass: YAMLSet,
+ default: false,
+ tag: 'tag:yaml.org,2002:set',
+ resolve(map, onError) {
+ if (isMap(map)) {
+ if (map.hasAllNullValues(true))
+ return Object.assign(new YAMLSet(), map);
+ else
+ onError('Set items must all have null values');
+ }
+ else
+ onError('Expected a mapping for this tag');
+ return map;
+ },
+ createNode(schema, iterable, ctx) {
+ const { replacer } = ctx;
+ const set = new YAMLSet(schema);
+ if (iterable && Symbol.iterator in Object(iterable))
+ for (let value of iterable) {
+ if (typeof replacer === 'function')
+ value = replacer.call(iterable, value, value);
+ set.items.push(createPair(value, null, ctx));
+ }
+ return set;
+ }
+};
+
+export { YAMLSet, set };
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
new file mode 100644
index 0000000..7013cda
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
@@ -0,0 +1,101 @@
+import { stringifyNumber } from '../../stringify/stringifyNumber.js';
+
+/** Internal types handle bigint as number, because TS can't figure it out. */
+function parseSexagesimal(str, asBigInt) {
+ const sign = str[0];
+ const parts = sign === '-' || sign === '+' ? str.substring(1) : str;
+ const num = (n) => asBigInt ? BigInt(n) : Number(n);
+ const res = parts
+ .replace(/_/g, '')
+ .split(':')
+ .reduce((res, p) => res * num(60) + num(p), num(0));
+ return (sign === '-' ? num(-1) * res : res);
+}
+/**
+ * hhhh:mm:ss.sss
+ *
+ * Internal types handle bigint as number, because TS can't figure it out.
+ */
+function stringifySexagesimal(node) {
+ let { value } = node;
+ let num = (n) => n;
+ if (typeof value === 'bigint')
+ num = n => BigInt(n);
+ else if (isNaN(value) || !isFinite(value))
+ return stringifyNumber(node);
+ let sign = '';
+ if (value < 0) {
+ sign = '-';
+ value *= num(-1);
+ }
+ const _60 = num(60);
+ const parts = [value % _60]; // seconds, including ms
+ if (value < 60) {
+ parts.unshift(0); // at least one : is required
+ }
+ else {
+ value = (value - parts[0]) / _60;
+ parts.unshift(value % _60); // minutes
+ if (value >= 60) {
+ value = (value - parts[0]) / _60;
+ parts.unshift(value); // hours
+ }
+ }
+ return (sign +
+ parts
+ .map(n => (n < 10 ? '0' + String(n) : String(n)))
+ .join(':')
+ .replace(/000000\d*$/, '') // % 60 may introduce error
+ );
+}
+const intTime = {
+ identify: value => typeof value === 'bigint' || Number.isInteger(value),
+ default: true,
+ tag: 'tag:yaml.org,2002:int',
+ format: 'TIME',
+ test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
+ resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),
+ stringify: stringifySexagesimal
+};
+const floatTime = {
+ identify: value => typeof value === 'number',
+ default: true,
+ tag: 'tag:yaml.org,2002:float',
+ format: 'TIME',
+ test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
+ resolve: str => parseSexagesimal(str, false),
+ stringify: stringifySexagesimal
+};
+const timestamp = {
+ identify: value => value instanceof Date,
+ default: true,
+ tag: 'tag:yaml.org,2002:timestamp',
+ // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
+ // may be omitted altogether, resulting in a date format. In such a case, the time part is
+ // assumed to be 00:00:00Z (start of day, UTC).
+ test: RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
+ '(?:' + // time is optional
+ '(?:t|T|[ \\t]+)' + // t | T | whitespace
+ '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
+ '(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
+ ')?$'),
+ resolve(str) {
+ const match = str.match(timestamp.test);
+ if (!match)
+ throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');
+ const [, year, month, day, hour, minute, second] = match.map(Number);
+ const millisec = match[7] ? Number((match[7] + '00').substr(1, 3)) : 0;
+ let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
+ const tz = match[8];
+ if (tz && tz !== 'Z') {
+ let d = parseSexagesimal(tz, false);
+ if (Math.abs(d) < 30)
+ d *= 60;
+ date -= 60000 * d;
+ }
+ return new Date(date);
+ },
+ stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
+};
+
+export { floatTime, intTime, timestamp };