new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
var test = require('tap').test;
|
||||
var detective = require('../');
|
||||
var fs = require('fs');
|
||||
var src = [ 'require("a")\nreturn' ];
|
||||
|
||||
test('return', function (t) {
|
||||
t.plan(1);
|
||||
t.deepEqual(detective(src), [ 'a' ]);
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"devtools.js","sources":["../src/devtools.js","../src/index.js"],"sourcesContent":["import { options, Fragment, Component } from 'preact';\n\nexport function initDevTools() {\n\tif (typeof window != 'undefined' && window.__PREACT_DEVTOOLS__) {\n\t\twindow.__PREACT_DEVTOOLS__.attachPreact('10.12.1', options, {\n\t\t\tFragment,\n\t\t\tComponent\n\t\t});\n\t}\n}\n","import { options } from 'preact';\nimport { initDevTools } from './devtools';\n\ninitDevTools();\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, name: string) => T}\n */\nexport function addHookName(value, name) {\n\tif (options._addHookName) {\n\t\toptions._addHookName(name);\n\t}\n\treturn value;\n}\n"],"names":["window","__PREACT_DEVTOOLS__","attachPreact","options","Fragment","Component","value","name","__a"],"mappings":"wBAGsB,oBAAVA,QAAyBA,OAAOC,qBAC1CD,OAAOC,oBAAoBC,aAAa,UAAWC,EAAAA,QAAS,CAC3DC,SAAAA,EAAAA,SACAC,UAAAA,EAF2DA,gCCKvD,SAAqBC,EAAOC,GAIlC,OAHIJ,EAAAA,QAAsBK,KACzBL,EAAAA,QAAOK,IAAcD,GAEfD,CACP"}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { OperatorFunction, TruthyTypesOf } from '../types';
|
||||
export declare function find<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export declare function find<T, S extends T, A>(predicate: (this: A, value: T, index: number, source: Observable<T>) => value is S, thisArg: A): OperatorFunction<T, S | undefined>;
|
||||
export declare function find<T, S extends T>(predicate: (value: T, index: number, source: Observable<T>) => value is S): OperatorFunction<T, S | undefined>;
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export declare function find<T, A>(predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean, thisArg: A): OperatorFunction<T, T | undefined>;
|
||||
export declare function find<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, T | undefined>;
|
||||
export declare function createFind<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg: any, emit: 'value' | 'index'): (source: Observable<T>, subscriber: Subscriber<any>) => void;
|
||||
//# sourceMappingURL=find.d.ts.map
|
||||
@@ -0,0 +1,28 @@
|
||||
var toString = require('./toString');
|
||||
|
||||
/** Used to generate unique IDs. */
|
||||
var idCounter = 0;
|
||||
|
||||
/**
|
||||
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Util
|
||||
* @param {string} [prefix=''] The value to prefix the ID with.
|
||||
* @returns {string} Returns the unique ID.
|
||||
* @example
|
||||
*
|
||||
* _.uniqueId('contact_');
|
||||
* // => 'contact_104'
|
||||
*
|
||||
* _.uniqueId();
|
||||
* // => '105'
|
||||
*/
|
||||
function uniqueId(prefix) {
|
||||
var id = ++idCounter;
|
||||
return toString(prefix) + id;
|
||||
}
|
||||
|
||||
module.exports = uniqueId;
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"data-uri-to-buffer","version":"4.0.1","files":{"dist/index.js":{"checkedAt":1678883671426,"integrity":"sha512-tCLqpvmWOLL7/3leYvWn1wU9EI7F3a3Adc0ydBYhc14IKh16TUUzesMhjGJByIYttOwZbgqR0e3OOJmnFLiyJQ==","mode":420,"size":1852},"package.json":{"checkedAt":1678883671426,"integrity":"sha512-qh45XCDth3HGNYps8Du2x2JY68EIGiSvlnw9e/WhAtuwuKe/pnYX/db7npKPLM6nfQVfE5aaqjxs5C2kU1fQaw==","mode":420,"size":1350},"dist/index.js.map":{"checkedAt":1678883671426,"integrity":"sha512-V4tFX62UAhmlaBlB19IbfZTGkbAv5BiVHucMfWml9zh9cZEXHycA/Osq+UeWvfI+VjLqDyY3crZulLjzvCEsYg==","mode":420,"size":1697},"README.md":{"checkedAt":1678883671426,"integrity":"sha512-almGADI68wKoH5Ic/CpW5C5NIEfJ4eHajBkANzH8cjzZjbe1qTWwJ7xKReEAy9gEMMMFTTN0SxsAuTshlww2yA==","mode":420,"size":2926},"dist/index.d.ts":{"checkedAt":1678883671426,"integrity":"sha512-fMVO3z/hWIFjDT3vu2FD6oIOoGv01wr47xLZCb2wooVRu+RQqdXkEuQapHCFugZE7qDb1tdkbDM9jIxS91IEsA==","mode":420,"size":439},"src/index.ts":{"checkedAt":1678883671426,"integrity":"sha512-//UV2zpfnU158eXxw6rTgiqYSbasJ9CauIkE7z3cGaOYnXbZCJNClEBx3nuZQuVij27Bp6Epsi+zOt49zvi5Dg==","mode":420,"size":1785}}}
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[1257] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€<7F>‚<EFBFBD>„…†‡<E280A0>‰<EFBFBD>‹<EFBFBD>¨ˇ¸<CB87>‘’“”•–—<E28093>™<EFBFBD>›<EFBFBD>¯˛<C2AF> <EFBFBD>¢£¤<C2A3>¦§Ø©Ŗ«¬®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var validRegExp = require("../../valid-reg-exp");
|
||||
|
||||
module.exports = function (string) {
|
||||
validRegExp(this);
|
||||
return String(string).match(this);
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { EmptyError } from '../util/EmptyError';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function throwIfEmpty(errorFactory = defaultErrorFactory) {
|
||||
return operate((source, subscriber) => {
|
||||
let hasValue = false;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
hasValue = true;
|
||||
subscriber.next(value);
|
||||
}, () => (hasValue ? subscriber.complete() : subscriber.error(errorFactory()))));
|
||||
});
|
||||
}
|
||||
function defaultErrorFactory() {
|
||||
return new EmptyError();
|
||||
}
|
||||
//# sourceMappingURL=throwIfEmpty.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.02673,"74":0,"75":0,"76":0,"77":0,"78":0.00382,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0.00382,"97":0.00764,"98":0.03054,"99":0,"100":0.00382,"101":0,"102":0.00764,"103":0.00764,"104":0.03054,"105":0.00382,"106":0.00382,"107":0.00382,"108":0.02291,"109":0.2978,"110":0.21763,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00382,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.00382,"48":0,"49":0.01145,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0.00382,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.01527,"69":0.00382,"70":0,"71":0,"72":0,"73":0.01145,"74":0.01527,"75":0.00764,"76":0.01909,"77":0.00764,"78":0.00382,"79":0.04963,"80":0.00764,"81":0.01909,"83":0.01527,"84":0.00382,"85":0.00382,"86":0.00382,"87":0.05345,"88":0.00764,"89":0.00764,"90":0.00382,"91":0.00764,"92":0.01909,"93":0.01909,"94":0.00382,"95":0.01145,"96":0.01909,"97":0.01909,"98":0.01527,"99":0.01527,"100":0.01909,"101":0.02291,"102":0.01145,"103":0.042,"104":0.02291,"105":0.04963,"106":0.02673,"107":0.11836,"108":0.25962,"109":5.03594,"110":3.26439,"111":0.00764,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00764,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00382,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0.00764,"64":0,"65":0,"66":0.00382,"67":0.00764,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.084,"94":0.59561,"95":0.21381,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0.00382,"17":0,"18":0.00382,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00382,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.00382,"104":0.00382,"105":0.00382,"106":0.00382,"107":0.01527,"108":0.03054,"109":0.66051,"110":0.86669},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0.00382,"13":0.00764,"14":0.01527,"15":0.00382,_:"0","3.1":0,"3.2":0,"5.1":0.00382,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00382,"13.1":0.03436,"14.1":0.08018,"15.1":0.00764,"15.2-15.3":0.00764,"15.4":0.01909,"15.5":0.08018,"15.6":0.16799,"16.0":0.02673,"16.1":0.08781,"16.2":0.22144,"16.3":0.19854,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0.00828,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0.01657,"7.0-7.1":0.06296,"8.1-8.4":0.00663,"9.0-9.2":0,"9.3":0.08284,"10.0-10.2":0,"10.3":0.03645,"11.0-11.2":0.01325,"11.3-11.4":0.00331,"12.0-12.1":0.02982,"12.2-12.5":0.48377,"13.0-13.1":0.03313,"13.2":0.00166,"13.3":0.02485,"13.4-13.7":0.05136,"14.0-14.4":0.13751,"14.5-14.8":0.38602,"15.0-15.1":0.15573,"15.2-15.3":0.12094,"15.4":0.19881,"15.5":0.32969,"15.6":1.0189,"16.0":1.50599,"16.1":3.76911,"16.2":4.27773,"16.3":2.48512,"16.4":0.01491},P:{"4":0.23499,"20":1.23624,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.38824,"8.2":0,"9.2":0.02043,"10.1":0,"11.1-11.2":0.08173,"12.0":0.01022,"13.0":0.04087,"14.0":0.03065,"15.0":0.03065,"16.0":0.09195,"17.0":0.17369,"18.0":0.1839,"19.0":1.85947},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.02373,"4.2-4.3":0.02373,"4.4":0,"4.4.3-4.4.4":0.17799},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.00764,"9":0,"10":0,"11":0.03054,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.11746},H:{"0":0.35116},L:{"0":63.41959},R:{_:"0"},M:{"0":0.34619},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('omitBy', require('../omitBy'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2019-2022, Mariusz Nowak, @medikoo, medikoo.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var $byteLength = require('array-buffer-byte-length');
|
||||
|
||||
var isArrayBuffer = require('is-array-buffer');
|
||||
|
||||
var availableTypedArrays = require('available-typed-arrays')();
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-isdetachedbuffer
|
||||
|
||||
module.exports = function IsDetachedBuffer(arrayBuffer) {
|
||||
if (!isArrayBuffer(arrayBuffer)) {
|
||||
throw new $TypeError('Assertion failed: `arrayBuffer` must be an Object with an [[ArrayBufferData]] internal slot');
|
||||
}
|
||||
if ($byteLength(arrayBuffer) === 0) {
|
||||
try {
|
||||
new global[availableTypedArrays[0]](arrayBuffer); // eslint-disable-line no-new
|
||||
} catch (error) {
|
||||
return !!error && error.name === 'TypeError';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Promise=e()}}(function(){return function e(t,n,r){function o(u,s){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var a=n[u]={exports:{}};t[u][0].call(a.exports,function(e){var n=t[u][1][e];return o(n?n:e)},a,a.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){(function(e){"use strict";function n(){a=!0;for(var e,t,n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}a=!1}function r(e){1!==l.push(e)||a||o()}var o,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var u=0,s=new i(n),c=e.document.createTextNode("");s.observe(c,{characterData:!0}),o=function(){c.data=u=++u%2}}else if(e.setImmediate||"undefined"==typeof e.MessageChannel)o="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){n(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(n,0)};else{var f=new e.MessageChannel;f.port1.onmessage=n,o=function(){f.port2.postMessage(0)}}var a,l=[];t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";function r(){}function o(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=j,this.queue=[],this.outcome=void 0,e!==r&&c(this,e)}function i(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){d(function(){var r;try{r=t(n)}catch(t){return v.reject(e,t)}r===e?v.reject(e,new TypeError("Cannot resolve promise with itself")):v.resolve(e,r)})}function s(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function c(e,t){function n(t){i||(i=!0,v.reject(e,t))}function r(t){i||(i=!0,v.resolve(e,t))}function o(){t(r,n)}var i=!1,u=f(o);"error"===u.status&&n(u.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function a(e){return e instanceof this?e:v.resolve(new this(r),e)}function l(e){var t=new this(r);return v.reject(t,e)}function h(e){function t(e,t){function r(e){u[t]=e,++s!==o||i||(i=!0,v.resolve(f,u))}n.resolve(e).then(r,function(e){i||(i=!0,v.reject(f,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var o=e.length,i=!1;if(!o)return this.resolve([]);for(var u=new Array(o),s=0,c=-1,f=new this(r);++c<o;)t(e[c],c);return f}function p(e){function t(e){n.resolve(e).then(function(e){i||(i=!0,v.resolve(s,e))},function(e){i||(i=!0,v.reject(s,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var o=e.length,i=!1;if(!o)return this.resolve([]);for(var u=-1,s=new this(r);++u<o;)t(e[u]);return s}var d=e(1),v={},y=["REJECTED"],m=["FULFILLED"],j=["PENDING"];t.exports=o,o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){if("function"!=typeof e&&this.state===m||"function"!=typeof t&&this.state===y)return this;var n=new this.constructor(r);if(this.state!==j){var o=this.state===m?e:t;u(n,o,this.outcome)}else this.queue.push(new i(n,e,t));return n},i.prototype.callFulfilled=function(e){v.resolve(this.promise,e)},i.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},i.prototype.callRejected=function(e){v.reject(this.promise,e)},i.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},v.resolve=function(e,t){var n=f(s,t);if("error"===n.status)return v.reject(e,n.value);var r=n.value;if(r)c(e,r);else{e.state=m,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},v.reject=function(e,t){e.state=y,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},o.resolve=a,o.reject=l,o.all=h,o.race=p},{1:1}]},{},[2])(2)});
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('curryN', require('../curry'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Immediate.js","sourceRoot":"","sources":["../../../../src/internal/util/Immediate.ts"],"names":[],"mappings":"AAAA,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,IAAI,QAAsB,CAAC;AAC3B,MAAM,aAAa,GAA2B,EAAE,CAAC;AAOjD,SAAS,kBAAkB,CAAC,MAAc;IACxC,IAAI,MAAM,IAAI,aAAa,EAAE;QAC3B,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAKD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,CAAC,EAAc;QACzB,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;QAC5B,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;SAC9B;QACD,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,cAAc,CAAC,MAAc;QAC3B,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC;AAKF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO;QACL,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC;IAC3C,CAAC;CACF,CAAC"}
|
||||
@@ -0,0 +1,2 @@
|
||||
export declare function trim_start(str: string): string;
|
||||
export declare function trim_end(str: string): string;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AnimationFrameScheduler.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/AnimationFrameScheduler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,uBAAwB,SAAQ,cAAc;IAClD,KAAK,CAAC,MAAyB;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAUpB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACzB,IAAI,KAAU,CAAC;QACf,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,KAAK,EAAG,CAAC;QAEpC,GAAG;YACD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;gBACxD,MAAM;aACP;SACF,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE;QAE5E,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE;gBACxE,MAAM,CAAC,WAAW,EAAE,CAAC;aACtB;YACD,MAAM,KAAK,CAAC;SACb;IACH,CAAC;CACF"}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function () {
|
||||
var isSafeInteger = Number.isSafeInteger;
|
||||
if (typeof isSafeInteger !== "function") return false;
|
||||
return !isSafeInteger("23") && isSafeInteger(34232322323) && !isSafeInteger(9007199254740992);
|
||||
};
|
||||
@@ -0,0 +1,76 @@
|
||||
import type { CreateSelfServiceCitizenRunner } from '../models/CreateSelfServiceCitizenRunner';
|
||||
import type { CreateSelfServiceRunner } from '../models/CreateSelfServiceRunner';
|
||||
import type { ResponseScanStation } from '../models/ResponseScanStation';
|
||||
import type { ResponseSelfServiceOrganisation } from '../models/ResponseSelfServiceOrganisation';
|
||||
import type { ResponseSelfServiceRunner } from '../models/ResponseSelfServiceRunner';
|
||||
import type { ResponseSelfServiceScan } from '../models/ResponseSelfServiceScan';
|
||||
export declare class RunnerSelfService {
|
||||
/**
|
||||
* Get
|
||||
* Lists all information about yourself. <br> Please provide your runner jwt(that code we gave you during registration) for auth. <br> If you lost your jwt/personalized link please use the forgot endpoint.
|
||||
* @param jwt
|
||||
* @result ResponseSelfServiceRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerGet(jwt: string): Promise<ResponseSelfServiceRunner>;
|
||||
/**
|
||||
* Remove
|
||||
* Deletes all information about yourself. <br> Please provide your runner jwt(that code we gave you during registration) for auth. <br> If you lost your jwt/personalized link please use the forgot endpoint.
|
||||
* @param jwt
|
||||
* @param force
|
||||
* @result ResponseSelfServiceRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerRemove(jwt: string, force?: boolean): Promise<ResponseSelfServiceRunner>;
|
||||
/**
|
||||
* Get scans
|
||||
* Lists all your (runner) scans. <br> Please provide your runner jwt(that code we gave you during registration) for auth. <br> If you lost your jwt/personalized link please contact support.
|
||||
* @param jwt
|
||||
* @result ResponseSelfServiceScan
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerGetScans(jwt: string): Promise<Array<ResponseSelfServiceScan>>;
|
||||
/**
|
||||
* Get station me
|
||||
* Lists basic information about the station whose token got provided. <br> This includes it's associated track.
|
||||
* @result ResponseScanStation
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerGetStationMe(): Promise<ResponseScanStation>;
|
||||
/**
|
||||
* Request new token
|
||||
* Use this endpoint to reuqest a new selfservice magic-login-link to be sent to your mail address (rate limited to one mail every 15mins).
|
||||
* @param mail
|
||||
* @param locale
|
||||
* @result any Successful response
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerRequestNewToken(mail?: string, locale?: string): Promise<any>;
|
||||
/**
|
||||
* Register runner
|
||||
* Create a new selfservice runner in the citizen org. <br> This endpoint shoud be used to allow "everyday citizen" to register themselves. <br> You have to provide a mail address, b/c the future we'll implement email verification.
|
||||
* @param locale
|
||||
* @param requestBody CreateSelfServiceCitizenRunner
|
||||
* @result ResponseSelfServiceRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerRegisterRunner(locale?: string, requestBody?: CreateSelfServiceCitizenRunner): Promise<ResponseSelfServiceRunner>;
|
||||
/**
|
||||
* Register organization runner
|
||||
* Create a new selfservice runner in a provided org. <br> The orgs get provided and authorized via api tokens that can be optained via the /organizations endpoint.
|
||||
* @param token
|
||||
* @param locale
|
||||
* @param requestBody CreateSelfServiceRunner
|
||||
* @result ResponseSelfServiceRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerRegisterOrganizationRunner(token: string, locale?: string, requestBody?: CreateSelfServiceRunner): Promise<ResponseSelfServiceRunner>;
|
||||
/**
|
||||
* Get selfservice org
|
||||
* Get the basic info and teams for a org.
|
||||
* @param token
|
||||
* @result ResponseSelfServiceOrganisation
|
||||
* @throws ApiError
|
||||
*/
|
||||
static runnerSelfServiceControllerGetSelfserviceOrg(token: string): Promise<ResponseSelfServiceOrganisation>;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import Settings from '../../settings';
|
||||
import { EntryTransformerFunction } from '../../types';
|
||||
export default class EntryTransformer {
|
||||
private readonly _settings;
|
||||
constructor(_settings: Settings);
|
||||
getTransformer(): EntryTransformerFunction;
|
||||
private _transform;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import type {IsEqual} from './internal';
|
||||
|
||||
/**
|
||||
Returns a boolean for whether the given array includes the given item.
|
||||
|
||||
This can be useful if another type wants to make a decision based on whether the array includes that item.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Includes} from 'type-fest';
|
||||
|
||||
type hasRed<array extends any[]> = Includes<array, 'red'>;
|
||||
```
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type Includes<Value extends readonly any[], Item> =
|
||||
Value extends readonly [Value[0], ...infer rest]
|
||||
? IsEqual<Value[0], Item> extends true
|
||||
? true
|
||||
: Includes<rest, Item>
|
||||
: false;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AsapScheduler.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/AsapScheduler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,mDAAkD;AAElD;IAAmC,iCAAc;IAAjD;;IAkCA,CAAC;IAjCQ,6BAAK,GAAZ,UAAa,MAAyB;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAUpB,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAEpB,IAAA,OAAO,GAAK,IAAI,QAAT,CAAU;QACzB,IAAI,KAAU,CAAC;QACf,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,KAAK,EAAG,CAAC;QAEpC,GAAG;YACD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;gBACxD,MAAM;aACP;SACF,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE;QAE5E,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE;gBACxE,MAAM,CAAC,WAAW,EAAE,CAAC;aACtB;YACD,MAAM,KAAK,CAAC;SACb;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAlCD,CAAmC,+BAAc,GAkChD;AAlCY,sCAAa"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"distinctUntilKeyChanged.js","sourceRoot":"","sources":["../../../../src/internal/operators/distinctUntilKeyChanged.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAoE9D,MAAM,UAAU,uBAAuB,CAAuB,GAAM,EAAE,OAAuC;IAC3G,OAAO,oBAAoB,CAAC,CAAC,CAAI,EAAE,CAAI,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACrG,CAAC"}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "is-utf8",
|
||||
"version": "0.2.1",
|
||||
"description": "Detect if a buffer is utf8 encoded.",
|
||||
"main": "is-utf8.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": "https://github.com/wayfind/is-utf8.git",
|
||||
"keywords": [
|
||||
"utf8",
|
||||
"charset"
|
||||
],
|
||||
"files": [
|
||||
"is-utf8.js"
|
||||
],
|
||||
"author": "wayfind",
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
var url = require('url');
|
||||
|
||||
var override = require('../utils/override');
|
||||
|
||||
function inlineRequestFrom(option) {
|
||||
return override(
|
||||
/* jshint camelcase: false */
|
||||
proxyOptionsFrom(process.env.HTTP_PROXY || process.env.http_proxy),
|
||||
option || {}
|
||||
);
|
||||
}
|
||||
|
||||
function proxyOptionsFrom(httpProxy) {
|
||||
return httpProxy ?
|
||||
{
|
||||
hostname: url.parse(httpProxy).hostname,
|
||||
port: parseInt(url.parse(httpProxy).port)
|
||||
} :
|
||||
{};
|
||||
}
|
||||
|
||||
module.exports = inlineRequestFrom;
|
||||
@@ -0,0 +1,310 @@
|
||||
const {
|
||||
noopTest,
|
||||
edit,
|
||||
merge
|
||||
} = require('./helpers.js');
|
||||
|
||||
/**
|
||||
* Block-Level Grammar
|
||||
*/
|
||||
const block = {
|
||||
newline: /^(?: *(?:\n|$))+/,
|
||||
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
||||
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
|
||||
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
|
||||
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
||||
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
||||
list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,
|
||||
html: '^ {0,3}(?:' // optional indentation
|
||||
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
||||
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
||||
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
||||
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
||||
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
||||
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
|
||||
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
|
||||
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
|
||||
+ ')',
|
||||
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
|
||||
nptable: noopTest,
|
||||
table: noopTest,
|
||||
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
||||
// regex template, placeholders will be replaced according to different paragraph
|
||||
// interruption rules of commonmark and the original markdown spec:
|
||||
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,
|
||||
text: /^[^\n]+/
|
||||
};
|
||||
|
||||
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
|
||||
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
||||
block.def = edit(block.def)
|
||||
.replace('label', block._label)
|
||||
.replace('title', block._title)
|
||||
.getRegex();
|
||||
|
||||
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
||||
block.item = /^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/;
|
||||
block.item = edit(block.item, 'gm')
|
||||
.replace(/bull/g, block.bullet)
|
||||
.getRegex();
|
||||
|
||||
block.listItemStart = edit(/^( *)(bull) */)
|
||||
.replace('bull', block.bullet)
|
||||
.getRegex();
|
||||
|
||||
block.list = edit(block.list)
|
||||
.replace(/bull/g, block.bullet)
|
||||
.replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
|
||||
.replace('def', '\\n+(?=' + block.def.source + ')')
|
||||
.getRegex();
|
||||
|
||||
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
||||
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
||||
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
||||
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
||||
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
|
||||
+ '|track|ul';
|
||||
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
||||
block.html = edit(block.html, 'i')
|
||||
.replace('comment', block._comment)
|
||||
.replace('tag', block._tag)
|
||||
.replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
|
||||
.getRegex();
|
||||
|
||||
block.paragraph = edit(block._paragraph)
|
||||
.replace('hr', block.hr)
|
||||
.replace('heading', ' {0,3}#{1,6} ')
|
||||
.replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
|
||||
.replace('blockquote', ' {0,3}>')
|
||||
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
||||
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
||||
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
|
||||
.replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
||||
.getRegex();
|
||||
|
||||
block.blockquote = edit(block.blockquote)
|
||||
.replace('paragraph', block.paragraph)
|
||||
.getRegex();
|
||||
|
||||
/**
|
||||
* Normal Block Grammar
|
||||
*/
|
||||
|
||||
block.normal = merge({}, block);
|
||||
|
||||
/**
|
||||
* GFM Block Grammar
|
||||
*/
|
||||
|
||||
block.gfm = merge({}, block.normal, {
|
||||
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
|
||||
+ ' {0,3}([-:]+ *\\|[-| :]*)' // Align
|
||||
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)', // Cells
|
||||
table: '^ *\\|(.+)\\n' // Header
|
||||
+ ' {0,3}\\|?( *[-:]+[-| :]*)' // Align
|
||||
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
||||
});
|
||||
|
||||
block.gfm.nptable = edit(block.gfm.nptable)
|
||||
.replace('hr', block.hr)
|
||||
.replace('heading', ' {0,3}#{1,6} ')
|
||||
.replace('blockquote', ' {0,3}>')
|
||||
.replace('code', ' {4}[^\\n]')
|
||||
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
||||
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
||||
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
|
||||
.replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
||||
.getRegex();
|
||||
|
||||
block.gfm.table = edit(block.gfm.table)
|
||||
.replace('hr', block.hr)
|
||||
.replace('heading', ' {0,3}#{1,6} ')
|
||||
.replace('blockquote', ' {0,3}>')
|
||||
.replace('code', ' {4}[^\\n]')
|
||||
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
||||
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
||||
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
|
||||
.replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
||||
.getRegex();
|
||||
|
||||
/**
|
||||
* Pedantic grammar (original John Gruber's loose markdown specification)
|
||||
*/
|
||||
|
||||
block.pedantic = merge({}, block.normal, {
|
||||
html: edit(
|
||||
'^ *(?:comment *(?:\\n|\\s*$)'
|
||||
+ '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
||||
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
|
||||
.replace('comment', block._comment)
|
||||
.replace(/tag/g, '(?!(?:'
|
||||
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
|
||||
+ '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
|
||||
+ '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
|
||||
.getRegex(),
|
||||
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
||||
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
||||
fences: noopTest, // fences not supported
|
||||
paragraph: edit(block.normal._paragraph)
|
||||
.replace('hr', block.hr)
|
||||
.replace('heading', ' *#{1,6} *[^\n]')
|
||||
.replace('lheading', block.lheading)
|
||||
.replace('blockquote', ' {0,3}>')
|
||||
.replace('|fences', '')
|
||||
.replace('|list', '')
|
||||
.replace('|html', '')
|
||||
.getRegex()
|
||||
});
|
||||
|
||||
/**
|
||||
* Inline-Level Grammar
|
||||
*/
|
||||
const inline = {
|
||||
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
||||
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
||||
url: noopTest,
|
||||
tag: '^comment'
|
||||
+ '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
||||
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
||||
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
||||
+ '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
|
||||
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>', // CDATA section
|
||||
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
||||
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
|
||||
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
|
||||
reflinkSearch: 'reflink|nolink(?!\\()',
|
||||
emStrong: {
|
||||
lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
|
||||
// (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
|
||||
// () Skip other delimiter (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
|
||||
rDelimAst: /\_\_[^_]*?\*[^_]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
|
||||
rDelimUnd: /\*\*[^*]*?\_[^*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
|
||||
},
|
||||
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
||||
br: /^( {2,}|\\)\n(?!\s*$)/,
|
||||
del: noopTest,
|
||||
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
||||
punctuation: /^([\spunctuation])/
|
||||
};
|
||||
|
||||
// list of punctuation marks from CommonMark spec
|
||||
// without * and _ to handle the different emphasis markers * and _
|
||||
inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
||||
inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
|
||||
// sequences em should skip over [title](link), `code`, <html>
|
||||
inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
||||
inline.escapedEmSt = /\\\*|\\_/g;
|
||||
|
||||
inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
||||
|
||||
inline.emStrong.lDelim = edit(inline.emStrong.lDelim)
|
||||
.replace(/punct/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g')
|
||||
.replace(/punct/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g')
|
||||
.replace(/punct/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
||||
|
||||
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
||||
inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
|
||||
inline.autolink = edit(inline.autolink)
|
||||
.replace('scheme', inline._scheme)
|
||||
.replace('email', inline._email)
|
||||
.getRegex();
|
||||
|
||||
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
||||
|
||||
inline.tag = edit(inline.tag)
|
||||
.replace('comment', inline._comment)
|
||||
.replace('attribute', inline._attribute)
|
||||
.getRegex();
|
||||
|
||||
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
||||
inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
||||
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
||||
|
||||
inline.link = edit(inline.link)
|
||||
.replace('label', inline._label)
|
||||
.replace('href', inline._href)
|
||||
.replace('title', inline._title)
|
||||
.getRegex();
|
||||
|
||||
inline.reflink = edit(inline.reflink)
|
||||
.replace('label', inline._label)
|
||||
.getRegex();
|
||||
|
||||
inline.reflinkSearch = edit(inline.reflinkSearch, 'g')
|
||||
.replace('reflink', inline.reflink)
|
||||
.replace('nolink', inline.nolink)
|
||||
.getRegex();
|
||||
|
||||
/**
|
||||
* Normal Inline Grammar
|
||||
*/
|
||||
|
||||
inline.normal = merge({}, inline);
|
||||
|
||||
/**
|
||||
* Pedantic Inline Grammar
|
||||
*/
|
||||
|
||||
inline.pedantic = merge({}, inline.normal, {
|
||||
strong: {
|
||||
start: /^__|\*\*/,
|
||||
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
||||
endAst: /\*\*(?!\*)/g,
|
||||
endUnd: /__(?!_)/g
|
||||
},
|
||||
em: {
|
||||
start: /^_|\*/,
|
||||
middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
|
||||
endAst: /\*(?!\*)/g,
|
||||
endUnd: /_(?!_)/g
|
||||
},
|
||||
link: edit(/^!?\[(label)\]\((.*?)\)/)
|
||||
.replace('label', inline._label)
|
||||
.getRegex(),
|
||||
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
||||
.replace('label', inline._label)
|
||||
.getRegex()
|
||||
});
|
||||
|
||||
/**
|
||||
* GFM Inline Grammar
|
||||
*/
|
||||
|
||||
inline.gfm = merge({}, inline.normal, {
|
||||
escape: edit(inline.escape).replace('])', '~|])').getRegex(),
|
||||
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
||||
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
||||
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
||||
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
||||
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
||||
});
|
||||
|
||||
inline.gfm.url = edit(inline.gfm.url, 'i')
|
||||
.replace('email', inline.gfm._extended_email)
|
||||
.getRegex();
|
||||
/**
|
||||
* GFM + Line Breaks Inline Grammar
|
||||
*/
|
||||
|
||||
inline.breaks = merge({}, inline.gfm, {
|
||||
br: edit(inline.br).replace('{2,}', '*').getRegex(),
|
||||
text: edit(inline.gfm.text)
|
||||
.replace('\\b_', '\\b_| {2,}\\n')
|
||||
.replace(/\{2,\}/g, '*')
|
||||
.getRegex()
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
block,
|
||||
inline
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BorderRadius extends Declaration {
|
||||
/**
|
||||
* Change syntax, when add Mozilla prefix
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prefix === '-moz-') {
|
||||
return prefix + (BorderRadius.toMozilla[prop] || prop)
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return BorderRadius.toNormal[prop] || prop
|
||||
}
|
||||
}
|
||||
|
||||
BorderRadius.names = ['border-radius']
|
||||
|
||||
BorderRadius.toMozilla = {}
|
||||
BorderRadius.toNormal = {}
|
||||
|
||||
for (let ver of ['top', 'bottom']) {
|
||||
for (let hor of ['left', 'right']) {
|
||||
let normal = `border-${ver}-${hor}-radius`
|
||||
let mozilla = `border-radius-${ver}${hor}`
|
||||
|
||||
BorderRadius.names.push(normal)
|
||||
BorderRadius.names.push(mozilla)
|
||||
|
||||
BorderRadius.toMozilla[normal] = mozilla
|
||||
BorderRadius.toNormal[mozilla] = normal
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BorderRadius
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('trimStart', require('../trimStart'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,21 @@
|
||||
var isArray = require('./isArray'),
|
||||
isKey = require('./_isKey'),
|
||||
stringToPath = require('./_stringToPath'),
|
||||
toString = require('./toString');
|
||||
|
||||
/**
|
||||
* Casts `value` to a path array if it's not one.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to inspect.
|
||||
* @param {Object} [object] The object to query keys on.
|
||||
* @returns {Array} Returns the cast property path array.
|
||||
*/
|
||||
function castPath(value, object) {
|
||||
if (isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
||||
}
|
||||
|
||||
module.exports = castPath;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00156,"39":0,"40":0,"41":0,"42":0,"43":0.00156,"44":0.00156,"45":0,"46":0,"47":0.00156,"48":0.00156,"49":0,"50":0,"51":0,"52":0.00156,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0.00156,"78":0.00156,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0.00156,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.00468,"103":0.00624,"104":0.00156,"105":0,"106":0.02027,"107":0.01247,"108":0.00312,"109":0.1216,"110":0.03118,"111":0.01403,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0.00312,"38":0.00156,"39":0,"40":0.00468,"41":0,"42":0,"43":0.00156,"44":0,"45":0,"46":0.00935,"47":0,"48":0,"49":0,"50":0.00156,"51":0,"52":0,"53":0.01559,"54":0,"55":0,"56":0,"57":0,"58":0.00156,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0.00312,"65":0,"66":0,"67":0,"68":0.00156,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.00156,"75":0,"76":0,"77":0,"78":0,"79":0.14966,"80":0.00624,"81":0.01247,"83":0.00156,"84":0,"85":0.00156,"86":0.00156,"87":0,"88":0,"89":0.00312,"90":0,"91":0,"92":0.00312,"93":0,"94":0.00312,"95":0.00468,"96":0.00156,"97":0,"98":0.01715,"99":0.00156,"100":0.00156,"101":0.00156,"102":0.00312,"103":0.00312,"104":0.00156,"105":0.00624,"106":0.0078,"107":0.00624,"108":0.01403,"109":0.49264,"110":0.26659,"111":0.02962,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0.00156,"28":0.02027,"29":0.00156,"30":0.00156,"31":0,"32":0.00468,"33":0.00156,"34":0,"35":0,"36":0,"37":0,"38":0.00468,"39":0,"40":0,"41":0,"42":0.00156,"43":0,"44":0,"45":0,"46":0.00312,"47":0,"48":0,"49":0,"50":0.00312,"51":0.00312,"52":0,"53":0,"54":0.00312,"55":0,"56":0,"57":0,"58":0,"60":0.01871,"62":0,"63":0.00312,"64":0.00156,"65":0.00156,"66":0.00624,"67":0.07327,"68":0,"69":0,"70":0.00468,"71":0.00156,"72":0.00624,"73":0,"74":0.00156,"75":0,"76":0,"77":0,"78":0,"79":0.00156,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0.06704,"95":0.03118,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.0265},B:{"12":0.00312,"13":0,"14":0.00156,"15":0,"16":0.00156,"17":0.00156,"18":0.00156,"79":0,"80":0,"81":0,"83":0,"84":0.02339,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.00156,"91":0,"92":0.00312,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0.00156,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00156,"106":0,"107":0.00156,"108":0.00468,"109":0.09042,"110":0.08107},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0,"14.1":0,"15.1":0,"15.2-15.3":0,"15.4":0,"15.5":0,"15.6":0.00156,"16.0":0,"16.1":0,"16.2":0,"16.3":0,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.04429,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.04296,"10.0-10.2":0,"10.3":0.0141,"11.0-11.2":0.00253,"11.3-11.4":0.01476,"12.0-12.1":0.0411,"12.2-12.5":0.44344,"13.0-13.1":0,"13.2":0.01277,"13.3":0.02367,"13.4-13.7":0.07954,"14.0-14.4":0.01343,"14.5-14.8":0.16679,"15.0-15.1":0.06424,"15.2-15.3":0.0814,"15.4":0.00705,"15.5":0.01091,"15.6":0.01543,"16.0":0.01929,"16.1":0.03019,"16.2":0.0661,"16.3":0.06225,"16.4":0},P:{"4":0.87233,"20":0.06086,"5.0-5.4":0.14201,"6.2-6.4":0.01014,"7.2-7.4":0.5376,"8.2":0,"9.2":0.01014,"10.1":0,"11.1-11.2":0.06086,"12.0":0,"13.0":0.03043,"14.0":0.02029,"15.0":0.01014,"16.0":0.08115,"17.0":0.10143,"18.0":0.03043,"19.0":0.44631},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00343,"4.2-4.3":0.05018,"4.4":0,"4.4.3-4.4.4":0.31886},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00312,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.01688,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":1.67132},H:{"0":8.40695},L:{"0":80.75603},R:{_:"0"},M:{"0":0.15194},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,24 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,66 @@
|
||||
# iterate-iterator <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Iterate any iterable JS iterator. Works robustly in all environments, all versions.
|
||||
|
||||
In modern engines, `[...value]` or `Array.from(value)` or `for (const item of value) { }` are sufficient to iterate an iterable value (an object with a `Symbol.iterator` method), which includes all builtin iterators. However, older engines:
|
||||
- may lack `Symbol`, array spread, or `for..of` support altogether
|
||||
- may have `Symbol.iterator` but not implement it on everything it should, like arguments objects
|
||||
- may have `Map` and `Set`, but a non-standard name for the iterator-producing method (`.iterator` or `['@@iterator']`, eg) and no syntax to support it
|
||||
- may be old versions of Firefox that produce values until they throw a StopIteration exception, rather than having iteration result objects
|
||||
- may be polyfilled/shimmed/shammed, with `es6-shim` or `core-js` or similar
|
||||
|
||||
This library simplifies iterating an iterator object, so no loops are required.
|
||||
|
||||
If called with a single iterator, it will return an array of the yielded values. If also called with a callback function, it will instead call that callback once for each yielded value.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var iterate = require('iterate-iterator');
|
||||
var getIterator = require('es-get-iterator');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.deepEqual(iterate(getIterator('a 💩')), ['a', ' ', '💩']);
|
||||
assert.deepEqual(iterate(getIterator([1, 2])), [1, 2]);
|
||||
assert.deepEqual(iterate(getIterator(new Set([1, 2]))), [1, 2]);
|
||||
assert.deepEqual(iterate(getIterator(new Map([[1, 2], [3, 4]]))), [[1, 2], [3, 4]]);
|
||||
|
||||
function assertWithCallback(iterable, expected) {
|
||||
var values = [];
|
||||
var callback = function (x) { values.push(x); };
|
||||
iterate(iterable, callback);
|
||||
assert.deepEqual(values, expected);
|
||||
}
|
||||
assertWithCallback(getIterator('a 💩'), ['a', ' ', '💩']);
|
||||
assertWithCallback(getIterator([1, 2]), [1, 2]);
|
||||
assertWithCallback(getIterator(new Set([1, 2])), [1, 2]);
|
||||
assertWithCallback(getIterator(new Map([[1, 2], [3, 4]])), [[1, 2], [3, 4]]);
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/iterate-iterator
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/iterate-iterator.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/iterate-iterator.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/iterate-iterator
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/iterate-iterator/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/iterate-iterator#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/iterate-iterator.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/iterate-iterator.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/iterate-iterator.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=iterate-iterator
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/iterate-iterator/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/iterate-iterator/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/iterate-iterator
|
||||
[actions-url]: https://github.com/ljharb/iterate-iterator/actions
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('max', require('../max'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../../src/internal/Observable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAgB,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD;IAkBE,oBAAY,SAA6E;QACvF,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;SAC7B;IACH,CAAC;IA4BD,yBAAI,GAAJ,UAAQ,QAAyB;QAC/B,IAAM,UAAU,GAAG,IAAI,UAAU,EAAK,CAAC;QACvC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC;QACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,OAAO,UAAU,CAAC;IACpB,CAAC;IA6ID,8BAAS,GAAT,UACE,cAAmE,EACnE,KAAqC,EACrC,QAA8B;QAHhC,iBA0BC;QArBC,IAAM,UAAU,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,cAAc,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAEvH,YAAY,CAAC;YACL,IAAA,KAAuB,KAAI,EAAzB,QAAQ,cAAA,EAAE,MAAM,YAAS,CAAC;YAClC,UAAU,CAAC,GAAG,CACZ,QAAQ;gBACN,CAAC;oBAEC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;gBACnC,CAAC,CAAC,MAAM;oBACR,CAAC;wBAGC,KAAI,CAAC,UAAU,CAAC,UAAU,CAAC;oBAC7B,CAAC;wBAEC,KAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CACnC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;IAGS,kCAAa,GAAvB,UAAwB,IAAmB;QACzC,IAAI;YACF,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC9B;QAAC,OAAO,GAAG,EAAE;YAIZ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACjB;IACH,CAAC;IA6DD,4BAAO,GAAP,UAAQ,IAAwB,EAAE,WAAoC;QAAtE,iBAkBC;QAjBC,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;QAE1C,OAAO,IAAI,WAAW,CAAO,UAAC,OAAO,EAAE,MAAM;YAC3C,IAAM,UAAU,GAAG,IAAI,cAAc,CAAI;gBACvC,IAAI,EAAE,UAAC,KAAK;oBACV,IAAI;wBACF,IAAI,CAAC,KAAK,CAAC,CAAC;qBACb;oBAAC,OAAO,GAAG,EAAE;wBACZ,MAAM,CAAC,GAAG,CAAC,CAAC;wBACZ,UAAU,CAAC,WAAW,EAAE,CAAC;qBAC1B;gBACH,CAAC;gBACD,KAAK,EAAE,MAAM;gBACb,QAAQ,EAAE,OAAO;aAClB,CAAC,CAAC;YACH,KAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC7B,CAAC,CAAkB,CAAC;IACtB,CAAC;IAGS,+BAAU,GAApB,UAAqB,UAA2B;;QAC9C,OAAO,MAAA,IAAI,CAAC,MAAM,0CAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAOD,qBAAC,iBAAiB,CAAC,GAAnB;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IA4FD,yBAAI,GAAJ;QAAK,oBAA2C;aAA3C,UAA2C,EAA3C,qBAA2C,EAA3C,IAA2C;YAA3C,+BAA2C;;QAC9C,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IA6BD,8BAAS,GAAT,UAAU,WAAoC;QAA9C,iBAWC;QAVC,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;QAE1C,OAAO,IAAI,WAAW,CAAC,UAAC,OAAO,EAAE,MAAM;YACrC,IAAI,KAAoB,CAAC;YACzB,KAAI,CAAC,SAAS,CACZ,UAAC,CAAI,IAAK,OAAA,CAAC,KAAK,GAAG,CAAC,CAAC,EAAX,CAAW,EACrB,UAAC,GAAQ,IAAK,OAAA,MAAM,CAAC,GAAG,CAAC,EAAX,CAAW,EACzB,cAAM,OAAA,OAAO,CAAC,KAAK,CAAC,EAAd,CAAc,CACrB,CAAC;QACJ,CAAC,CAA2B,CAAC;IAC/B,CAAC;IA1aM,iBAAM,GAA4B,UAAI,SAAwD;QACnG,OAAO,IAAI,UAAU,CAAI,SAAS,CAAC,CAAC;IACtC,CAAC,CAAC;IAyaJ,iBAAC;CAAA,AA9cD,IA8cC;SA9cY,UAAU;AAudvB,SAAS,cAAc,CAAC,WAA+C;;IACrE,OAAO,MAAA,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,MAAM,CAAC,OAAO,mCAAI,OAAO,CAAC;AAClD,CAAC;AAED,SAAS,UAAU,CAAI,KAAU;IAC/B,OAAO,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,YAAY,CAAI,KAAU;IACjC,OAAO,CAAC,KAAK,IAAI,KAAK,YAAY,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;AAChG,CAAC"}
|
||||
@@ -0,0 +1,130 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [7.0.3](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.2...v7.0.3) (2020-05-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* detect path key based on correct environment ([#133](https://github.com/moxystudio/node-cross-spawn/issues/133)) ([159e7e9](https://github.com/moxystudio/node-cross-spawn/commit/159e7e9785e57451cba034ae51719f97135074ae))
|
||||
|
||||
### [7.0.2](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.1...v7.0.2) (2020-04-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix worker threads in Node >=11.10.0 ([#132](https://github.com/moxystudio/node-cross-spawn/issues/132)) ([6c5b4f0](https://github.com/moxystudio/node-cross-spawn/commit/6c5b4f015814a6c4f6b33230dfd1a860aedc0aaf))
|
||||
|
||||
### [7.0.1](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.0...v7.0.1) (2019-10-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core:** support worker threads ([#127](https://github.com/moxystudio/node-cross-spawn/issues/127)) ([cfd49c9](https://github.com/moxystudio/node-cross-spawn/commit/cfd49c9))
|
||||
|
||||
## [7.0.0](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.5...v7.0.0) (2019-09-03)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* drop support for Node.js < 8
|
||||
|
||||
* drop support for versions below Node.js 8 ([#125](https://github.com/moxystudio/node-cross-spawn/issues/125)) ([16feb53](https://github.com/moxystudio/node-cross-spawn/commit/16feb53))
|
||||
|
||||
<a name="6.0.5"></a>
|
||||
## [6.0.5](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.4...v6.0.5) (2018-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* avoid using deprecated Buffer constructor ([#94](https://github.com/moxystudio/node-cross-spawn/issues/94)) ([d5770df](https://github.com/moxystudio/node-cross-spawn/commit/d5770df)), closes [/nodejs.org/api/deprecations.html#deprecations_dep0005](https://github.com//nodejs.org/api/deprecations.html/issues/deprecations_dep0005)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.4"></a>
|
||||
## [6.0.4](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.3...v6.0.4) (2018-01-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix paths being incorrectly normalized on unix ([06ee3c6](https://github.com/moxystudio/node-cross-spawn/commit/06ee3c6)), closes [#90](https://github.com/moxystudio/node-cross-spawn/issues/90)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.3"></a>
|
||||
## [6.0.3](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.2...v6.0.3) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.2"></a>
|
||||
## [6.0.2](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.1...v6.0.2) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.1"></a>
|
||||
## [6.0.1](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.0...v6.0.1) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.0"></a>
|
||||
# [6.0.0](https://github.com/moxystudio/node-cross-spawn/compare/5.1.0...6.0.0) (2018-01-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix certain arguments not being correctly escaped or causing batch syntax error ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10)), closes [#82](https://github.com/moxystudio/node-cross-spawn/issues/82) [#51](https://github.com/moxystudio/node-cross-spawn/issues/51)
|
||||
* fix commands as posix relatixe paths not working correctly, e.g.: `./my-command` ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* fix `options` argument being mutated ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* fix commands resolution when PATH was actually Path ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improve compliance with node's ENOENT errors ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* improve detection of node's shell option support ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade tooling
|
||||
* upgrate project to es6 (node v4)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* remove support for older nodejs versions, only `node >= 4` is supported
|
||||
|
||||
|
||||
<a name="5.1.0"></a>
|
||||
## [5.1.0](https://github.com/moxystudio/node-cross-spawn/compare/5.0.1...5.1.0) (2017-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix `options.shell` support for NodeJS [v4.8](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V4.md#4.8.0)
|
||||
|
||||
|
||||
<a name="5.0.1"></a>
|
||||
## [5.0.1](https://github.com/moxystudio/node-cross-spawn/compare/5.0.0...5.0.1) (2016-11-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix `options.shell` support for NodeJS v7
|
||||
|
||||
|
||||
<a name="5.0.0"></a>
|
||||
# [5.0.0](https://github.com/moxystudio/node-cross-spawn/compare/4.0.2...5.0.0) (2016-10-30)
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* add support for `options.shell`
|
||||
* improve parsing of shebangs by using [`shebang-command`](https://github.com/kevva/shebang-command) module
|
||||
|
||||
|
||||
## Chores
|
||||
|
||||
* refactor some code to make it more clear
|
||||
* update README caveats
|
||||
@@ -0,0 +1,17 @@
|
||||
import assertString from './util/assertString';
|
||||
import toString from './util/toString';
|
||||
import merge from './util/merge';
|
||||
var defaulContainsOptions = {
|
||||
ignoreCase: false,
|
||||
minOccurrences: 1
|
||||
};
|
||||
export default function contains(str, elem, options) {
|
||||
assertString(str);
|
||||
options = merge(options, defaulContainsOptions);
|
||||
|
||||
if (options.ignoreCase) {
|
||||
return str.toLowerCase().split(toString(elem).toLowerCase()).length > options.minOccurrences;
|
||||
}
|
||||
|
||||
return str.split(toString(elem)).length > options.minOccurrences;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Gets what should be in the `response` property of the XHR. However,
|
||||
* since we still support the final versions of IE, we need to do a little
|
||||
* checking here to make sure that we get the right thing back. Consequently,
|
||||
* we need to do a JSON.parse() in here, which *could* throw if the response
|
||||
* isn't valid JSON.
|
||||
*
|
||||
* This is used both in creating an AjaxResponse, and in creating certain errors
|
||||
* that we throw, so we can give the user whatever was in the response property.
|
||||
*
|
||||
* @param xhr The XHR to examine the response of
|
||||
*/
|
||||
export function getXHRResponse(xhr: XMLHttpRequest) {
|
||||
switch (xhr.responseType) {
|
||||
case 'json': {
|
||||
if ('response' in xhr) {
|
||||
return xhr.response;
|
||||
} else {
|
||||
// IE
|
||||
const ieXHR: any = xhr;
|
||||
return JSON.parse(ieXHR.responseText);
|
||||
}
|
||||
}
|
||||
case 'document':
|
||||
return xhr.responseXML;
|
||||
case 'text':
|
||||
default: {
|
||||
if ('response' in xhr) {
|
||||
return xhr.response;
|
||||
} else {
|
||||
// IE
|
||||
const ieXHR: any = xhr;
|
||||
return ieXHR.responseText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiElD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC;AAK9D,MAAM,CAAC,MAAM,KAAK,GAAG,cAAc,CAAC"}
|
||||
@@ -0,0 +1,89 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [1.7.0](https://github.com/medikoo/es5-ext/compare/v1.6.0...v1.7.0) (2022-08-31)
|
||||
|
||||
### Features
|
||||
|
||||
- `string.camelToHyphen` method ([b8ea4ab](https://github.com/medikoo/es5-ext/commit/b8ea4ab6c8b920ecdff224f9c92092e1c7f8cdfc))
|
||||
- `string.capitalize` method ([32e7360](https://github.com/medikoo/es5-ext/commit/32e736034bd27ed25d4566b22aa93aa66c7901cf))
|
||||
|
||||
## [1.6.0](https://github.com/medikoo/es5-ext/compare/v1.5.0...v1.6.0) (2021-09-24)
|
||||
|
||||
### Features
|
||||
|
||||
- `Object.clear` util ([a955da4](https://github.com/medikoo/es5-ext/commit/a955da41e65a25ad87a46234bae065f096abd1d2))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix `Object.entries` to not return non enumerable properties ([44fb872](https://github.com/medikoo/es5-ext/commit/44fb87266617378d2f47a1a5baad6280bf6298a8))
|
||||
|
||||
## [1.5.0](https://github.com/medikoo/es5-ext/compare/v1.3.0...v1.5.0) (2021-08-23)
|
||||
|
||||
### Features
|
||||
|
||||
- `Promise.limit` ([060a05d](https://github.com/medikoo/es5-ext/commit/060a05d4751cd291c6dd7641f5a73ba9338ea7ab))
|
||||
- `String.prototype.includes` ([ceebe8d](https://github.com/medikoo/es5-ext/commit/ceebe8dfd6f479d6a7e7b6cd79369291869ee2dd))
|
||||
- `charset` option for `String.random` ([2a20eeb](https://github.com/medikoo/es5-ext/commit/2a20eebc5ae784e5c1aacd2c54433fe92a9464c9))
|
||||
|
||||
## [1.4.0](https://github.com///compare/v1.3.0...v1.4.0) (2019-11-29)
|
||||
|
||||
### Features
|
||||
|
||||
- `charset` option for `String.random` ([2a20eeb](https://github.com///commit/2a20eebc5ae784e5c1aacd2c54433fe92a9464c9))
|
||||
- `String.prototype.includes` implementation ([ceebe8d](https://github.com///commit/ceebe8dfd6f479d6a7e7b6cd79369291869ee2dd))
|
||||
|
||||
## [1.3.0](https://github.com///compare/v1.2.1...v1.3.0) (2019-11-28)
|
||||
|
||||
### Features
|
||||
|
||||
- `String.random` util ([5b5860a](https://github.com///commit/5b5860ac545b05f00527e00295fdb4f97e4a4e5b))
|
||||
|
||||
### [1.2.1](https://github.com///compare/v1.2.0...v1.2.1) (2019-11-26)
|
||||
|
||||
## [1.2.0](https://github.com/medikoo/ext/compare/v1.1.2...v1.2.0) (2019-11-07)
|
||||
|
||||
### Features
|
||||
|
||||
- ceil10, floor10 and round10 for Math ([6a2bc4b](https://github.com/medikoo/ext/commit/6a2bc4b))
|
||||
|
||||
### [1.1.2](https://github.com/medikoo/ext/compare/v1.1.1...v1.1.2) (2019-10-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Improve globalThis detection ([470862d](https://github.com/medikoo/ext/commit/470862d))
|
||||
|
||||
### [1.1.1](https://github.com/medikoo/ext/compare/v1.1.0...v1.1.1) (2019-10-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Provide naive fallback for sealed Object.prototype case ([a8d528b](https://github.com/medikoo/ext/commit/a8d528b))
|
||||
- Workaournd Safari incompatibility case ([0b051e6](https://github.com/medikoo/ext/commit/0b051e6))
|
||||
|
||||
## [1.1.0](https://github.com/medikoo/ext/compare/v1.0.3...v1.1.0) (2019-10-21)
|
||||
|
||||
### Features
|
||||
|
||||
- Object.entries implementation ([cf51e45](https://github.com/medikoo/ext/commit/cf51e45))
|
||||
|
||||
### [1.0.3](https://github.com/medikoo/ext/compare/v1.0.1...v1.0.3) (2019-07-03)
|
||||
|
||||
Remove obsolete files from publication
|
||||
|
||||
### [1.0.2](https://github.com/medikoo/ext/compare/v1.0.1...v1.0.2) (2019-07-03)
|
||||
|
||||
(no changes)
|
||||
|
||||
### [1.0.1](https://github.com/medikoo/ext/compare/v1.0.0...v1.0.1) (2019-07-03)
|
||||
|
||||
Prettify
|
||||
|
||||
## 1.0.0 (2019-07-03)
|
||||
|
||||
### Features
|
||||
|
||||
- `function/identity` (adapted from `es5-ext`) ([f0102af](https://github.com/medikoo/ext/commit/f0102af))
|
||||
- `thenable/finally` (adapted from `es5-ext`) ([a8494ac](https://github.com/medikoo/ext/commit/a8494ac))
|
||||
- `global-this/is-implemented` ([3a80904](https://github.com/medikoo/ext/commit/3a80904))
|
||||
- `globalThis` (mostly adapted from `es5-ext`) ([6559bd3](https://github.com/medikoo/ext/commit/6559bd3))
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
||||
Copyrights licensed under the New BSD License.
|
||||
See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
import { IntlMessageFormat } from './src/core';
|
||||
export * from './src/formatters';
|
||||
export * from './src/core';
|
||||
export * from './src/error';
|
||||
export default IntlMessageFormat;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"observeOn.js","sourceRoot":"","sources":["../../../../src/internal/operators/observeOn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAsDhE,MAAM,UAAU,SAAS,CAAI,SAAwB,EAAE,KAAK,GAAG,CAAC;IAC9D,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,MAAM,CAAC,SAAS,CACd,wBAAwB,CACtB,UAAU,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EACtF,GAAG,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,EAChF,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CACpF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,509 @@
|
||||
/**
|
||||
* The `vm` module enables compiling and running code within V8 Virtual
|
||||
* Machine contexts.
|
||||
*
|
||||
* **The `vm` module is not a security**
|
||||
* **mechanism. Do not use it to run untrusted code.**
|
||||
*
|
||||
* JavaScript code can be compiled and run immediately or
|
||||
* compiled, saved, and run later.
|
||||
*
|
||||
* A common use case is to run the code in a different V8 Context. This means
|
||||
* invoked code has a different global object than the invoking code.
|
||||
*
|
||||
* One can provide the context by `contextifying` an
|
||||
* object. The invoked code treats any property in the context like a
|
||||
* global variable. Any changes to global variables caused by the invoked
|
||||
* code are reflected in the context object.
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* const x = 1;
|
||||
*
|
||||
* const context = { x: 2 };
|
||||
* vm.createContext(context); // Contextify the object.
|
||||
*
|
||||
* const code = 'x += 40; var y = 17;';
|
||||
* // `x` and `y` are global variables in the context.
|
||||
* // Initially, x has the value 2 because that is the value of context.x.
|
||||
* vm.runInContext(code, context);
|
||||
*
|
||||
* console.log(context.x); // 42
|
||||
* console.log(context.y); // 17
|
||||
*
|
||||
* console.log(x); // 1; y is not defined.
|
||||
* ```
|
||||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/vm.js)
|
||||
*/
|
||||
declare module 'vm' {
|
||||
interface Context extends NodeJS.Dict<any> {}
|
||||
interface BaseOptions {
|
||||
/**
|
||||
* Specifies the filename used in stack traces produced by this script.
|
||||
* Default: `''`.
|
||||
*/
|
||||
filename?: string | undefined;
|
||||
/**
|
||||
* Specifies the line number offset that is displayed in stack traces produced by this script.
|
||||
* Default: `0`.
|
||||
*/
|
||||
lineOffset?: number | undefined;
|
||||
/**
|
||||
* Specifies the column number offset that is displayed in stack traces produced by this script.
|
||||
* @default 0
|
||||
*/
|
||||
columnOffset?: number | undefined;
|
||||
}
|
||||
interface ScriptOptions extends BaseOptions {
|
||||
displayErrors?: boolean | undefined;
|
||||
timeout?: number | undefined;
|
||||
cachedData?: Buffer | undefined;
|
||||
/** @deprecated in favor of `script.createCachedData()` */
|
||||
produceCachedData?: boolean | undefined;
|
||||
}
|
||||
interface RunningScriptOptions extends BaseOptions {
|
||||
/**
|
||||
* When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace.
|
||||
* Default: `true`.
|
||||
*/
|
||||
displayErrors?: boolean | undefined;
|
||||
/**
|
||||
* Specifies the number of milliseconds to execute code before terminating execution.
|
||||
* If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer.
|
||||
*/
|
||||
timeout?: number | undefined;
|
||||
/**
|
||||
* If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received.
|
||||
* Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that.
|
||||
* If execution is terminated, an `Error` will be thrown.
|
||||
* Default: `false`.
|
||||
*/
|
||||
breakOnSigint?: boolean | undefined;
|
||||
/**
|
||||
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
|
||||
*/
|
||||
microtaskMode?: 'afterEvaluate' | undefined;
|
||||
}
|
||||
interface CompileFunctionOptions extends BaseOptions {
|
||||
/**
|
||||
* Provides an optional data with V8's code cache data for the supplied source.
|
||||
*/
|
||||
cachedData?: Buffer | undefined;
|
||||
/**
|
||||
* Specifies whether to produce new cache data.
|
||||
* Default: `false`,
|
||||
*/
|
||||
produceCachedData?: boolean | undefined;
|
||||
/**
|
||||
* The sandbox/context in which the said function should be compiled in.
|
||||
*/
|
||||
parsingContext?: Context | undefined;
|
||||
/**
|
||||
* An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
|
||||
*/
|
||||
contextExtensions?: Object[] | undefined;
|
||||
}
|
||||
interface CreateContextOptions {
|
||||
/**
|
||||
* Human-readable name of the newly created context.
|
||||
* @default 'VM Context i' Where i is an ascending numerical index of the created context.
|
||||
*/
|
||||
name?: string | undefined;
|
||||
/**
|
||||
* Corresponds to the newly created context for display purposes.
|
||||
* The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary),
|
||||
* like the value of the `url.origin` property of a URL object.
|
||||
* Most notably, this string should omit the trailing slash, as that denotes a path.
|
||||
* @default ''
|
||||
*/
|
||||
origin?: string | undefined;
|
||||
codeGeneration?:
|
||||
| {
|
||||
/**
|
||||
* If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc)
|
||||
* will throw an EvalError.
|
||||
* @default true
|
||||
*/
|
||||
strings?: boolean | undefined;
|
||||
/**
|
||||
* If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError.
|
||||
* @default true
|
||||
*/
|
||||
wasm?: boolean | undefined;
|
||||
}
|
||||
| undefined;
|
||||
/**
|
||||
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
|
||||
*/
|
||||
microtaskMode?: 'afterEvaluate' | undefined;
|
||||
}
|
||||
type MeasureMemoryMode = 'summary' | 'detailed';
|
||||
interface MeasureMemoryOptions {
|
||||
/**
|
||||
* @default 'summary'
|
||||
*/
|
||||
mode?: MeasureMemoryMode | undefined;
|
||||
context?: Context | undefined;
|
||||
}
|
||||
interface MemoryMeasurement {
|
||||
total: {
|
||||
jsMemoryEstimate: number;
|
||||
jsMemoryRange: [number, number];
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Instances of the `vm.Script` class contain precompiled scripts that can be
|
||||
* executed in specific contexts.
|
||||
* @since v0.3.1
|
||||
*/
|
||||
class Script {
|
||||
constructor(code: string, options?: ScriptOptions);
|
||||
/**
|
||||
* Runs the compiled code contained by the `vm.Script` object within the given`contextifiedObject` and returns the result. Running code does not have access
|
||||
* to local scope.
|
||||
*
|
||||
* The following example compiles code that increments a global variable, sets
|
||||
* the value of another global variable, then execute the code multiple times.
|
||||
* The globals are contained in the `context` object.
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* const context = {
|
||||
* animal: 'cat',
|
||||
* count: 2
|
||||
* };
|
||||
*
|
||||
* const script = new vm.Script('count += 1; name = "kitty";');
|
||||
*
|
||||
* vm.createContext(context);
|
||||
* for (let i = 0; i < 10; ++i) {
|
||||
* script.runInContext(context);
|
||||
* }
|
||||
*
|
||||
* console.log(context);
|
||||
* // Prints: { animal: 'cat', count: 12, name: 'kitty' }
|
||||
* ```
|
||||
*
|
||||
* Using the `timeout` or `breakOnSigint` options will result in new event loops
|
||||
* and corresponding threads being started, which have a non-zero performance
|
||||
* overhead.
|
||||
* @since v0.3.1
|
||||
* @param contextifiedObject A `contextified` object as returned by the `vm.createContext()` method.
|
||||
* @return the result of the very last statement executed in the script.
|
||||
*/
|
||||
runInContext(contextifiedObject: Context, options?: RunningScriptOptions): any;
|
||||
/**
|
||||
* First contextifies the given `contextObject`, runs the compiled code contained
|
||||
* by the `vm.Script` object within the created context, and returns the result.
|
||||
* Running code does not have access to local scope.
|
||||
*
|
||||
* The following example compiles code that sets a global variable, then executes
|
||||
* the code multiple times in different contexts. The globals are set on and
|
||||
* contained within each individual `context`.
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* const script = new vm.Script('globalVar = "set"');
|
||||
*
|
||||
* const contexts = [{}, {}, {}];
|
||||
* contexts.forEach((context) => {
|
||||
* script.runInNewContext(context);
|
||||
* });
|
||||
*
|
||||
* console.log(contexts);
|
||||
* // Prints: [{ globalVar: 'set' }, { globalVar: 'set' }, { globalVar: 'set' }]
|
||||
* ```
|
||||
* @since v0.3.1
|
||||
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
|
||||
* @return the result of the very last statement executed in the script.
|
||||
*/
|
||||
runInNewContext(contextObject?: Context, options?: RunningScriptOptions): any;
|
||||
/**
|
||||
* Runs the compiled code contained by the `vm.Script` within the context of the
|
||||
* current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object.
|
||||
*
|
||||
* The following example compiles code that increments a `global` variable then
|
||||
* executes that code multiple times:
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* global.globalVar = 0;
|
||||
*
|
||||
* const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' });
|
||||
*
|
||||
* for (let i = 0; i < 1000; ++i) {
|
||||
* script.runInThisContext();
|
||||
* }
|
||||
*
|
||||
* console.log(globalVar);
|
||||
*
|
||||
* // 1000
|
||||
* ```
|
||||
* @since v0.3.1
|
||||
* @return the result of the very last statement executed in the script.
|
||||
*/
|
||||
runInThisContext(options?: RunningScriptOptions): any;
|
||||
/**
|
||||
* Creates a code cache that can be used with the `Script` constructor's`cachedData` option. Returns a `Buffer`. This method may be called at any
|
||||
* time and any number of times.
|
||||
*
|
||||
* ```js
|
||||
* const script = new vm.Script(`
|
||||
* function add(a, b) {
|
||||
* return a + b;
|
||||
* }
|
||||
*
|
||||
* const x = add(1, 2);
|
||||
* `);
|
||||
*
|
||||
* const cacheWithoutX = script.createCachedData();
|
||||
*
|
||||
* script.runInThisContext();
|
||||
*
|
||||
* const cacheWithX = script.createCachedData();
|
||||
* ```
|
||||
* @since v10.6.0
|
||||
*/
|
||||
createCachedData(): Buffer;
|
||||
/** @deprecated in favor of `script.createCachedData()` */
|
||||
cachedDataProduced?: boolean | undefined;
|
||||
cachedDataRejected?: boolean | undefined;
|
||||
cachedData?: Buffer | undefined;
|
||||
}
|
||||
/**
|
||||
* If given a `contextObject`, the `vm.createContext()` method will `prepare
|
||||
* that object` so that it can be used in calls to {@link runInContext} or `script.runInContext()`. Inside such scripts,
|
||||
* the `contextObject` will be the global object, retaining all of its existing
|
||||
* properties but also having the built-in objects and functions any standard [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global variables
|
||||
* will remain unchanged.
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* global.globalVar = 3;
|
||||
*
|
||||
* const context = { globalVar: 1 };
|
||||
* vm.createContext(context);
|
||||
*
|
||||
* vm.runInContext('globalVar *= 2;', context);
|
||||
*
|
||||
* console.log(context);
|
||||
* // Prints: { globalVar: 2 }
|
||||
*
|
||||
* console.log(global.globalVar);
|
||||
* // Prints: 3
|
||||
* ```
|
||||
*
|
||||
* If `contextObject` is omitted (or passed explicitly as `undefined`), a new,
|
||||
* empty `contextified` object will be returned.
|
||||
*
|
||||
* The `vm.createContext()` method is primarily useful for creating a single
|
||||
* context that can be used to run multiple scripts. For instance, if emulating a
|
||||
* web browser, the method can be used to create a single context representing a
|
||||
* window's global object, then run all `<script>` tags together within that
|
||||
* context.
|
||||
*
|
||||
* The provided `name` and `origin` of the context are made visible through the
|
||||
* Inspector API.
|
||||
* @since v0.3.1
|
||||
* @return contextified object.
|
||||
*/
|
||||
function createContext(sandbox?: Context, options?: CreateContextOptions): Context;
|
||||
/**
|
||||
* Returns `true` if the given `object` object has been `contextified` using {@link createContext}.
|
||||
* @since v0.11.7
|
||||
*/
|
||||
function isContext(sandbox: Context): boolean;
|
||||
/**
|
||||
* The `vm.runInContext()` method compiles `code`, runs it within the context of
|
||||
* the `contextifiedObject`, then returns the result. Running code does not have
|
||||
* access to the local scope. The `contextifiedObject` object _must_ have been
|
||||
* previously `contextified` using the {@link createContext} method.
|
||||
*
|
||||
* If `options` is a string, then it specifies the filename.
|
||||
*
|
||||
* The following example compiles and executes different scripts using a single `contextified` object:
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* const contextObject = { globalVar: 1 };
|
||||
* vm.createContext(contextObject);
|
||||
*
|
||||
* for (let i = 0; i < 10; ++i) {
|
||||
* vm.runInContext('globalVar *= 2;', contextObject);
|
||||
* }
|
||||
* console.log(contextObject);
|
||||
* // Prints: { globalVar: 1024 }
|
||||
* ```
|
||||
* @since v0.3.1
|
||||
* @param code The JavaScript code to compile and run.
|
||||
* @param contextifiedObject The `contextified` object that will be used as the `global` when the `code` is compiled and run.
|
||||
* @return the result of the very last statement executed in the script.
|
||||
*/
|
||||
function runInContext(code: string, contextifiedObject: Context, options?: RunningScriptOptions | string): any;
|
||||
/**
|
||||
* The `vm.runInNewContext()` first contextifies the given `contextObject` (or
|
||||
* creates a new `contextObject` if passed as `undefined`), compiles the `code`,
|
||||
* runs it within the created context, then returns the result. Running code
|
||||
* does not have access to the local scope.
|
||||
*
|
||||
* If `options` is a string, then it specifies the filename.
|
||||
*
|
||||
* The following example compiles and executes code that increments a global
|
||||
* variable and sets a new one. These globals are contained in the `contextObject`.
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* const contextObject = {
|
||||
* animal: 'cat',
|
||||
* count: 2
|
||||
* };
|
||||
*
|
||||
* vm.runInNewContext('count += 1; name = "kitty"', contextObject);
|
||||
* console.log(contextObject);
|
||||
* // Prints: { animal: 'cat', count: 3, name: 'kitty' }
|
||||
* ```
|
||||
* @since v0.3.1
|
||||
* @param code The JavaScript code to compile and run.
|
||||
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
|
||||
* @return the result of the very last statement executed in the script.
|
||||
*/
|
||||
function runInNewContext(code: string, contextObject?: Context, options?: RunningScriptOptions | string): any;
|
||||
/**
|
||||
* `vm.runInThisContext()` compiles `code`, runs it within the context of the
|
||||
* current `global` and returns the result. Running code does not have access to
|
||||
* local scope, but does have access to the current `global` object.
|
||||
*
|
||||
* If `options` is a string, then it specifies the filename.
|
||||
*
|
||||
* The following example illustrates using both `vm.runInThisContext()` and
|
||||
* the JavaScript [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) function to run the same code:
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
* let localVar = 'initial value';
|
||||
*
|
||||
* const vmResult = vm.runInThisContext('localVar = "vm";');
|
||||
* console.log(`vmResult: '${vmResult}', localVar: '${localVar}'`);
|
||||
* // Prints: vmResult: 'vm', localVar: 'initial value'
|
||||
*
|
||||
* const evalResult = eval('localVar = "eval";');
|
||||
* console.log(`evalResult: '${evalResult}', localVar: '${localVar}'`);
|
||||
* // Prints: evalResult: 'eval', localVar: 'eval'
|
||||
* ```
|
||||
*
|
||||
* Because `vm.runInThisContext()` does not have access to the local scope,`localVar` is unchanged. In contrast,
|
||||
* [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) _does_ have access to the
|
||||
* local scope, so the value `localVar` is changed. In this way`vm.runInThisContext()` is much like an [indirect `eval()` call](https://es5.github.io/#x10.4.2), e.g.`(0,eval)('code')`.
|
||||
*
|
||||
* ## Example: Running an HTTP server within a VM
|
||||
*
|
||||
* When using either `script.runInThisContext()` or {@link runInThisContext}, the code is executed within the current V8 global
|
||||
* context. The code passed to this VM context will have its own isolated scope.
|
||||
*
|
||||
* In order to run a simple web server using the `http` module the code passed to
|
||||
* the context must either call `require('http')` on its own, or have a reference
|
||||
* to the `http` module passed to it. For instance:
|
||||
*
|
||||
* ```js
|
||||
* 'use strict';
|
||||
* const vm = require('vm');
|
||||
*
|
||||
* const code = `
|
||||
* ((require) => {
|
||||
* const http = require('http');
|
||||
*
|
||||
* http.createServer((request, response) => {
|
||||
* response.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
* response.end('Hello World\\n');
|
||||
* }).listen(8124);
|
||||
*
|
||||
* console.log('Server running at http://127.0.0.1:8124/');
|
||||
* })`;
|
||||
*
|
||||
* vm.runInThisContext(code)(require);
|
||||
* ```
|
||||
*
|
||||
* The `require()` in the above case shares the state with the context it is
|
||||
* passed from. This may introduce risks when untrusted code is executed, e.g.
|
||||
* altering objects in the context in unwanted ways.
|
||||
* @since v0.3.1
|
||||
* @param code The JavaScript code to compile and run.
|
||||
* @return the result of the very last statement executed in the script.
|
||||
*/
|
||||
function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
|
||||
/**
|
||||
* Compiles the given code into the provided context (if no context is
|
||||
* supplied, the current context is used), and returns it wrapped inside a
|
||||
* function with the given `params`.
|
||||
* @since v10.10.0
|
||||
* @param code The body of the function to compile.
|
||||
* @param params An array of strings containing all parameters for the function.
|
||||
*/
|
||||
function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function;
|
||||
/**
|
||||
* Measure the memory known to V8 and used by all contexts known to the
|
||||
* current V8 isolate, or the main context.
|
||||
*
|
||||
* The format of the object that the returned Promise may resolve with is
|
||||
* specific to the V8 engine and may change from one version of V8 to the next.
|
||||
*
|
||||
* The returned result is different from the statistics returned by`v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measure the
|
||||
* memory reachable by each V8 specific contexts in the current instance of
|
||||
* the V8 engine, while the result of `v8.getHeapSpaceStatistics()` measure
|
||||
* the memory occupied by each heap space in the current V8 instance.
|
||||
*
|
||||
* ```js
|
||||
* const vm = require('vm');
|
||||
* // Measure the memory used by the main context.
|
||||
* vm.measureMemory({ mode: 'summary' })
|
||||
* // This is the same as vm.measureMemory()
|
||||
* .then((result) => {
|
||||
* // The current format is:
|
||||
* // {
|
||||
* // total: {
|
||||
* // jsMemoryEstimate: 2418479, jsMemoryRange: [ 2418479, 2745799 ]
|
||||
* // }
|
||||
* // }
|
||||
* console.log(result);
|
||||
* });
|
||||
*
|
||||
* const context = vm.createContext({ a: 1 });
|
||||
* vm.measureMemory({ mode: 'detailed', execution: 'eager' })
|
||||
* .then((result) => {
|
||||
* // Reference the context here so that it won't be GC'ed
|
||||
* // until the measurement is complete.
|
||||
* console.log(context.a);
|
||||
* // {
|
||||
* // total: {
|
||||
* // jsMemoryEstimate: 2574732,
|
||||
* // jsMemoryRange: [ 2574732, 2904372 ]
|
||||
* // },
|
||||
* // current: {
|
||||
* // jsMemoryEstimate: 2438996,
|
||||
* // jsMemoryRange: [ 2438996, 2768636 ]
|
||||
* // },
|
||||
* // other: [
|
||||
* // {
|
||||
* // jsMemoryEstimate: 135736,
|
||||
* // jsMemoryRange: [ 135736, 465376 ]
|
||||
* // }
|
||||
* // ]
|
||||
* // }
|
||||
* console.log(result);
|
||||
* });
|
||||
* ```
|
||||
* @since v13.10.0
|
||||
* @experimental
|
||||
*/
|
||||
function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
|
||||
}
|
||||
declare module 'node:vm' {
|
||||
export * from 'vm';
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('invertBy', require('../invertBy'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"publishLast.js","sourceRoot":"","sources":["../../../../src/internal/operators/publishLast.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAmE5E,MAAM,UAAU,WAAW;IAEzB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,OAAO,GAAG,IAAI,YAAY,EAAK,CAAC;QACtC,OAAO,IAAI,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC"}
|
||||
@@ -0,0 +1,5 @@
|
||||
import Block from '../../Block';
|
||||
import Action from '../../../nodes/Action';
|
||||
import { Expression } from 'estree';
|
||||
export default function add_actions(block: Block, target: string | Expression, actions: Action[]): void;
|
||||
export declare function add_action(block: Block, target: string | Expression, action: Action): void;
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
||||
* Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
|
||||
* with some tweaks
|
||||
*/
|
||||
var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
||||
/**
|
||||
* Parse Date time skeleton into Intl.DateTimeFormatOptions
|
||||
* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
||||
* @public
|
||||
* @param skeleton skeleton string
|
||||
*/
|
||||
export function parseDateTimeSkeleton(skeleton) {
|
||||
var result = {};
|
||||
skeleton.replace(DATE_TIME_REGEX, function (match) {
|
||||
var len = match.length;
|
||||
switch (match[0]) {
|
||||
// Era
|
||||
case 'G':
|
||||
result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
|
||||
break;
|
||||
// Year
|
||||
case 'y':
|
||||
result.year = len === 2 ? '2-digit' : 'numeric';
|
||||
break;
|
||||
case 'Y':
|
||||
case 'u':
|
||||
case 'U':
|
||||
case 'r':
|
||||
throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');
|
||||
// Quarter
|
||||
case 'q':
|
||||
case 'Q':
|
||||
throw new RangeError('`q/Q` (quarter) patterns are not supported');
|
||||
// Month
|
||||
case 'M':
|
||||
case 'L':
|
||||
result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];
|
||||
break;
|
||||
// Week
|
||||
case 'w':
|
||||
case 'W':
|
||||
throw new RangeError('`w/W` (week) patterns are not supported');
|
||||
case 'd':
|
||||
result.day = ['numeric', '2-digit'][len - 1];
|
||||
break;
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'g':
|
||||
throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');
|
||||
// Weekday
|
||||
case 'E':
|
||||
result.weekday = len === 4 ? 'short' : len === 5 ? 'narrow' : 'short';
|
||||
break;
|
||||
case 'e':
|
||||
if (len < 4) {
|
||||
throw new RangeError('`e..eee` (weekday) patterns are not supported');
|
||||
}
|
||||
result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];
|
||||
break;
|
||||
case 'c':
|
||||
if (len < 4) {
|
||||
throw new RangeError('`c..ccc` (weekday) patterns are not supported');
|
||||
}
|
||||
result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];
|
||||
break;
|
||||
// Period
|
||||
case 'a': // AM, PM
|
||||
result.hour12 = true;
|
||||
break;
|
||||
case 'b': // am, pm, noon, midnight
|
||||
case 'B': // flexible day periods
|
||||
throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');
|
||||
// Hour
|
||||
case 'h':
|
||||
result.hourCycle = 'h12';
|
||||
result.hour = ['numeric', '2-digit'][len - 1];
|
||||
break;
|
||||
case 'H':
|
||||
result.hourCycle = 'h23';
|
||||
result.hour = ['numeric', '2-digit'][len - 1];
|
||||
break;
|
||||
case 'K':
|
||||
result.hourCycle = 'h11';
|
||||
result.hour = ['numeric', '2-digit'][len - 1];
|
||||
break;
|
||||
case 'k':
|
||||
result.hourCycle = 'h24';
|
||||
result.hour = ['numeric', '2-digit'][len - 1];
|
||||
break;
|
||||
case 'j':
|
||||
case 'J':
|
||||
case 'C':
|
||||
throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');
|
||||
// Minute
|
||||
case 'm':
|
||||
result.minute = ['numeric', '2-digit'][len - 1];
|
||||
break;
|
||||
// Second
|
||||
case 's':
|
||||
result.second = ['numeric', '2-digit'][len - 1];
|
||||
break;
|
||||
case 'S':
|
||||
case 'A':
|
||||
throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead');
|
||||
// Zone
|
||||
case 'z': // 1..3, 4: specific non-location format
|
||||
result.timeZoneName = len < 4 ? 'short' : 'long';
|
||||
break;
|
||||
case 'Z': // 1..3, 4, 5: The ISO8601 varios formats
|
||||
case 'O': // 1, 4: miliseconds in day short, long
|
||||
case 'v': // 1, 4: generic non-location format
|
||||
case 'V': // 1, 2, 3, 4: time zone ID or city
|
||||
case 'X': // 1, 2, 3, 4: The ISO8601 varios formats
|
||||
case 'x': // 1, 2, 3, 4: The ISO8601 varios formats
|
||||
throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead');
|
||||
}
|
||||
return '';
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"resolve-alpn","version":"1.2.1","files":{"LICENSE":{"checkedAt":1678883673376,"integrity":"sha512-PNhJ28fF8sg+IGO8GTaMd5yYDikjd5lUXKmwoG9xYTfjIMWRvafDtDUa4ybTgvMyrLaN2y4EtMXOIw5mIrU36w==","mode":420,"size":1072},"README.md":{"checkedAt":1678883673376,"integrity":"sha512-clqlug+oKGW/MFIzkN4HozZrAH6MlHnpl8zIp+yFcVx/Hmbik55Y1kQR7PZAlki0tyEOfYMPYEqyxEzPtKdx7w==","mode":420,"size":1889},"package.json":{"checkedAt":1678883673376,"integrity":"sha512-QriRrOeRzT3f1q7NFOSrO56GZWa3/TCxWu5T1a2AKUMw51KRxdyoRyQ1RNWXLw3L1ANlC/ymtHE54DjtnmWgTw==","mode":420,"size":825},"index.js":{"checkedAt":1678883673376,"integrity":"sha512-gpg6XwF5GgQQnn+G8xycXnq4LztYNpb0Fj4VeWwewSaJGdnRQPd6UJIleti0kk3BaUY75wABu1JMDmIGK0aRyA==","mode":420,"size":859}}}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { TransformOptions } from "stream";
|
||||
import { CSVParseParam } from "./Parameters";
|
||||
import { Converter } from "./Converter";
|
||||
|
||||
const helper = function (param?: Partial<CSVParseParam>, options?: TransformOptions): Converter {
|
||||
return new Converter(param, options);
|
||||
}
|
||||
helper["csv"] = helper;
|
||||
helper["Converter"] = Converter;
|
||||
export =helper;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = ({onlyFirst = false} = {}) => {
|
||||
const pattern = [
|
||||
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
||||
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
||||
].join('|');
|
||||
|
||||
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
var isPlainArray = require("../../is-plain-array")
|
||||
, isArray = Array.isArray
|
||||
, splice = Array.prototype.splice
|
||||
, forEach = Array.prototype.forEach;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
module.exports = function (start, deleteCount /*, …items*/) {
|
||||
var arr = splice.apply(this, arguments), result;
|
||||
if (!this || !isArray(this) || isPlainArray(this)) return arr;
|
||||
result = new this.constructor(arr.length);
|
||||
forEach.call(arr, function (val, i) { result[i] = val; });
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"skipWhile.js","sourceRoot":"","sources":["../../../../src/internal/operators/skipWhile.ts"],"names":[],"mappings":";;;AACA,qCAAuC;AACvC,2DAAgE;AAiDhE,SAAgB,SAAS,CAAI,SAA+C;IAC1E,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,SAAS,CACd,6CAAwB,CAAC,UAAU,EAAE,UAAC,KAAK,IAAK,OAAA,CAAC,MAAM,IAAI,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAA3E,CAA2E,CAAC,CAC7H,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AARD,8BAQC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../../../src/internal/util/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAQzC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,GAAG,SAAS,CAE5F;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,aAAa,GAAG,SAAS,CAEnE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEnE"}
|
||||
@@ -0,0 +1,82 @@
|
||||
import { createElement, render } from 'preact';
|
||||
|
||||
/**
|
||||
* @param {import('../../src/index').RenderableProps<{ context: any }>} props
|
||||
*/
|
||||
function ContextProvider(props) {
|
||||
this.getChildContext = () => props.context;
|
||||
return props.children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Portal component
|
||||
* @this {import('./internal').Component}
|
||||
* @param {object | null | undefined} props
|
||||
*
|
||||
* TODO: use createRoot() instead of fake root
|
||||
*/
|
||||
function Portal(props) {
|
||||
const _this = this;
|
||||
let container = props._container;
|
||||
|
||||
_this.componentWillUnmount = function() {
|
||||
render(null, _this._temp);
|
||||
_this._temp = null;
|
||||
_this._container = null;
|
||||
};
|
||||
|
||||
// When we change container we should clear our old container and
|
||||
// indicate a new mount.
|
||||
if (_this._container && _this._container !== container) {
|
||||
_this.componentWillUnmount();
|
||||
}
|
||||
|
||||
// When props.vnode is undefined/false/null we are dealing with some kind of
|
||||
// conditional vnode. This should not trigger a render.
|
||||
if (props._vnode) {
|
||||
if (!_this._temp) {
|
||||
_this._container = container;
|
||||
|
||||
// Create a fake DOM parent node that manages a subset of `container`'s children:
|
||||
_this._temp = {
|
||||
nodeType: 1,
|
||||
parentNode: container,
|
||||
childNodes: [],
|
||||
appendChild(child) {
|
||||
this.childNodes.push(child);
|
||||
_this._container.appendChild(child);
|
||||
},
|
||||
insertBefore(child, before) {
|
||||
this.childNodes.push(child);
|
||||
_this._container.appendChild(child);
|
||||
},
|
||||
removeChild(child) {
|
||||
this.childNodes.splice(this.childNodes.indexOf(child) >>> 1, 1);
|
||||
_this._container.removeChild(child);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Render our wrapping element into temp.
|
||||
render(
|
||||
createElement(ContextProvider, { context: _this.context }, props._vnode),
|
||||
_this._temp
|
||||
);
|
||||
}
|
||||
// When we come from a conditional render, on a mounted
|
||||
// portal we should clear the DOM.
|
||||
else if (_this._temp) {
|
||||
_this.componentWillUnmount();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a `Portal` to continue rendering the vnode tree at a different DOM node
|
||||
* @param {import('./internal').VNode} vnode The vnode to render
|
||||
* @param {import('./internal').PreactElement} container The DOM node to continue rendering in to.
|
||||
*/
|
||||
export function createPortal(vnode, container) {
|
||||
const el = createElement(Portal, { _vnode: vnode, _container: container });
|
||||
el.containerInfo = container;
|
||||
return el;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import { Fork } from "../types";
|
||||
export default function (fork: Fork): void;
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[28594] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
ĄĸŖ¤Ĩϧ¨ŠĒĢŦޝ°ą˛ŗ´ĩšēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖרŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,4 @@
|
||||
import AsyncProvider from './async';
|
||||
import StreamProvider from './stream';
|
||||
import SyncProvider from './sync';
|
||||
export { AsyncProvider, StreamProvider, SyncProvider };
|
||||
@@ -0,0 +1,3 @@
|
||||
declare function upperCase (value: string, locale?: string): string;
|
||||
|
||||
export = upperCase;
|
||||
@@ -0,0 +1,839 @@
|
||||
/* MIT license */
|
||||
/* eslint-disable no-mixed-operators */
|
||||
const cssKeywords = require('color-name');
|
||||
|
||||
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||
// values that give correct `typeof` results).
|
||||
// do not use box values types (i.e. Number(), String(), etc.)
|
||||
|
||||
const reverseKeywords = {};
|
||||
for (const key of Object.keys(cssKeywords)) {
|
||||
reverseKeywords[cssKeywords[key]] = key;
|
||||
}
|
||||
|
||||
const convert = {
|
||||
rgb: {channels: 3, labels: 'rgb'},
|
||||
hsl: {channels: 3, labels: 'hsl'},
|
||||
hsv: {channels: 3, labels: 'hsv'},
|
||||
hwb: {channels: 3, labels: 'hwb'},
|
||||
cmyk: {channels: 4, labels: 'cmyk'},
|
||||
xyz: {channels: 3, labels: 'xyz'},
|
||||
lab: {channels: 3, labels: 'lab'},
|
||||
lch: {channels: 3, labels: 'lch'},
|
||||
hex: {channels: 1, labels: ['hex']},
|
||||
keyword: {channels: 1, labels: ['keyword']},
|
||||
ansi16: {channels: 1, labels: ['ansi16']},
|
||||
ansi256: {channels: 1, labels: ['ansi256']},
|
||||
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||
gray: {channels: 1, labels: ['gray']}
|
||||
};
|
||||
|
||||
module.exports = convert;
|
||||
|
||||
// Hide .channels and .labels properties
|
||||
for (const model of Object.keys(convert)) {
|
||||
if (!('channels' in convert[model])) {
|
||||
throw new Error('missing channels property: ' + model);
|
||||
}
|
||||
|
||||
if (!('labels' in convert[model])) {
|
||||
throw new Error('missing channel labels property: ' + model);
|
||||
}
|
||||
|
||||
if (convert[model].labels.length !== convert[model].channels) {
|
||||
throw new Error('channel and label counts mismatch: ' + model);
|
||||
}
|
||||
|
||||
const {channels, labels} = convert[model];
|
||||
delete convert[model].channels;
|
||||
delete convert[model].labels;
|
||||
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||
}
|
||||
|
||||
convert.rgb.hsl = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const min = Math.min(r, g, b);
|
||||
const max = Math.max(r, g, b);
|
||||
const delta = max - min;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else if (r === max) {
|
||||
h = (g - b) / delta;
|
||||
} else if (g === max) {
|
||||
h = 2 + (b - r) / delta;
|
||||
} else if (b === max) {
|
||||
h = 4 + (r - g) / delta;
|
||||
}
|
||||
|
||||
h = Math.min(h * 60, 360);
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const l = (min + max) / 2;
|
||||
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
} else if (l <= 0.5) {
|
||||
s = delta / (max + min);
|
||||
} else {
|
||||
s = delta / (2 - max - min);
|
||||
}
|
||||
|
||||
return [h, s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.rgb.hsv = function (rgb) {
|
||||
let rdif;
|
||||
let gdif;
|
||||
let bdif;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const v = Math.max(r, g, b);
|
||||
const diff = v - Math.min(r, g, b);
|
||||
const diffc = function (c) {
|
||||
return (v - c) / 6 / diff + 1 / 2;
|
||||
};
|
||||
|
||||
if (diff === 0) {
|
||||
h = 0;
|
||||
s = 0;
|
||||
} else {
|
||||
s = diff / v;
|
||||
rdif = diffc(r);
|
||||
gdif = diffc(g);
|
||||
bdif = diffc(b);
|
||||
|
||||
if (r === v) {
|
||||
h = bdif - gdif;
|
||||
} else if (g === v) {
|
||||
h = (1 / 3) + rdif - bdif;
|
||||
} else if (b === v) {
|
||||
h = (2 / 3) + gdif - rdif;
|
||||
}
|
||||
|
||||
if (h < 0) {
|
||||
h += 1;
|
||||
} else if (h > 1) {
|
||||
h -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
h * 360,
|
||||
s * 100,
|
||||
v * 100
|
||||
];
|
||||
};
|
||||
|
||||
convert.rgb.hwb = function (rgb) {
|
||||
const r = rgb[0];
|
||||
const g = rgb[1];
|
||||
let b = rgb[2];
|
||||
const h = convert.rgb.hsl(rgb)[0];
|
||||
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||
|
||||
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||
|
||||
return [h, w * 100, b * 100];
|
||||
};
|
||||
|
||||
convert.rgb.cmyk = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
|
||||
const k = Math.min(1 - r, 1 - g, 1 - b);
|
||||
const c = (1 - r - k) / (1 - k) || 0;
|
||||
const m = (1 - g - k) / (1 - k) || 0;
|
||||
const y = (1 - b - k) / (1 - k) || 0;
|
||||
|
||||
return [c * 100, m * 100, y * 100, k * 100];
|
||||
};
|
||||
|
||||
function comparativeDistance(x, y) {
|
||||
/*
|
||||
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||
*/
|
||||
return (
|
||||
((x[0] - y[0]) ** 2) +
|
||||
((x[1] - y[1]) ** 2) +
|
||||
((x[2] - y[2]) ** 2)
|
||||
);
|
||||
}
|
||||
|
||||
convert.rgb.keyword = function (rgb) {
|
||||
const reversed = reverseKeywords[rgb];
|
||||
if (reversed) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
let currentClosestDistance = Infinity;
|
||||
let currentClosestKeyword;
|
||||
|
||||
for (const keyword of Object.keys(cssKeywords)) {
|
||||
const value = cssKeywords[keyword];
|
||||
|
||||
// Compute comparative distance
|
||||
const distance = comparativeDistance(rgb, value);
|
||||
|
||||
// Check if its less, if so set as closest
|
||||
if (distance < currentClosestDistance) {
|
||||
currentClosestDistance = distance;
|
||||
currentClosestKeyword = keyword;
|
||||
}
|
||||
}
|
||||
|
||||
return currentClosestKeyword;
|
||||
};
|
||||
|
||||
convert.keyword.rgb = function (keyword) {
|
||||
return cssKeywords[keyword];
|
||||
};
|
||||
|
||||
convert.rgb.xyz = function (rgb) {
|
||||
let r = rgb[0] / 255;
|
||||
let g = rgb[1] / 255;
|
||||
let b = rgb[2] / 255;
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
||||
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
||||
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
||||
|
||||
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||
|
||||
return [x * 100, y * 100, z * 100];
|
||||
};
|
||||
|
||||
convert.rgb.lab = function (rgb) {
|
||||
const xyz = convert.rgb.xyz(rgb);
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.hsl.rgb = function (hsl) {
|
||||
const h = hsl[0] / 360;
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
let t2;
|
||||
let t3;
|
||||
let val;
|
||||
|
||||
if (s === 0) {
|
||||
val = l * 255;
|
||||
return [val, val, val];
|
||||
}
|
||||
|
||||
if (l < 0.5) {
|
||||
t2 = l * (1 + s);
|
||||
} else {
|
||||
t2 = l + s - l * s;
|
||||
}
|
||||
|
||||
const t1 = 2 * l - t2;
|
||||
|
||||
const rgb = [0, 0, 0];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
t3 = h + 1 / 3 * -(i - 1);
|
||||
if (t3 < 0) {
|
||||
t3++;
|
||||
}
|
||||
|
||||
if (t3 > 1) {
|
||||
t3--;
|
||||
}
|
||||
|
||||
if (6 * t3 < 1) {
|
||||
val = t1 + (t2 - t1) * 6 * t3;
|
||||
} else if (2 * t3 < 1) {
|
||||
val = t2;
|
||||
} else if (3 * t3 < 2) {
|
||||
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||
} else {
|
||||
val = t1;
|
||||
}
|
||||
|
||||
rgb[i] = val * 255;
|
||||
}
|
||||
|
||||
return rgb;
|
||||
};
|
||||
|
||||
convert.hsl.hsv = function (hsl) {
|
||||
const h = hsl[0];
|
||||
let s = hsl[1] / 100;
|
||||
let l = hsl[2] / 100;
|
||||
let smin = s;
|
||||
const lmin = Math.max(l, 0.01);
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||
const v = (l + s) / 2;
|
||||
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||
|
||||
return [h, sv * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hsv.rgb = function (hsv) {
|
||||
const h = hsv[0] / 60;
|
||||
const s = hsv[1] / 100;
|
||||
let v = hsv[2] / 100;
|
||||
const hi = Math.floor(h) % 6;
|
||||
|
||||
const f = h - Math.floor(h);
|
||||
const p = 255 * v * (1 - s);
|
||||
const q = 255 * v * (1 - (s * f));
|
||||
const t = 255 * v * (1 - (s * (1 - f)));
|
||||
v *= 255;
|
||||
|
||||
switch (hi) {
|
||||
case 0:
|
||||
return [v, t, p];
|
||||
case 1:
|
||||
return [q, v, p];
|
||||
case 2:
|
||||
return [p, v, t];
|
||||
case 3:
|
||||
return [p, q, v];
|
||||
case 4:
|
||||
return [t, p, v];
|
||||
case 5:
|
||||
return [v, p, q];
|
||||
}
|
||||
};
|
||||
|
||||
convert.hsv.hsl = function (hsv) {
|
||||
const h = hsv[0];
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
const vmin = Math.max(v, 0.01);
|
||||
let sl;
|
||||
let l;
|
||||
|
||||
l = (2 - s) * v;
|
||||
const lmin = (2 - s) * vmin;
|
||||
sl = s * vmin;
|
||||
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||
sl = sl || 0;
|
||||
l /= 2;
|
||||
|
||||
return [h, sl * 100, l * 100];
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||
convert.hwb.rgb = function (hwb) {
|
||||
const h = hwb[0] / 360;
|
||||
let wh = hwb[1] / 100;
|
||||
let bl = hwb[2] / 100;
|
||||
const ratio = wh + bl;
|
||||
let f;
|
||||
|
||||
// Wh + bl cant be > 1
|
||||
if (ratio > 1) {
|
||||
wh /= ratio;
|
||||
bl /= ratio;
|
||||
}
|
||||
|
||||
const i = Math.floor(6 * h);
|
||||
const v = 1 - bl;
|
||||
f = 6 * h - i;
|
||||
|
||||
if ((i & 0x01) !== 0) {
|
||||
f = 1 - f;
|
||||
}
|
||||
|
||||
const n = wh + f * (v - wh); // Linear interpolation
|
||||
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
||||
switch (i) {
|
||||
default:
|
||||
case 6:
|
||||
case 0: r = v; g = n; b = wh; break;
|
||||
case 1: r = n; g = v; b = wh; break;
|
||||
case 2: r = wh; g = v; b = n; break;
|
||||
case 3: r = wh; g = n; b = v; break;
|
||||
case 4: r = n; g = wh; b = v; break;
|
||||
case 5: r = v; g = wh; b = n; break;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.cmyk.rgb = function (cmyk) {
|
||||
const c = cmyk[0] / 100;
|
||||
const m = cmyk[1] / 100;
|
||||
const y = cmyk[2] / 100;
|
||||
const k = cmyk[3] / 100;
|
||||
|
||||
const r = 1 - Math.min(1, c * (1 - k) + k);
|
||||
const g = 1 - Math.min(1, m * (1 - k) + k);
|
||||
const b = 1 - Math.min(1, y * (1 - k) + k);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.rgb = function (xyz) {
|
||||
const x = xyz[0] / 100;
|
||||
const y = xyz[1] / 100;
|
||||
const z = xyz[2] / 100;
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
|
||||
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.0031308
|
||||
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
||||
: r * 12.92;
|
||||
|
||||
g = g > 0.0031308
|
||||
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
||||
: g * 12.92;
|
||||
|
||||
b = b > 0.0031308
|
||||
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
||||
: b * 12.92;
|
||||
|
||||
r = Math.min(Math.max(0, r), 1);
|
||||
g = Math.min(Math.max(0, g), 1);
|
||||
b = Math.min(Math.max(0, b), 1);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.lab = function (xyz) {
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.lab.xyz = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let x;
|
||||
let y;
|
||||
let z;
|
||||
|
||||
y = (l + 16) / 116;
|
||||
x = a / 500 + y;
|
||||
z = y - b / 200;
|
||||
|
||||
const y2 = y ** 3;
|
||||
const x2 = x ** 3;
|
||||
const z2 = z ** 3;
|
||||
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||
|
||||
x *= 95.047;
|
||||
y *= 100;
|
||||
z *= 108.883;
|
||||
|
||||
return [x, y, z];
|
||||
};
|
||||
|
||||
convert.lab.lch = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let h;
|
||||
|
||||
const hr = Math.atan2(b, a);
|
||||
h = hr * 360 / 2 / Math.PI;
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const c = Math.sqrt(a * a + b * b);
|
||||
|
||||
return [l, c, h];
|
||||
};
|
||||
|
||||
convert.lch.lab = function (lch) {
|
||||
const l = lch[0];
|
||||
const c = lch[1];
|
||||
const h = lch[2];
|
||||
|
||||
const hr = h / 360 * 2 * Math.PI;
|
||||
const a = c * Math.cos(hr);
|
||||
const b = c * Math.sin(hr);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.rgb.ansi16 = function (args, saturation = null) {
|
||||
const [r, g, b] = args;
|
||||
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
||||
|
||||
value = Math.round(value / 50);
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
let ansi = 30
|
||||
+ ((Math.round(b / 255) << 2)
|
||||
| (Math.round(g / 255) << 1)
|
||||
| Math.round(r / 255));
|
||||
|
||||
if (value === 2) {
|
||||
ansi += 60;
|
||||
}
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.hsv.ansi16 = function (args) {
|
||||
// Optimization here; we already know the value and don't need to get
|
||||
// it converted for us.
|
||||
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||
};
|
||||
|
||||
convert.rgb.ansi256 = function (args) {
|
||||
const r = args[0];
|
||||
const g = args[1];
|
||||
const b = args[2];
|
||||
|
||||
// We use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (r === g && g === b) {
|
||||
if (r < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (r > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
const ansi = 16
|
||||
+ (36 * Math.round(r / 255 * 5))
|
||||
+ (6 * Math.round(g / 255 * 5))
|
||||
+ Math.round(b / 255 * 5);
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.ansi16.rgb = function (args) {
|
||||
let color = args % 10;
|
||||
|
||||
// Handle greyscale
|
||||
if (color === 0 || color === 7) {
|
||||
if (args > 50) {
|
||||
color += 3.5;
|
||||
}
|
||||
|
||||
color = color / 10.5 * 255;
|
||||
|
||||
return [color, color, color];
|
||||
}
|
||||
|
||||
const mult = (~~(args > 50) + 1) * 0.5;
|
||||
const r = ((color & 1) * mult) * 255;
|
||||
const g = (((color >> 1) & 1) * mult) * 255;
|
||||
const b = (((color >> 2) & 1) * mult) * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.ansi256.rgb = function (args) {
|
||||
// Handle greyscale
|
||||
if (args >= 232) {
|
||||
const c = (args - 232) * 10 + 8;
|
||||
return [c, c, c];
|
||||
}
|
||||
|
||||
args -= 16;
|
||||
|
||||
let rem;
|
||||
const r = Math.floor(args / 36) / 5 * 255;
|
||||
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||
const b = (rem % 6) / 5 * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hex = function (args) {
|
||||
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||
+ (Math.round(args[2]) & 0xFF);
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.hex.rgb = function (args) {
|
||||
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||
if (!match) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
let colorString = match[0];
|
||||
|
||||
if (match[0].length === 3) {
|
||||
colorString = colorString.split('').map(char => {
|
||||
return char + char;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
const integer = parseInt(colorString, 16);
|
||||
const r = (integer >> 16) & 0xFF;
|
||||
const g = (integer >> 8) & 0xFF;
|
||||
const b = integer & 0xFF;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hcg = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const max = Math.max(Math.max(r, g), b);
|
||||
const min = Math.min(Math.min(r, g), b);
|
||||
const chroma = (max - min);
|
||||
let grayscale;
|
||||
let hue;
|
||||
|
||||
if (chroma < 1) {
|
||||
grayscale = min / (1 - chroma);
|
||||
} else {
|
||||
grayscale = 0;
|
||||
}
|
||||
|
||||
if (chroma <= 0) {
|
||||
hue = 0;
|
||||
} else
|
||||
if (max === r) {
|
||||
hue = ((g - b) / chroma) % 6;
|
||||
} else
|
||||
if (max === g) {
|
||||
hue = 2 + (b - r) / chroma;
|
||||
} else {
|
||||
hue = 4 + (r - g) / chroma;
|
||||
}
|
||||
|
||||
hue /= 6;
|
||||
hue %= 1;
|
||||
|
||||
return [hue * 360, chroma * 100, grayscale * 100];
|
||||
};
|
||||
|
||||
convert.hsl.hcg = function (hsl) {
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
|
||||
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
||||
|
||||
let f = 0;
|
||||
if (c < 1.0) {
|
||||
f = (l - 0.5 * c) / (1.0 - c);
|
||||
}
|
||||
|
||||
return [hsl[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hsv.hcg = function (hsv) {
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
|
||||
const c = s * v;
|
||||
let f = 0;
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hsv[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hcg.rgb = function (hcg) {
|
||||
const h = hcg[0] / 360;
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
if (c === 0.0) {
|
||||
return [g * 255, g * 255, g * 255];
|
||||
}
|
||||
|
||||
const pure = [0, 0, 0];
|
||||
const hi = (h % 1) * 6;
|
||||
const v = hi % 1;
|
||||
const w = 1 - v;
|
||||
let mg = 0;
|
||||
|
||||
/* eslint-disable max-statements-per-line */
|
||||
switch (Math.floor(hi)) {
|
||||
case 0:
|
||||
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||
case 1:
|
||||
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||
case 2:
|
||||
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||
case 3:
|
||||
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||
case 4:
|
||||
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||
default:
|
||||
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line */
|
||||
|
||||
mg = (1.0 - c) * g;
|
||||
|
||||
return [
|
||||
(c * pure[0] + mg) * 255,
|
||||
(c * pure[1] + mg) * 255,
|
||||
(c * pure[2] + mg) * 255
|
||||
];
|
||||
};
|
||||
|
||||
convert.hcg.hsv = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const v = c + g * (1.0 - c);
|
||||
let f = 0;
|
||||
|
||||
if (v > 0.0) {
|
||||
f = c / v;
|
||||
}
|
||||
|
||||
return [hcg[0], f * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hsl = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const l = g * (1.0 - c) + 0.5 * c;
|
||||
let s = 0;
|
||||
|
||||
if (l > 0.0 && l < 0.5) {
|
||||
s = c / (2 * l);
|
||||
} else
|
||||
if (l >= 0.5 && l < 1.0) {
|
||||
s = c / (2 * (1 - l));
|
||||
}
|
||||
|
||||
return [hcg[0], s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hwb = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
const v = c + g * (1.0 - c);
|
||||
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||
};
|
||||
|
||||
convert.hwb.hcg = function (hwb) {
|
||||
const w = hwb[1] / 100;
|
||||
const b = hwb[2] / 100;
|
||||
const v = 1 - b;
|
||||
const c = v - w;
|
||||
let g = 0;
|
||||
|
||||
if (c < 1) {
|
||||
g = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hwb[0], c * 100, g * 100];
|
||||
};
|
||||
|
||||
convert.apple.rgb = function (apple) {
|
||||
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||
};
|
||||
|
||||
convert.rgb.apple = function (rgb) {
|
||||
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||
};
|
||||
|
||||
convert.gray.rgb = function (args) {
|
||||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||
};
|
||||
|
||||
convert.gray.hsl = function (args) {
|
||||
return [0, 0, args[0]];
|
||||
};
|
||||
|
||||
convert.gray.hsv = convert.gray.hsl;
|
||||
|
||||
convert.gray.hwb = function (gray) {
|
||||
return [0, 100, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.cmyk = function (gray) {
|
||||
return [0, 0, 0, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.lab = function (gray) {
|
||||
return [gray[0], 0, 0];
|
||||
};
|
||||
|
||||
convert.gray.hex = function (gray) {
|
||||
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||
const integer = (val << 16) + (val << 8) + val;
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.rgb.gray = function (rgb) {
|
||||
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||
return [val / 255 * 100];
|
||||
};
|
||||
@@ -0,0 +1,132 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/src/getEol.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> getEol.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { ParseRuntime } from "./ParseRuntime";
|
||||
//return first eol found from a data chunk.
|
||||
export default function (data: string, param: ParseRuntime): string {
|
||||
if (!param.eol && data) {
|
||||
for (var i = 0, len = data.length; i < len; i++) {
|
||||
if (data[i] === "\r") {
|
||||
if (data[i + 1] === "\n") {
|
||||
param.eol = "\r\n";
|
||||
break;
|
||||
} else if (data[i + 1]) {
|
||||
param.eol = "\r";
|
||||
break;
|
||||
}
|
||||
} else if (data[i] === "\n") {
|
||||
param.eol = "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return param.eol || "\n";
|
||||
};
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:20:20 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../sorter.js"></script>
|
||||
<script src="../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isDate;
|
||||
|
||||
var _merge = _interopRequireDefault(require("./util/merge"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
var default_date_options = {
|
||||
format: 'YYYY/MM/DD',
|
||||
delimiters: ['/', '-'],
|
||||
strictMode: false
|
||||
};
|
||||
|
||||
function isValidFormat(format) {
|
||||
return /(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(format);
|
||||
}
|
||||
|
||||
function zip(date, format) {
|
||||
var zippedArr = [],
|
||||
len = Math.min(date.length, format.length);
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
zippedArr.push([date[i], format[i]]);
|
||||
}
|
||||
|
||||
return zippedArr;
|
||||
}
|
||||
|
||||
function isDate(input, options) {
|
||||
if (typeof options === 'string') {
|
||||
// Allow backward compatbility for old format isDate(input [, format])
|
||||
options = (0, _merge.default)({
|
||||
format: options
|
||||
}, default_date_options);
|
||||
} else {
|
||||
options = (0, _merge.default)(options, default_date_options);
|
||||
}
|
||||
|
||||
if (typeof input === 'string' && isValidFormat(options.format)) {
|
||||
var formatDelimiter = options.delimiters.find(function (delimiter) {
|
||||
return options.format.indexOf(delimiter) !== -1;
|
||||
});
|
||||
var dateDelimiter = options.strictMode ? formatDelimiter : options.delimiters.find(function (delimiter) {
|
||||
return input.indexOf(delimiter) !== -1;
|
||||
});
|
||||
var dateAndFormat = zip(input.split(dateDelimiter), options.format.toLowerCase().split(formatDelimiter));
|
||||
var dateObj = {};
|
||||
|
||||
var _iterator = _createForOfIteratorHelper(dateAndFormat),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var _step$value = _slicedToArray(_step.value, 2),
|
||||
dateWord = _step$value[0],
|
||||
formatWord = _step$value[1];
|
||||
|
||||
if (dateWord.length !== formatWord.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dateObj[formatWord.charAt(0)] = dateWord;
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
|
||||
return new Date("".concat(dateObj.m, "/").concat(dateObj.d, "/").concat(dateObj.y)).getDate() === +dateObj.d;
|
||||
}
|
||||
|
||||
if (!options.strictMode) {
|
||||
return Object.prototype.toString.call(input) === '[object Date]' && isFinite(input);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { combineLatestAll } from './combineLatestAll';
|
||||
export const combineAll = combineLatestAll;
|
||||
//# sourceMappingURL=combineAll.js.map
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* `input` type prompt
|
||||
*/
|
||||
|
||||
import Input from './input.js';
|
||||
|
||||
/**
|
||||
* Extention of the Input prompt specifically for use with number inputs.
|
||||
*/
|
||||
|
||||
export default class NumberPrompt extends Input {
|
||||
filterInput(input) {
|
||||
if (input && typeof input === 'string') {
|
||||
input = input.trim();
|
||||
// Match a number in the input
|
||||
const numberMatch = input.match(/(^-?\d+|^-?\d+\.\d*|^\d*\.\d+)(e\d+)?$/);
|
||||
// If a number is found, return that input.
|
||||
if (numberMatch) {
|
||||
return Number(numberMatch[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// If the input was invalid return the default value.
|
||||
return this.opt.default == null ? NaN : this.opt.default;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,6 @@
|
||||
import assertString from './util/assertString';
|
||||
export var halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;
|
||||
export default function isHalfWidth(str) {
|
||||
assertString(str);
|
||||
return halfWidth.test(str);
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
const Renderer = require('./Renderer.js');
|
||||
const TextRenderer = require('./TextRenderer.js');
|
||||
const Slugger = require('./Slugger.js');
|
||||
const { defaults } = require('./defaults.js');
|
||||
const {
|
||||
unescape
|
||||
} = require('./helpers.js');
|
||||
|
||||
/**
|
||||
* Parsing & Compiling
|
||||
*/
|
||||
module.exports = class Parser {
|
||||
constructor(options) {
|
||||
this.options = options || defaults;
|
||||
this.options.renderer = this.options.renderer || new Renderer();
|
||||
this.renderer = this.options.renderer;
|
||||
this.renderer.options = this.options;
|
||||
this.textRenderer = new TextRenderer();
|
||||
this.slugger = new Slugger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Static Parse Method
|
||||
*/
|
||||
static parse(tokens, options) {
|
||||
const parser = new Parser(options);
|
||||
return parser.parse(tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Static Parse Inline Method
|
||||
*/
|
||||
static parseInline(tokens, options) {
|
||||
const parser = new Parser(options);
|
||||
return parser.parseInline(tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse Loop
|
||||
*/
|
||||
parse(tokens, top = true) {
|
||||
let out = '',
|
||||
i,
|
||||
j,
|
||||
k,
|
||||
l2,
|
||||
l3,
|
||||
row,
|
||||
cell,
|
||||
header,
|
||||
body,
|
||||
token,
|
||||
ordered,
|
||||
start,
|
||||
loose,
|
||||
itemBody,
|
||||
item,
|
||||
checked,
|
||||
task,
|
||||
checkbox;
|
||||
|
||||
const l = tokens.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
token = tokens[i];
|
||||
switch (token.type) {
|
||||
case 'space': {
|
||||
continue;
|
||||
}
|
||||
case 'hr': {
|
||||
out += this.renderer.hr();
|
||||
continue;
|
||||
}
|
||||
case 'heading': {
|
||||
out += this.renderer.heading(
|
||||
this.parseInline(token.tokens),
|
||||
token.depth,
|
||||
unescape(this.parseInline(token.tokens, this.textRenderer)),
|
||||
this.slugger);
|
||||
continue;
|
||||
}
|
||||
case 'code': {
|
||||
out += this.renderer.code(token.text,
|
||||
token.lang,
|
||||
token.escaped);
|
||||
continue;
|
||||
}
|
||||
case 'table': {
|
||||
header = '';
|
||||
|
||||
// header
|
||||
cell = '';
|
||||
l2 = token.header.length;
|
||||
for (j = 0; j < l2; j++) {
|
||||
cell += this.renderer.tablecell(
|
||||
this.parseInline(token.tokens.header[j]),
|
||||
{ header: true, align: token.align[j] }
|
||||
);
|
||||
}
|
||||
header += this.renderer.tablerow(cell);
|
||||
|
||||
body = '';
|
||||
l2 = token.cells.length;
|
||||
for (j = 0; j < l2; j++) {
|
||||
row = token.tokens.cells[j];
|
||||
|
||||
cell = '';
|
||||
l3 = row.length;
|
||||
for (k = 0; k < l3; k++) {
|
||||
cell += this.renderer.tablecell(
|
||||
this.parseInline(row[k]),
|
||||
{ header: false, align: token.align[k] }
|
||||
);
|
||||
}
|
||||
|
||||
body += this.renderer.tablerow(cell);
|
||||
}
|
||||
out += this.renderer.table(header, body);
|
||||
continue;
|
||||
}
|
||||
case 'blockquote': {
|
||||
body = this.parse(token.tokens);
|
||||
out += this.renderer.blockquote(body);
|
||||
continue;
|
||||
}
|
||||
case 'list': {
|
||||
ordered = token.ordered;
|
||||
start = token.start;
|
||||
loose = token.loose;
|
||||
l2 = token.items.length;
|
||||
|
||||
body = '';
|
||||
for (j = 0; j < l2; j++) {
|
||||
item = token.items[j];
|
||||
checked = item.checked;
|
||||
task = item.task;
|
||||
|
||||
itemBody = '';
|
||||
if (item.task) {
|
||||
checkbox = this.renderer.checkbox(checked);
|
||||
if (loose) {
|
||||
if (item.tokens.length > 0 && item.tokens[0].type === 'text') {
|
||||
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
||||
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
||||
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
||||
}
|
||||
} else {
|
||||
item.tokens.unshift({
|
||||
type: 'text',
|
||||
text: checkbox
|
||||
});
|
||||
}
|
||||
} else {
|
||||
itemBody += checkbox;
|
||||
}
|
||||
}
|
||||
|
||||
itemBody += this.parse(item.tokens, loose);
|
||||
body += this.renderer.listitem(itemBody, task, checked);
|
||||
}
|
||||
|
||||
out += this.renderer.list(body, ordered, start);
|
||||
continue;
|
||||
}
|
||||
case 'html': {
|
||||
// TODO parse inline content if parameter markdown=1
|
||||
out += this.renderer.html(token.text);
|
||||
continue;
|
||||
}
|
||||
case 'paragraph': {
|
||||
out += this.renderer.paragraph(this.parseInline(token.tokens));
|
||||
continue;
|
||||
}
|
||||
case 'text': {
|
||||
body = token.tokens ? this.parseInline(token.tokens) : token.text;
|
||||
while (i + 1 < l && tokens[i + 1].type === 'text') {
|
||||
token = tokens[++i];
|
||||
body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
|
||||
}
|
||||
out += top ? this.renderer.paragraph(body) : body;
|
||||
continue;
|
||||
}
|
||||
default: {
|
||||
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
||||
if (this.options.silent) {
|
||||
console.error(errMsg);
|
||||
return;
|
||||
} else {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse Inline Tokens
|
||||
*/
|
||||
parseInline(tokens, renderer) {
|
||||
renderer = renderer || this.renderer;
|
||||
let out = '',
|
||||
i,
|
||||
token;
|
||||
|
||||
const l = tokens.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
token = tokens[i];
|
||||
switch (token.type) {
|
||||
case 'escape': {
|
||||
out += renderer.text(token.text);
|
||||
break;
|
||||
}
|
||||
case 'html': {
|
||||
out += renderer.html(token.text);
|
||||
break;
|
||||
}
|
||||
case 'link': {
|
||||
out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
|
||||
break;
|
||||
}
|
||||
case 'image': {
|
||||
out += renderer.image(token.href, token.title, token.text);
|
||||
break;
|
||||
}
|
||||
case 'strong': {
|
||||
out += renderer.strong(this.parseInline(token.tokens, renderer));
|
||||
break;
|
||||
}
|
||||
case 'em': {
|
||||
out += renderer.em(this.parseInline(token.tokens, renderer));
|
||||
break;
|
||||
}
|
||||
case 'codespan': {
|
||||
out += renderer.codespan(token.text);
|
||||
break;
|
||||
}
|
||||
case 'br': {
|
||||
out += renderer.br();
|
||||
break;
|
||||
}
|
||||
case 'del': {
|
||||
out += renderer.del(this.parseInline(token.tokens, renderer));
|
||||
break;
|
||||
}
|
||||
case 'text': {
|
||||
out += renderer.text(token.text);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
||||
if (this.options.silent) {
|
||||
console.error(errMsg);
|
||||
return;
|
||||
} else {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user