new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D E F A B C K L G M EC FC","4":"N O w g","194":"0 1 2 3 4 5 6 7 8 9 x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d"},D:{"1":"eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB","66":"WB XB YB uB ZB vB aB bB cB dB"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB PC QC RC SC qB AC TC rB","66":"JB KB LB MB NB OB PB QB RB SB"},G:{"1":"gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I wC xC yC zC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"194":"AD BD"}},B:1,C:"inputmode attribute"};
|
||||
@@ -0,0 +1,30 @@
|
||||
module.exports = {
|
||||
'countBy': require('./countBy'),
|
||||
'each': require('./each'),
|
||||
'eachRight': require('./eachRight'),
|
||||
'every': require('./every'),
|
||||
'filter': require('./filter'),
|
||||
'find': require('./find'),
|
||||
'findLast': require('./findLast'),
|
||||
'flatMap': require('./flatMap'),
|
||||
'flatMapDeep': require('./flatMapDeep'),
|
||||
'flatMapDepth': require('./flatMapDepth'),
|
||||
'forEach': require('./forEach'),
|
||||
'forEachRight': require('./forEachRight'),
|
||||
'groupBy': require('./groupBy'),
|
||||
'includes': require('./includes'),
|
||||
'invokeMap': require('./invokeMap'),
|
||||
'keyBy': require('./keyBy'),
|
||||
'map': require('./map'),
|
||||
'orderBy': require('./orderBy'),
|
||||
'partition': require('./partition'),
|
||||
'reduce': require('./reduce'),
|
||||
'reduceRight': require('./reduceRight'),
|
||||
'reject': require('./reject'),
|
||||
'sample': require('./sample'),
|
||||
'sampleSize': require('./sampleSize'),
|
||||
'shuffle': require('./shuffle'),
|
||||
'size': require('./size'),
|
||||
'some': require('./some'),
|
||||
'sortBy': require('./sortBy')
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-add
|
||||
|
||||
module.exports = function NumberAdd(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
if (isNaN(x) || isNaN(y) || (x === Infinity && y === -Infinity) || (x === -Infinity && y === Infinity)) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
if ((x === Infinity && y === Infinity) || (x === -Infinity && y === -Infinity)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
if (x === Infinity) {
|
||||
return x;
|
||||
}
|
||||
|
||||
if (y === Infinity) {
|
||||
return y;
|
||||
}
|
||||
|
||||
if (x === y && x === 0) {
|
||||
return Infinity / x === -Infinity && Infinity / y === -Infinity ? -0 : +0;
|
||||
}
|
||||
|
||||
if (x === -y || -x === y) {
|
||||
return +0;
|
||||
}
|
||||
|
||||
// shortcut for the actual spec mechanics
|
||||
return x + y;
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
# 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.1.0](https://github.com/medikoo/next-tick/compare/v1.0.0...v1.1.0) (2020-02-11)
|
||||
|
||||
### Features
|
||||
|
||||
* Add support for queueMicrotask (Closes [#13](https://github.com/medikoo/next-tick/issues/13)) ([471986e](https://github.com/medikoo/next-tick/commit/471986ee5f7179a498850cc03138a5ed5b9a248c))
|
||||
|
||||
## Changelog for previous versions
|
||||
|
||||
See `CHANGES` file
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('differenceWith', require('../differenceWith'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var loader = require('./lib/loader');
|
||||
var dumper = require('./lib/dumper');
|
||||
|
||||
|
||||
function renamed(from, to) {
|
||||
return function () {
|
||||
throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
|
||||
'Use yaml.' + to + ' instead, which is now safe by default.');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
module.exports.Type = require('./lib/type');
|
||||
module.exports.Schema = require('./lib/schema');
|
||||
module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe');
|
||||
module.exports.JSON_SCHEMA = require('./lib/schema/json');
|
||||
module.exports.CORE_SCHEMA = require('./lib/schema/core');
|
||||
module.exports.DEFAULT_SCHEMA = require('./lib/schema/default');
|
||||
module.exports.load = loader.load;
|
||||
module.exports.loadAll = loader.loadAll;
|
||||
module.exports.dump = dumper.dump;
|
||||
module.exports.YAMLException = require('./lib/exception');
|
||||
|
||||
// Re-export all types in case user wants to create custom schema
|
||||
module.exports.types = {
|
||||
binary: require('./lib/type/binary'),
|
||||
float: require('./lib/type/float'),
|
||||
map: require('./lib/type/map'),
|
||||
null: require('./lib/type/null'),
|
||||
pairs: require('./lib/type/pairs'),
|
||||
set: require('./lib/type/set'),
|
||||
timestamp: require('./lib/type/timestamp'),
|
||||
bool: require('./lib/type/bool'),
|
||||
int: require('./lib/type/int'),
|
||||
merge: require('./lib/type/merge'),
|
||||
omap: require('./lib/type/omap'),
|
||||
seq: require('./lib/type/seq'),
|
||||
str: require('./lib/type/str')
|
||||
};
|
||||
|
||||
// Removed functions from JS-YAML 3.0.x
|
||||
module.exports.safeLoad = renamed('safeLoad', 'load');
|
||||
module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll');
|
||||
module.exports.safeDump = renamed('safeDump', 'dump');
|
||||
@@ -0,0 +1,161 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
elementSelectorParser: ()=>elementSelectorParser,
|
||||
default: ()=>resolveDefaultsAtRules
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _featureFlags = require("../featureFlags");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let getNode = {
|
||||
id (node) {
|
||||
return _postcssSelectorParser.default.attribute({
|
||||
attribute: "id",
|
||||
operator: "=",
|
||||
value: node.value,
|
||||
quoteMark: '"'
|
||||
});
|
||||
}
|
||||
};
|
||||
function minimumImpactSelector(nodes) {
|
||||
let rest = nodes.filter((node)=>{
|
||||
// Keep non-pseudo nodes
|
||||
if (node.type !== "pseudo") return true;
|
||||
// Keep pseudo nodes that have subnodes
|
||||
// E.g.: `:not()` contains subnodes inside the parentheses
|
||||
if (node.nodes.length > 0) return true;
|
||||
// Keep pseudo `elements`
|
||||
// This implicitly means that we ignore pseudo `classes`
|
||||
return node.value.startsWith("::") || [
|
||||
":before",
|
||||
":after",
|
||||
":first-line",
|
||||
":first-letter"
|
||||
].includes(node.value);
|
||||
}).reverse();
|
||||
let searchFor = new Set([
|
||||
"tag",
|
||||
"class",
|
||||
"id",
|
||||
"attribute"
|
||||
]);
|
||||
let splitPointIdx = rest.findIndex((n)=>searchFor.has(n.type));
|
||||
if (splitPointIdx === -1) return rest.reverse().join("").trim();
|
||||
let node = rest[splitPointIdx];
|
||||
let bestNode = getNode[node.type] ? getNode[node.type](node) : node;
|
||||
rest = rest.slice(0, splitPointIdx);
|
||||
let combinatorIdx = rest.findIndex((n)=>n.type === "combinator" && n.value === ">");
|
||||
if (combinatorIdx !== -1) {
|
||||
rest.splice(0, combinatorIdx);
|
||||
rest.unshift(_postcssSelectorParser.default.universal());
|
||||
}
|
||||
return [
|
||||
bestNode,
|
||||
...rest.reverse()
|
||||
].join("").trim();
|
||||
}
|
||||
let elementSelectorParser = (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
return selectors.map((s)=>{
|
||||
let nodes = s.split((n)=>n.type === "combinator" && n.value === " ").pop();
|
||||
return minimumImpactSelector(nodes);
|
||||
});
|
||||
});
|
||||
let cache = new Map();
|
||||
function extractElementSelector(selector) {
|
||||
if (!cache.has(selector)) {
|
||||
cache.set(selector, elementSelectorParser.transformSync(selector));
|
||||
}
|
||||
return cache.get(selector);
|
||||
}
|
||||
function resolveDefaultsAtRules({ tailwindConfig }) {
|
||||
return (root)=>{
|
||||
let variableNodeMap = new Map();
|
||||
/** @type {Set<import('postcss').AtRule>} */ let universals = new Set();
|
||||
root.walkAtRules("defaults", (rule)=>{
|
||||
if (rule.nodes && rule.nodes.length > 0) {
|
||||
universals.add(rule);
|
||||
return;
|
||||
}
|
||||
let variable = rule.params;
|
||||
if (!variableNodeMap.has(variable)) {
|
||||
variableNodeMap.set(variable, new Set());
|
||||
}
|
||||
variableNodeMap.get(variable).add(rule.parent);
|
||||
rule.remove();
|
||||
});
|
||||
if ((0, _featureFlags.flagEnabled)(tailwindConfig, "optimizeUniversalDefaults")) {
|
||||
for (let universal of universals){
|
||||
/** @type {Map<string, Set<string>>} */ let selectorGroups = new Map();
|
||||
var _variableNodeMap_get;
|
||||
let rules = (_variableNodeMap_get = variableNodeMap.get(universal.params)) !== null && _variableNodeMap_get !== void 0 ? _variableNodeMap_get : [];
|
||||
for (let rule of rules){
|
||||
for (let selector of extractElementSelector(rule.selector)){
|
||||
// If selector contains a vendor prefix after a pseudo element or class,
|
||||
// we consider them separately because merging the declarations into
|
||||
// a single rule will cause browsers that do not understand the
|
||||
// vendor prefix to throw out the whole rule
|
||||
let selectorGroupName = selector.includes(":-") || selector.includes("::-") ? selector : "__DEFAULT__";
|
||||
var _selectorGroups_get;
|
||||
let selectors = (_selectorGroups_get = selectorGroups.get(selectorGroupName)) !== null && _selectorGroups_get !== void 0 ? _selectorGroups_get : new Set();
|
||||
selectorGroups.set(selectorGroupName, selectors);
|
||||
selectors.add(selector);
|
||||
}
|
||||
}
|
||||
if ((0, _featureFlags.flagEnabled)(tailwindConfig, "optimizeUniversalDefaults")) {
|
||||
if (selectorGroups.size === 0) {
|
||||
universal.remove();
|
||||
continue;
|
||||
}
|
||||
for (let [, selectors1] of selectorGroups){
|
||||
let universalRule = _postcss.default.rule({
|
||||
source: universal.source
|
||||
});
|
||||
universalRule.selectors = [
|
||||
...selectors1
|
||||
];
|
||||
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
||||
universal.before(universalRule);
|
||||
}
|
||||
}
|
||||
universal.remove();
|
||||
}
|
||||
} else if (universals.size) {
|
||||
let universalRule1 = _postcss.default.rule({
|
||||
selectors: [
|
||||
"*",
|
||||
"::before",
|
||||
"::after"
|
||||
]
|
||||
});
|
||||
for (let universal1 of universals){
|
||||
universalRule1.append(universal1.nodes);
|
||||
if (!universalRule1.parent) {
|
||||
universal1.before(universalRule1);
|
||||
}
|
||||
if (!universalRule1.source) {
|
||||
universalRule1.source = universal1.source;
|
||||
}
|
||||
universal1.remove();
|
||||
}
|
||||
let backdropRule = universalRule1.clone({
|
||||
selectors: [
|
||||
"::backdrop"
|
||||
]
|
||||
});
|
||||
universalRule1.after(backdropRule);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PartitionPattern.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/PartitionPattern.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,OAAO,EAAE,MAAM,GACd,KAAK,CAAC;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAC,CA6B7C"}
|
||||
@@ -0,0 +1,9 @@
|
||||
var test = require('tap').test;
|
||||
var detective = require('../');
|
||||
var fs = require('fs');
|
||||
var src = fs.readFileSync(__dirname + '/files/yield.js');
|
||||
|
||||
test('yield', function (t) {
|
||||
t.plan(1);
|
||||
t.deepEqual(detective(src), [ 'a', 'c' ]);
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { noop } from '../util/noop';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
export function distinct(keySelector, flushes) {
|
||||
return operate((source, subscriber) => {
|
||||
const distinctKeys = new Set();
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
const key = keySelector ? keySelector(value) : value;
|
||||
if (!distinctKeys.has(key)) {
|
||||
distinctKeys.add(key);
|
||||
subscriber.next(value);
|
||||
}
|
||||
}));
|
||||
flushes && innerFrom(flushes).subscribe(createOperatorSubscriber(subscriber, () => distinctKeys.clear(), noop));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=distinct.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"supports-color","version":"5.5.0","files":{"browser.js":{"checkedAt":1678883669468,"integrity":"sha512-X6Ea15rSJ8d9H1fH7J9zYHPykZuKz90j7HQ7UAvbM1+XwcH/5yHw7/EWUCRV8x+ZpDRKDZypfFu1x+Lr1UEIuw==","mode":420,"size":67},"license":{"checkedAt":1678883669272,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"package.json":{"checkedAt":1678883670599,"integrity":"sha512-zrvNN2iRJDrUeeD09SwnpZO5mMcu3AV7wUT3g0ZHZudkWkflSX1hqDEEFtLBFPkPMH4/dcpPH7vpWwVbBJ9e/w==","mode":420,"size":818},"index.js":{"checkedAt":1678883670599,"integrity":"sha512-SooNOlKq4lnF3kSWze0xjGjmSGqOLZmMXkgZlX59lDsteY2lqxlxmqMtbdYIWe508SmDkLmvfB8837ee29GdZQ==","mode":420,"size":2771},"readme.md":{"checkedAt":1678883670599,"integrity":"sha512-bA4SyTjFfUbEl1QHZXhV5pYZrDAkL+RfiWYqMwnLPWP1s4cvwnGsySIHBJ+O/nFbGVRv1OUI/4DwGSU07uEZhw==","mode":420,"size":1865}}}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { innerFrom } from './innerFrom';
|
||||
import { EMPTY } from './empty';
|
||||
export function using(resourceFactory, observableFactory) {
|
||||
return new Observable(function (subscriber) {
|
||||
var resource = resourceFactory();
|
||||
var result = observableFactory(resource);
|
||||
var source = result ? innerFrom(result) : EMPTY;
|
||||
source.subscribe(subscriber);
|
||||
return function () {
|
||||
if (resource) {
|
||||
resource.unsubscribe();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=using.js.map
|
||||
@@ -0,0 +1,25 @@
|
||||
var baseSortedIndex = require('./_baseSortedIndex');
|
||||
|
||||
/**
|
||||
* This method is like `_.sortedIndex` except that it returns the highest
|
||||
* index at which `value` should be inserted into `array` in order to
|
||||
* maintain its sort order.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The sorted array to inspect.
|
||||
* @param {*} value The value to evaluate.
|
||||
* @returns {number} Returns the index at which `value` should be inserted
|
||||
* into `array`.
|
||||
* @example
|
||||
*
|
||||
* _.sortedLastIndex([4, 5, 5, 5, 6], 5);
|
||||
* // => 4
|
||||
*/
|
||||
function sortedLastIndex(array, value) {
|
||||
return baseSortedIndex(array, value, true);
|
||||
}
|
||||
|
||||
module.exports = sortedLastIndex;
|
||||
@@ -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,UAAC,MAAM;QACZ,IAAM,OAAO,GAAG,IAAI,YAAY,EAAK,CAAC;QACtC,OAAO,IAAI,qBAAqB,CAAC,MAAM,EAAE,cAAM,OAAA,OAAO,EAAP,CAAO,CAAC,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./initial');
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.operate = exports.hasLift = void 0;
|
||||
var isFunction_1 = require("./isFunction");
|
||||
function hasLift(source) {
|
||||
return isFunction_1.isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
||||
}
|
||||
exports.hasLift = hasLift;
|
||||
function operate(init) {
|
||||
return function (source) {
|
||||
if (hasLift(source)) {
|
||||
return source.lift(function (liftedSource) {
|
||||
try {
|
||||
return init(liftedSource, this);
|
||||
}
|
||||
catch (err) {
|
||||
this.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
throw new TypeError('Unable to lift unknown Observable type');
|
||||
};
|
||||
}
|
||||
exports.operate = operate;
|
||||
//# sourceMappingURL=lift.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.08736,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.0046,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.0046,"69":0,"70":0,"71":0,"72":0.0046,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.0092,"79":0.0046,"80":0.0046,"81":0.0046,"82":0.0046,"83":0.0046,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.01379,"92":0,"93":0,"94":0,"95":0.01839,"96":0.01839,"97":0.0046,"98":0,"99":0.0092,"100":0,"101":0.01379,"102":0.02759,"103":0.0046,"104":0.0092,"105":0.01379,"106":0.0092,"107":0.01379,"108":0.02759,"109":0.86442,"110":0.42302,"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.0092,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.02759,"50":0,"51":0.0046,"52":0,"53":0.02759,"54":0,"55":0.0046,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0.0046,"62":0,"63":0,"64":0,"65":0.03219,"66":0,"67":0.0046,"68":0,"69":0.0046,"70":0.0046,"71":0.0046,"72":0,"73":0,"74":0.0046,"75":0.0046,"76":0.0046,"77":0.01379,"78":0.0046,"79":0.02759,"80":0.0046,"81":0.03219,"83":0.02299,"84":0.03219,"85":0.04598,"86":0.03219,"87":0.02759,"88":0.02299,"89":0.01839,"90":0.0092,"91":0.01379,"92":0.03219,"93":0.03219,"94":0.0092,"95":0.0092,"96":0.0092,"97":0.01379,"98":0.0092,"99":0.02299,"100":0.03678,"101":0.03219,"102":0.07817,"103":0.02759,"104":0.02759,"105":0.03219,"106":0.06437,"107":0.09196,"108":0.26209,"109":6.35903,"110":3.30136,"111":0.01379,"112":0.0046,"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,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0.02759,"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.0046,"54":0,"55":0,"56":0.0046,"57":0,"58":0,"60":0.0046,"62":0,"63":0,"64":0.0046,"65":0,"66":0.01379,"67":0.03678,"68":0,"69":0.0046,"70":0,"71":0,"72":0.0046,"73":0.0046,"74":0.0092,"75":0.0046,"76":0,"77":0,"78":0,"79":0.01839,"80":0.0046,"81":0.0092,"82":0.01379,"83":0.01839,"84":0.0092,"85":0.07357,"86":0.01839,"87":0.0092,"88":0,"89":0.02759,"90":0.0046,"91":0.0046,"92":0.01839,"93":0.05518,"94":1.00696,"95":1.23686,"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.0092},B:{"12":0,"13":0,"14":0,"15":0.0046,"16":0,"17":0,"18":0.01379,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0.0046,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.0046,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.0046,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.01379,"108":0.0092,"109":0.37244,"110":0.44601},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.02759,"15":0.0046,_:"0","3.1":0,"3.2":0,"5.1":0.0092,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.01379,"13.1":0.02299,"14.1":0.03219,"15.1":0.0092,"15.2-15.3":0.01839,"15.4":0.04138,"15.5":0.09196,"15.6":0.44141,"16.0":0.08736,"16.1":0.16553,"16.2":0.51038,"16.3":0.43681,"16.4":0.0046},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,"8.1-8.4":0,"9.0-9.2":0.00541,"9.3":0.03788,"10.0-10.2":0.01082,"10.3":0.02976,"11.0-11.2":0.0514,"11.3-11.4":0.00271,"12.0-12.1":0.02435,"12.2-12.5":0.26514,"13.0-13.1":0.00812,"13.2":0.01082,"13.3":0.04329,"13.4-13.7":0.11093,"14.0-14.4":0.27596,"14.5-14.8":0.63038,"15.0-15.1":0.2435,"15.2-15.3":0.28408,"15.4":0.25973,"15.5":0.6872,"15.6":2.13194,"16.0":3.17897,"16.1":6.32548,"16.2":5.74109,"16.3":4.28552,"16.4":0.01894},P:{"4":0.0908,"20":0.26231,"5.0-5.4":0.01009,"6.2-6.4":0.2724,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01009,"12.0":0,"13.0":0.01009,"14.0":0.02018,"15.0":0.01009,"16.0":0.02018,"17.0":0.02018,"18.0":0.03027,"19.0":0.61543},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.002,"4.2-4.3":0.01596,"4.4":0,"4.4.3-4.4.4":0.07583},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.0092,"9":0,"10":0,"11":0.11495,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.0054,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.22148},H:{"0":1.08934},L:{"0":47.63517},R:{_:"0"},M:{"0":0.09724},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
function findRelation_upToPath(urlObj, siteUrlObj, options)
|
||||
{
|
||||
// Path- or root-relative URL
|
||||
var pathOnly = urlObj.extra.hrefInfo.minimumPathOnly;
|
||||
|
||||
// Matching scheme, scheme-relative or path-only
|
||||
var minimumScheme = (urlObj.scheme===siteUrlObj.scheme || !urlObj.scheme);
|
||||
|
||||
// Matching auth, ignoring auth or path-only
|
||||
var minimumAuth = minimumScheme && (urlObj.auth===siteUrlObj.auth || options.removeAuth || pathOnly);
|
||||
|
||||
// Matching host or path-only
|
||||
var www = options.ignore_www ? "stripped" : "full";
|
||||
var minimumHost = minimumAuth && (urlObj.host[www]===siteUrlObj.host[www] || pathOnly);
|
||||
|
||||
// Matching port or path-only
|
||||
var minimumPort = minimumHost && (urlObj.port===siteUrlObj.port || pathOnly);
|
||||
|
||||
urlObj.extra.relation.minimumScheme = minimumScheme;
|
||||
urlObj.extra.relation.minimumAuth = minimumAuth;
|
||||
urlObj.extra.relation.minimumHost = minimumHost;
|
||||
urlObj.extra.relation.minimumPort = minimumPort;
|
||||
|
||||
urlObj.extra.relation.maximumScheme = !minimumScheme || minimumScheme && !minimumAuth;
|
||||
urlObj.extra.relation.maximumAuth = !minimumScheme || minimumScheme && !minimumHost;
|
||||
urlObj.extra.relation.maximumHost = !minimumScheme || minimumScheme && !minimumPort;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function findRelation_pathOn(urlObj, siteUrlObj, options)
|
||||
{
|
||||
var queryOnly = urlObj.extra.hrefInfo.minimumQueryOnly;
|
||||
var hashOnly = urlObj.extra.hrefInfo.minimumHashOnly;
|
||||
var empty = urlObj.extra.hrefInfo.empty; // not required, but self-documenting
|
||||
|
||||
// From upToPath()
|
||||
var minimumPort = urlObj.extra.relation.minimumPort;
|
||||
var minimumScheme = urlObj.extra.relation.minimumScheme;
|
||||
|
||||
// Matching port and path
|
||||
var minimumPath = minimumPort && urlObj.path.absolute.string===siteUrlObj.path.absolute.string;
|
||||
|
||||
// Matching resource or query/hash-only or empty
|
||||
var matchingResource = (urlObj.resource===siteUrlObj.resource || !urlObj.resource && siteUrlObj.extra.resourceIsIndex) || (options.removeDirectoryIndexes && urlObj.extra.resourceIsIndex && !siteUrlObj.resource);
|
||||
var minimumResource = minimumPath && (matchingResource || queryOnly || hashOnly || empty);
|
||||
|
||||
// Matching query or hash-only/empty
|
||||
var query = options.removeEmptyQueries ? "stripped" : "full";
|
||||
var urlQuery = urlObj.query.string[query];
|
||||
var siteUrlQuery = siteUrlObj.query.string[query];
|
||||
var minimumQuery = (minimumResource && !!urlQuery && urlQuery===siteUrlQuery) || ((hashOnly || empty) && !urlObj.extra.hrefInfo.separatorOnlyQuery);
|
||||
|
||||
var minimumHash = minimumQuery && urlObj.hash===siteUrlObj.hash;
|
||||
|
||||
urlObj.extra.relation.minimumPath = minimumPath;
|
||||
urlObj.extra.relation.minimumResource = minimumResource;
|
||||
urlObj.extra.relation.minimumQuery = minimumQuery;
|
||||
urlObj.extra.relation.minimumHash = minimumHash;
|
||||
|
||||
urlObj.extra.relation.maximumPort = !minimumScheme || minimumScheme && !minimumPath;
|
||||
urlObj.extra.relation.maximumPath = !minimumScheme || minimumScheme && !minimumResource;
|
||||
urlObj.extra.relation.maximumResource = !minimumScheme || minimumScheme && !minimumQuery;
|
||||
urlObj.extra.relation.maximumQuery = !minimumScheme || minimumScheme && !minimumHash;
|
||||
urlObj.extra.relation.maximumHash = !minimumScheme || minimumScheme && !minimumHash; // there's nothing after hash, so it's the same as maximumQuery
|
||||
|
||||
// Matching path and/or resource with existing but non-matching site query
|
||||
urlObj.extra.relation.overridesQuery = minimumPath && urlObj.extra.relation.maximumResource && !minimumQuery && !!siteUrlQuery;
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports =
|
||||
{
|
||||
pathOn: findRelation_pathOn,
|
||||
upToPath: findRelation_upToPath
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultIfEmpty.js","sourceRoot":"","sources":["../../../../src/internal/operators/defaultIfEmpty.ts"],"names":[],"mappings":";;;AACA,qCAAuC;AACvC,2DAAgE;AAqChE,SAAgB,cAAc,CAAO,YAAe;IAClD,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EACV,UAAC,KAAK;YACJ,QAAQ,GAAG,IAAI,CAAC;YAChB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,EACD;YACE,IAAI,CAAC,QAAQ,EAAE;gBACb,UAAU,CAAC,IAAI,CAAC,YAAa,CAAC,CAAC;aAChC;YACD,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,wCAmBC"}
|
||||
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"name": "rollup",
|
||||
"version": "2.79.1",
|
||||
"description": "Next-generation ES module bundler",
|
||||
"main": "dist/rollup.js",
|
||||
"module": "dist/es/rollup.js",
|
||||
"typings": "dist/rollup.d.ts",
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "shx rm -rf dist && node scripts/update-git-commit.js && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
|
||||
"build:cjs": "shx rm -rf dist && rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
|
||||
"build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup && cp -r dist browser/",
|
||||
"ci:lint": "npm run lint:nofix",
|
||||
"ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all",
|
||||
"ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only",
|
||||
"ci:coverage": "npm run build:cjs && npm run build:bootstrap && nyc --reporter lcovonly mocha",
|
||||
"lint": "eslint . --fix --cache && prettier --write \"**/*.md\"",
|
||||
"lint:nofix": "eslint . --cache && prettier --check \"**/*.md\"",
|
||||
"lint:markdown": "prettier --write \"**/*.md\"",
|
||||
"perf": "npm run build:cjs && node --expose-gc scripts/perf.js",
|
||||
"perf:debug": "node --inspect-brk scripts/perf-debug.js",
|
||||
"perf:init": "node scripts/perf-init.js",
|
||||
"postpublish": "git push && git push --tags",
|
||||
"prepare": "husky install && npm run build",
|
||||
"prepublishOnly": "git pull --ff-only && npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all",
|
||||
"security": "npm audit",
|
||||
"test": "npm run build && npm run test:all",
|
||||
"test:cjs": "npm run build:cjs && npm run test:only",
|
||||
"test:quick": "mocha -b test/test.js",
|
||||
"test:all": "npm run test:only && npm run test:browser && npm run test:typescript && npm run test:leak && npm run test:package",
|
||||
"test:coverage": "npm run build:cjs && shx rm -rf coverage/* && nyc --reporter html mocha test/test.js",
|
||||
"test:coverage:browser": "npm run build && shx rm -rf coverage/* && nyc mocha test/browser/index.js",
|
||||
"test:leak": "node --expose-gc test/leak/index.js",
|
||||
"test:package": "node scripts/test-package.js",
|
||||
"test:only": "mocha test/test.js",
|
||||
"test:typescript": "shx rm -rf test/typescript/dist && shx cp -r dist test/typescript/ && tsc --noEmit -p test/typescript && tsc --noEmit",
|
||||
"test:browser": "mocha test/browser/index.js",
|
||||
"watch": "rollup --config rollup.config.ts --configPlugin typescript --watch"
|
||||
},
|
||||
"repository": "rollup/rollup",
|
||||
"keywords": [
|
||||
"modules",
|
||||
"bundler",
|
||||
"bundling",
|
||||
"es6",
|
||||
"optimizer"
|
||||
],
|
||||
"author": "Rich Harris",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/rollup/rollup/issues"
|
||||
},
|
||||
"homepage": "https://rollupjs.org/",
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-alias": "^3.1.9",
|
||||
"@rollup/plugin-buble": "^0.21.3",
|
||||
"@rollup/plugin-commonjs": "^22.0.1",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"@rollup/plugin-typescript": "^8.3.3",
|
||||
"@rollup/pluginutils": "^4.2.1",
|
||||
"@types/estree": "0.0.52",
|
||||
"@types/node": "^10.17.60",
|
||||
"@types/signal-exit": "^3.0.1",
|
||||
"@types/yargs-parser": "^20.2.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
||||
"@typescript-eslint/parser": "^5.30.7",
|
||||
"acorn": "^8.7.1",
|
||||
"acorn-jsx": "^5.3.2",
|
||||
"acorn-walk": "^8.2.0",
|
||||
"buble": "^0.20.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"colorette": "^2.0.19",
|
||||
"core-js": "^3.23.5",
|
||||
"date-time": "^4.0.0",
|
||||
"es5-shim": "^4.6.7",
|
||||
"es6-shim": "^0.35.6",
|
||||
"eslint": "^8.20.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"execa": "^5.1.1",
|
||||
"fixturify": "^2.1.1",
|
||||
"fs-extra": "^10.1.0",
|
||||
"hash.js": "^1.1.7",
|
||||
"husky": "^7.0.4",
|
||||
"is-reference": "^3.0.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"locate-character": "^2.0.5",
|
||||
"magic-string": "^0.26.2",
|
||||
"mocha": "^9.2.2",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^2.7.1",
|
||||
"pretty-bytes": "^5.6.0",
|
||||
"pretty-ms": "^7.0.1",
|
||||
"requirejs": "^2.3.6",
|
||||
"rollup": "^2.77.0",
|
||||
"rollup-plugin-license": "^2.8.1",
|
||||
"rollup-plugin-string": "^3.0.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-thatworks": "^1.0.4",
|
||||
"shx": "^0.3.4",
|
||||
"signal-exit": "^3.0.7",
|
||||
"source-map": "^0.7.4",
|
||||
"source-map-support": "^0.5.21",
|
||||
"sourcemap-codec": "^1.4.8",
|
||||
"systemjs": "^6.12.1",
|
||||
"terser": "^5.14.2",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^4.7.4",
|
||||
"weak-napi": "^2.0.2",
|
||||
"yargs-parser": "^20.2.9"
|
||||
},
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"dist/*.d.ts",
|
||||
"dist/bin/rollup",
|
||||
"dist/es/package.json",
|
||||
"dist/rollup.browser.js.map"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/rollup.d.ts",
|
||||
"node": {
|
||||
"require": "./dist/rollup.js",
|
||||
"import": "./dist/es/rollup.js"
|
||||
},
|
||||
"default": "./dist/es/rollup.browser.js"
|
||||
},
|
||||
"./loadConfigFile": "./dist/loadConfigFile.js",
|
||||
"./dist/loadConfigFile": "./dist/loadConfigFile.js",
|
||||
"./dist/*": "./dist/*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-ispropertykey
|
||||
|
||||
module.exports = function IsPropertyKey(argument) {
|
||||
return typeof argument === 'string' || typeof argument === 'symbol';
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('nthArg', require('../nthArg'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"QueueScheduler.d.ts","sourceRoot":"","sources":["../../../../src/internal/scheduler/QueueScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,cAAe,SAAQ,cAAc;CACjD"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"time-data.generated.d.ts","sourceRoot":"","sources":["../../../../../packages/icu-messageformat-parser/time-data.generated.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAwzC7C,CAAC"}
|
||||
@@ -0,0 +1,21 @@
|
||||
var baseEach = require('./_baseEach');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.every` without support for iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
||||
* else `false`
|
||||
*/
|
||||
function baseEvery(collection, predicate) {
|
||||
var result = true;
|
||||
baseEach(collection, function(value, index, collection) {
|
||||
result = !!predicate(value, index, collection);
|
||||
return result;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseEvery;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { mergeMap } from './mergeMap';
|
||||
|
||||
/**
|
||||
* @deprecated Renamed to {@link mergeMap}. Will be removed in v8.
|
||||
*/
|
||||
export const flatMap = mergeMap;
|
||||
@@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
var Mutation = global.MutationObserver || global.WebKitMutationObserver;
|
||||
|
||||
var scheduleDrain;
|
||||
|
||||
{
|
||||
if (Mutation) {
|
||||
var called = 0;
|
||||
var observer = new Mutation(nextTick);
|
||||
var element = global.document.createTextNode('');
|
||||
observer.observe(element, {
|
||||
characterData: true
|
||||
});
|
||||
scheduleDrain = function () {
|
||||
element.data = (called = ++called % 2);
|
||||
};
|
||||
} else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
|
||||
var channel = new global.MessageChannel();
|
||||
channel.port1.onmessage = nextTick;
|
||||
scheduleDrain = function () {
|
||||
channel.port2.postMessage(0);
|
||||
};
|
||||
} else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
|
||||
scheduleDrain = function () {
|
||||
|
||||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||||
var scriptEl = global.document.createElement('script');
|
||||
scriptEl.onreadystatechange = function () {
|
||||
nextTick();
|
||||
|
||||
scriptEl.onreadystatechange = null;
|
||||
scriptEl.parentNode.removeChild(scriptEl);
|
||||
scriptEl = null;
|
||||
};
|
||||
global.document.documentElement.appendChild(scriptEl);
|
||||
};
|
||||
} else {
|
||||
scheduleDrain = function () {
|
||||
setTimeout(nextTick, 0);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var draining;
|
||||
var queue = [];
|
||||
//named nextTick for less confusing stack traces
|
||||
function nextTick() {
|
||||
draining = true;
|
||||
var i, oldQueue;
|
||||
var len = queue.length;
|
||||
while (len) {
|
||||
oldQueue = queue;
|
||||
queue = [];
|
||||
i = -1;
|
||||
while (++i < len) {
|
||||
oldQueue[i]();
|
||||
}
|
||||
len = queue.length;
|
||||
}
|
||||
draining = false;
|
||||
}
|
||||
|
||||
module.exports = immediate;
|
||||
function immediate(task) {
|
||||
if (queue.push(task) === 1 && !draining) {
|
||||
scheduleDrain();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-isvalidtimezonename
|
||||
* @param tz
|
||||
* @param implDetails implementation details
|
||||
*/
|
||||
export declare function IsValidTimeZoneName(tz: string, { tzData, uppercaseLinks, }: {
|
||||
tzData: Record<string, unknown>;
|
||||
uppercaseLinks: Record<string, string>;
|
||||
}): boolean;
|
||||
//# sourceMappingURL=IsValidTimeZoneName.d.ts.map
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var indexOf = require("./e-index-of");
|
||||
|
||||
module.exports = function (value /*, fromIndex*/) {
|
||||
var result = [], i, fromIndex = arguments[1];
|
||||
while ((i = indexOf.call(this, value, fromIndex)) !== -1) {
|
||||
result.push(i);
|
||||
fromIndex = i + 1;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import assertString from './util/assertString';
|
||||
import merge from './util/merge';
|
||||
var default_is_empty_options = {
|
||||
ignore_whitespace: false
|
||||
};
|
||||
export default function isEmpty(str, options) {
|
||||
assertString(str);
|
||||
options = merge(options, default_is_empty_options);
|
||||
return (options.ignore_whitespace ? str.trim().length : str.length) === 0;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
# has-tostringtag <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var hasSymbolToStringTag = require('has-tostringtag');
|
||||
|
||||
hasSymbolToStringTag() === true; // if the environment has native Symbol.toStringTag support. Not polyfillable, not forgeable.
|
||||
|
||||
var hasSymbolToStringTagKinda = require('has-tostringtag/shams');
|
||||
hasSymbolToStringTagKinda() === true; // if the environment has a Symbol.toStringTag sham that mostly follows the spec.
|
||||
```
|
||||
|
||||
## Supported Symbol shams
|
||||
- get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols)
|
||||
- core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js)
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/has-tostringtag
|
||||
[2]: https://versionbadg.es/inspect-js/has-tostringtag.svg
|
||||
[5]: https://david-dm.org/inspect-js/has-tostringtag.svg
|
||||
[6]: https://david-dm.org/inspect-js/has-tostringtag
|
||||
[7]: https://david-dm.org/inspect-js/has-tostringtag/dev-status.svg
|
||||
[8]: https://david-dm.org/inspect-js/has-tostringtag#info=devDependencies
|
||||
[11]: https://nodei.co/npm/has-tostringtag.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/has-tostringtag.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/has-tostringtag.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=has-tostringtag
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/has-tostringtag/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/has-tostringtag/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-tostringtag
|
||||
[actions-url]: https://github.com/inspect-js/has-tostringtag/actions
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"2":"C K L G M N","194":"O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB EC FC","66":"VB WB XB YB uB ZB vB aB bB cB","260":"dB","516":"eB"},D:{"1":"iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB","66":"fB gB hB"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB PC QC RC SC qB AC TC rB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1090":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g 2C 3C 4C 5C sB 6C 7C 8C","2":"I wC xC yC zC 0C 0B 1C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:6,C:"AV1 video format"};
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Number.isNaN : require("./shim");
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Number, "isSafeInteger", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
export default function(instance) {
|
||||
instance.registerHelper('log', function(/* message, options */) {
|
||||
let args = [undefined],
|
||||
options = arguments[arguments.length - 1];
|
||||
for (let i = 0; i < arguments.length - 1; i++) {
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
|
||||
let level = 1;
|
||||
if (options.hash.level != null) {
|
||||
level = options.hash.level;
|
||||
} else if (options.data && options.data.level != null) {
|
||||
level = options.data.level;
|
||||
}
|
||||
args[0] = level;
|
||||
|
||||
instance.log(...args);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { mergeInternals } from './mergeInternals';
|
||||
export function expand(project, concurrent, scheduler) {
|
||||
if (concurrent === void 0) { concurrent = Infinity; }
|
||||
concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
|
||||
return operate(function (source, subscriber) {
|
||||
return mergeInternals(source, subscriber, project, concurrent, undefined, true, scheduler);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=expand.js.map
|
||||
@@ -0,0 +1,14 @@
|
||||
/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/** Version string */
|
||||
export const version: string;
|
||||
|
||||
/** Process a node buffer or byte array */
|
||||
export function buf(data: number[] | Uint8Array, seed?: number): number;
|
||||
|
||||
/** Process a binary string */
|
||||
export function bstr(data: string, seed?: number): number;
|
||||
|
||||
/** Process a JS string based on the UTF8 encoding */
|
||||
export function str(data: string, seed?: number): number;
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
Extracts the type of the last element of an array.
|
||||
|
||||
Use-case: Defining the return type of functions that extract the last element of an array, for example [`lodash.last`](https://lodash.com/docs/4.17.15#last).
|
||||
|
||||
@example
|
||||
```
|
||||
import type {LastArrayElement} from 'type-fest';
|
||||
|
||||
declare function lastOf<V extends readonly any[]>(array: V): LastArrayElement<V>;
|
||||
|
||||
const array = ['foo', 2];
|
||||
|
||||
typeof lastOf(array);
|
||||
//=> number
|
||||
```
|
||||
|
||||
@category Array
|
||||
@category Template literal
|
||||
*/
|
||||
export type LastArrayElement<ValueType extends readonly unknown[]> =
|
||||
ValueType extends readonly [infer ElementType]
|
||||
? ElementType
|
||||
: ValueType extends readonly [infer _, ...infer Tail]
|
||||
? LastArrayElement<Tail>
|
||||
: ValueType extends ReadonlyArray<infer ElementType>
|
||||
? ElementType
|
||||
: never;
|
||||
@@ -0,0 +1,980 @@
|
||||
/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*jshint -W041 */
|
||||
/*:: declare var DO_NOT_EXPORT_SSF: any; */
|
||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||
SSF.version = '0.11.2';
|
||||
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
function pad_(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v;return t.length>=d?t:fill(' ',d-t.length)+t;}
|
||||
function rpad_(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:t+fill(' ',d-t.length);}
|
||||
function pad0r1(v/*:any*/,d/*:number*/)/*:string*/{var t=""+Math.round(v); return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
function pad0r2(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
var p2_32 = Math.pow(2,32);
|
||||
function pad0r(v/*:any*/,d/*:number*/)/*:string*/{if(v>p2_32||v<-p2_32) return pad0r1(v,d); var i = Math.round(v); return pad0r2(i,d); }
|
||||
function isgeneral(s/*:string*/, i/*:?number*/)/*:boolean*/ { i = i || 0; return s.length >= 7 + i && (s.charCodeAt(i)|32) === 103 && (s.charCodeAt(i+1)|32) === 101 && (s.charCodeAt(i+2)|32) === 110 && (s.charCodeAt(i+3)|32) === 101 && (s.charCodeAt(i+4)|32) === 114 && (s.charCodeAt(i+5)|32) === 97 && (s.charCodeAt(i+6)|32) === 108; }
|
||||
/*::
|
||||
type SSF_write_num = {(type:string, fmt:string, val:number):string};
|
||||
*/
|
||||
var days/*:Array<Array<string> >*/ = [
|
||||
['Sun', 'Sunday'],
|
||||
['Mon', 'Monday'],
|
||||
['Tue', 'Tuesday'],
|
||||
['Wed', 'Wednesday'],
|
||||
['Thu', 'Thursday'],
|
||||
['Fri', 'Friday'],
|
||||
['Sat', 'Saturday']
|
||||
];
|
||||
var months/*:Array<Array<string> >*/ = [
|
||||
['J', 'Jan', 'January'],
|
||||
['F', 'Feb', 'February'],
|
||||
['M', 'Mar', 'March'],
|
||||
['A', 'Apr', 'April'],
|
||||
['M', 'May', 'May'],
|
||||
['J', 'Jun', 'June'],
|
||||
['J', 'Jul', 'July'],
|
||||
['A', 'Aug', 'August'],
|
||||
['S', 'Sep', 'September'],
|
||||
['O', 'Oct', 'October'],
|
||||
['N', 'Nov', 'November'],
|
||||
['D', 'Dec', 'December']
|
||||
];
|
||||
function init_table(t/*:any*/) {
|
||||
t[0]= 'General';
|
||||
t[1]= '0';
|
||||
t[2]= '0.00';
|
||||
t[3]= '#,##0';
|
||||
t[4]= '#,##0.00';
|
||||
t[9]= '0%';
|
||||
t[10]= '0.00%';
|
||||
t[11]= '0.00E+00';
|
||||
t[12]= '# ?/?';
|
||||
t[13]= '# ??/??';
|
||||
t[14]= 'm/d/yy';
|
||||
t[15]= 'd-mmm-yy';
|
||||
t[16]= 'd-mmm';
|
||||
t[17]= 'mmm-yy';
|
||||
t[18]= 'h:mm AM/PM';
|
||||
t[19]= 'h:mm:ss AM/PM';
|
||||
t[20]= 'h:mm';
|
||||
t[21]= 'h:mm:ss';
|
||||
t[22]= 'm/d/yy h:mm';
|
||||
t[37]= '#,##0 ;(#,##0)';
|
||||
t[38]= '#,##0 ;[Red](#,##0)';
|
||||
t[39]= '#,##0.00;(#,##0.00)';
|
||||
t[40]= '#,##0.00;[Red](#,##0.00)';
|
||||
t[45]= 'mm:ss';
|
||||
t[46]= '[h]:mm:ss';
|
||||
t[47]= 'mmss.0';
|
||||
t[48]= '##0.0E+0';
|
||||
t[49]= '@';
|
||||
t[56]= '"上午/下午 "hh"時"mm"分"ss"秒 "';
|
||||
}
|
||||
|
||||
var table_fmt = {};
|
||||
init_table(table_fmt);
|
||||
/* Defaults determined by systematically testing in Excel 2019 */
|
||||
|
||||
/* These formats appear to default to other formats in the table */
|
||||
var default_map/*:Array<number>*/ = [];
|
||||
var defi = 0;
|
||||
|
||||
// 5 -> 37 ... 8 -> 40
|
||||
for(defi = 5; defi <= 8; ++defi) default_map[defi] = 32 + defi;
|
||||
|
||||
// 23 -> 0 ... 26 -> 0
|
||||
for(defi = 23; defi <= 26; ++defi) default_map[defi] = 0;
|
||||
|
||||
// 27 -> 14 ... 31 -> 14
|
||||
for(defi = 27; defi <= 31; ++defi) default_map[defi] = 14;
|
||||
// 50 -> 14 ... 58 -> 14
|
||||
for(defi = 50; defi <= 58; ++defi) default_map[defi] = 14;
|
||||
|
||||
// 59 -> 1 ... 62 -> 4
|
||||
for(defi = 59; defi <= 62; ++defi) default_map[defi] = defi - 58;
|
||||
// 67 -> 9 ... 68 -> 10
|
||||
for(defi = 67; defi <= 68; ++defi) default_map[defi] = defi - 58;
|
||||
// 72 -> 14 ... 75 -> 17
|
||||
for(defi = 72; defi <= 75; ++defi) default_map[defi] = defi - 58;
|
||||
|
||||
// 69 -> 12 ... 71 -> 14
|
||||
for(defi = 67; defi <= 68; ++defi) default_map[defi] = defi - 57;
|
||||
|
||||
// 76 -> 20 ... 78 -> 22
|
||||
for(defi = 76; defi <= 78; ++defi) default_map[defi] = defi - 56;
|
||||
|
||||
// 79 -> 45 ... 81 -> 47
|
||||
for(defi = 79; defi <= 81; ++defi) default_map[defi] = defi - 34;
|
||||
|
||||
// 82 -> 0 ... 65536 -> 0 (omitted)
|
||||
|
||||
/* These formats technically refer to Accounting formats with no equivalent */
|
||||
var default_str/*:Array<string>*/ = [];
|
||||
|
||||
// 5 -- Currency, 0 decimal, black negative
|
||||
default_str[5] = default_str[63] = '"$"#,##0_);\\("$"#,##0\\)';
|
||||
// 6 -- Currency, 0 decimal, red negative
|
||||
default_str[6] = default_str[64] = '"$"#,##0_);[Red]\\("$"#,##0\\)';
|
||||
// 7 -- Currency, 2 decimal, black negative
|
||||
default_str[7] = default_str[65] = '"$"#,##0.00_);\\("$"#,##0.00\\)';
|
||||
// 8 -- Currency, 2 decimal, red negative
|
||||
default_str[8] = default_str[66] = '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)';
|
||||
|
||||
// 41 -- Accounting, 0 decimal, No Symbol
|
||||
default_str[41] = '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)';
|
||||
// 42 -- Accounting, 0 decimal, $ Symbol
|
||||
default_str[42] = '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)';
|
||||
// 43 -- Accounting, 2 decimal, No Symbol
|
||||
default_str[43] = '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)';
|
||||
// 44 -- Accounting, 2 decimal, $ Symbol
|
||||
default_str[44] = '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';
|
||||
function frac(x/*:number*/, D/*:number*/, mixed/*:?boolean*/)/*:Array<number>*/ {
|
||||
var sgn = x < 0 ? -1 : 1;
|
||||
var B = x * sgn;
|
||||
var P_2 = 0, P_1 = 1, P = 0;
|
||||
var Q_2 = 1, Q_1 = 0, Q = 0;
|
||||
var A = Math.floor(B);
|
||||
while(Q_1 < D) {
|
||||
A = Math.floor(B);
|
||||
P = A * P_1 + P_2;
|
||||
Q = A * Q_1 + Q_2;
|
||||
if((B - A) < 0.00000005) break;
|
||||
B = 1 / (B - A);
|
||||
P_2 = P_1; P_1 = P;
|
||||
Q_2 = Q_1; Q_1 = Q;
|
||||
}
|
||||
if(Q > D) { if(Q_1 > D) { Q = Q_2; P = P_2; } else { Q = Q_1; P = P_1; } }
|
||||
if(!mixed) return [0, sgn * P, Q];
|
||||
var q = Math.floor(sgn * P/Q);
|
||||
return [q, sgn*P - q*Q, Q];
|
||||
}
|
||||
function parse_date_code(v/*:number*/,opts/*:?any*/,b2/*:?boolean*/) {
|
||||
if(v > 2958465 || v < 0) return null;
|
||||
var date = (v|0), time = Math.floor(86400 * (v - date)), dow=0;
|
||||
var dout=[];
|
||||
var out={D:date, T:time, u:86400*(v-date)-time,y:0,m:0,d:0,H:0,M:0,S:0,q:0};
|
||||
if(Math.abs(out.u) < 1e-6) out.u = 0;
|
||||
if(opts && opts.date1904) date += 1462;
|
||||
if(out.u > 0.9999) {
|
||||
out.u = 0;
|
||||
if(++time == 86400) { out.T = time = 0; ++date; ++out.D; }
|
||||
}
|
||||
if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;}
|
||||
else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;}
|
||||
else {
|
||||
if(date > 60) --date;
|
||||
/* 1 = Jan 1 1900 in Gregorian */
|
||||
var d = new Date(1900, 0, 1);
|
||||
d.setDate(d.getDate() + date - 1);
|
||||
dout = [d.getFullYear(), d.getMonth()+1,d.getDate()];
|
||||
dow = d.getDay();
|
||||
if(date < 60) dow = (dow + 6) % 7;
|
||||
if(b2) dow = fix_hijri(d, dout);
|
||||
}
|
||||
out.y = dout[0]; out.m = dout[1]; out.d = dout[2];
|
||||
out.S = time % 60; time = Math.floor(time / 60);
|
||||
out.M = time % 60; time = Math.floor(time / 60);
|
||||
out.H = time;
|
||||
out.q = dow;
|
||||
return out;
|
||||
}
|
||||
SSF.parse_date_code = parse_date_code;
|
||||
var basedate = new Date(1899, 11, 31, 0, 0, 0);
|
||||
var dnthresh = basedate.getTime();
|
||||
var base1904 = new Date(1900, 2, 1, 0, 0, 0);
|
||||
function datenum_local(v/*:Date*/, date1904/*:?boolean*/)/*:number*/ {
|
||||
var epoch = v.getTime();
|
||||
if(date1904) epoch -= 1461*24*60*60*1000;
|
||||
else if(v >= base1904) epoch += 24*60*60*1000;
|
||||
return (epoch - (dnthresh + (v.getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000)) / (24 * 60 * 60 * 1000);
|
||||
}
|
||||
/* The longest 32-bit integer text is "-4294967296", exactly 11 chars */
|
||||
function general_fmt_int(v/*:number*/)/*:string*/ { return v.toString(10); }
|
||||
SSF._general_int = general_fmt_int;
|
||||
|
||||
/* ECMA-376 18.8.30 numFmt*/
|
||||
/* Note: `toPrecision` uses standard form when prec > E and E >= -6 */
|
||||
var general_fmt_num = (function make_general_fmt_num() {
|
||||
var trailing_zeroes_and_decimal = /(?:\.0*|(\.\d*[1-9])0+)$/;
|
||||
function strip_decimal(o/*:string*/)/*:string*/ {
|
||||
return (o.indexOf(".") == -1) ? o : o.replace(trailing_zeroes_and_decimal, "$1");
|
||||
}
|
||||
|
||||
/* General Exponential always shows 2 digits exp and trims the mantissa */
|
||||
var mantissa_zeroes_and_decimal = /(?:\.0*|(\.\d*[1-9])0+)[Ee]/;
|
||||
var exp_with_single_digit = /(E[+-])(\d)$/;
|
||||
function normalize_exp(o/*:string*/)/*:string*/ {
|
||||
if(o.indexOf("E") == -1) return o;
|
||||
return o.replace(mantissa_zeroes_and_decimal,"$1E").replace(exp_with_single_digit,"$10$2");
|
||||
}
|
||||
|
||||
/* exponent >= -9 and <= 9 */
|
||||
function small_exp(v/*:number*/)/*:string*/ {
|
||||
var w = (v<0?12:11);
|
||||
var o = strip_decimal(v.toFixed(12)); if(o.length <= w) return o;
|
||||
o = v.toPrecision(10); if(o.length <= w) return o;
|
||||
return v.toExponential(5);
|
||||
}
|
||||
|
||||
/* exponent >= 11 or <= -10 likely exponential */
|
||||
function large_exp(v/*:number*/)/*:string*/ {
|
||||
var o = strip_decimal(v.toFixed(11));
|
||||
return (o.length > (v<0?12:11) || o === "0" || o === "-0") ? v.toPrecision(6) : o;
|
||||
}
|
||||
|
||||
function general_fmt_num_base(v/*:number*/)/*:string*/ {
|
||||
var V = Math.floor(Math.log(Math.abs(v))*Math.LOG10E), o;
|
||||
|
||||
if(V >= -4 && V <= -1) o = v.toPrecision(10+V);
|
||||
else if(Math.abs(V) <= 9) o = small_exp(v);
|
||||
else if(V === 10) o = v.toFixed(10).substr(0,12);
|
||||
else o = large_exp(v);
|
||||
|
||||
return strip_decimal(normalize_exp(o.toUpperCase()));
|
||||
}
|
||||
|
||||
return general_fmt_num_base;
|
||||
})();
|
||||
SSF._general_num = general_fmt_num;
|
||||
|
||||
/*
|
||||
"General" rules:
|
||||
- text is passed through ("@")
|
||||
- booleans are rendered as TRUE/FALSE
|
||||
- "up to 11 characters" displayed for numbers
|
||||
- Default date format (code 14) used for Dates
|
||||
|
||||
TODO: technically the display depends on the width of the cell
|
||||
*/
|
||||
function general_fmt(v/*:any*/, opts/*:any*/) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
if(v instanceof Date) return format(14, datenum_local(v, opts && opts.date1904), opts);
|
||||
}
|
||||
throw new Error("unsupported value in General format: " + v);
|
||||
}
|
||||
SSF._general = general_fmt;
|
||||
function fix_hijri(date/*:Date*/, o/*:[number, number, number]*/) {
|
||||
/* TODO: properly adjust y/m/d and */
|
||||
o[0] -= 581;
|
||||
var dow = date.getDay();
|
||||
if(date < 60) dow = (dow + 6) % 7;
|
||||
return dow;
|
||||
}
|
||||
var THAI_DIGITS = "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59".split("");
|
||||
/*jshint -W086 */
|
||||
function write_date(type/*:number*/, fmt/*:string*/, val, ss0/*:?number*/)/*:string*/ {
|
||||
var o="", ss=0, tt=0, y = val.y, out, outl = 0;
|
||||
switch(type) {
|
||||
case 98: /* 'b' buddhist year */
|
||||
y = val.y + 543;
|
||||
/* falls through */
|
||||
case 121: /* 'y' year */
|
||||
switch(fmt.length) {
|
||||
case 1: case 2: out = y % 100; outl = 2; break;
|
||||
default: out = y % 10000; outl = 4; break;
|
||||
} break;
|
||||
case 109: /* 'm' month */
|
||||
switch(fmt.length) {
|
||||
case 1: case 2: out = val.m; outl = fmt.length; break;
|
||||
case 3: return months[val.m-1][1];
|
||||
case 5: return months[val.m-1][0];
|
||||
default: return months[val.m-1][2];
|
||||
} break;
|
||||
case 100: /* 'd' day */
|
||||
switch(fmt.length) {
|
||||
case 1: case 2: out = val.d; outl = fmt.length; break;
|
||||
case 3: return days[val.q][0];
|
||||
default: return days[val.q][1];
|
||||
} break;
|
||||
case 104: /* 'h' 12-hour */
|
||||
switch(fmt.length) {
|
||||
case 1: case 2: out = 1+(val.H+11)%12; outl = fmt.length; break;
|
||||
default: throw 'bad hour format: ' + fmt;
|
||||
} break;
|
||||
case 72: /* 'H' 24-hour */
|
||||
switch(fmt.length) {
|
||||
case 1: case 2: out = val.H; outl = fmt.length; break;
|
||||
default: throw 'bad hour format: ' + fmt;
|
||||
} break;
|
||||
case 77: /* 'M' minutes */
|
||||
switch(fmt.length) {
|
||||
case 1: case 2: out = val.M; outl = fmt.length; break;
|
||||
default: throw 'bad minute format: ' + fmt;
|
||||
} break;
|
||||
case 115: /* 's' seconds */
|
||||
if(fmt != 's' && fmt != 'ss' && fmt != '.0' && fmt != '.00' && fmt != '.000') throw 'bad second format: ' + fmt;
|
||||
if(val.u === 0 && (fmt == "s" || fmt == "ss")) return pad0(val.S, fmt.length);
|
||||
/*::if(!ss0) ss0 = 0; */
|
||||
if(ss0 >= 2) tt = ss0 === 3 ? 1000 : 100;
|
||||
else tt = ss0 === 1 ? 10 : 1;
|
||||
ss = Math.round((tt)*(val.S + val.u));
|
||||
if(ss >= 60*tt) ss = 0;
|
||||
if(fmt === 's') return ss === 0 ? "0" : ""+ss/tt;
|
||||
o = pad0(ss,2 + ss0);
|
||||
if(fmt === 'ss') return o.substr(0,2);
|
||||
return "." + o.substr(2,fmt.length-1);
|
||||
case 90: /* 'Z' absolute time */
|
||||
switch(fmt) {
|
||||
case '[h]': case '[hh]': out = val.D*24+val.H; break;
|
||||
case '[m]': case '[mm]': out = (val.D*24+val.H)*60+val.M; break;
|
||||
case '[s]': case '[ss]': out = ((val.D*24+val.H)*60+val.M)*60+Math.round(val.S+val.u); break;
|
||||
default: throw 'bad abstime format: ' + fmt;
|
||||
} outl = fmt.length === 3 ? 1 : 2; break;
|
||||
case 101: /* 'e' era */
|
||||
out = y; outl = 1; break;
|
||||
}
|
||||
var outstr = outl > 0 ? pad0(out, outl) : "";
|
||||
return outstr;
|
||||
}
|
||||
/*jshint +W086 */
|
||||
function commaify(s/*:string*/)/*:string*/ {
|
||||
var w = 3;
|
||||
if(s.length <= w) return s;
|
||||
var j = (s.length % w), o = s.substr(0,j);
|
||||
for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w);
|
||||
return o;
|
||||
}
|
||||
var write_num/*:SSF_write_num*/ = (function make_write_num(){
|
||||
var pct1 = /%/g;
|
||||
function write_num_pct(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{
|
||||
var sfmt = fmt.replace(pct1,""), mul = fmt.length - sfmt.length;
|
||||
return write_num(type, sfmt, val * Math.pow(10,2*mul)) + fill("%",mul);
|
||||
}
|
||||
function write_num_cm(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{
|
||||
var idx = fmt.length - 1;
|
||||
while(fmt.charCodeAt(idx-1) === 44) --idx;
|
||||
return write_num(type, fmt.substr(0,idx), val / Math.pow(10,3*(fmt.length-idx)));
|
||||
}
|
||||
function write_num_exp(fmt/*:string*/, val/*:number*/)/*:string*/{
|
||||
var o/*:string*/;
|
||||
var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1;
|
||||
if(fmt.match(/^#+0.0E\+0$/)) {
|
||||
if(val == 0) return "0.0E+0";
|
||||
else if(val < 0) return "-" + write_num_exp(fmt, -val);
|
||||
var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E');
|
||||
var ee = Math.floor(Math.log(val)*Math.LOG10E)%period;
|
||||
if(ee < 0) ee += period;
|
||||
o = (val/Math.pow(10,ee)).toPrecision(idx+1+(period+ee)%period);
|
||||
if(o.indexOf("e") === -1) {
|
||||
var fakee = Math.floor(Math.log(val)*Math.LOG10E);
|
||||
if(o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length+ee);
|
||||
else o += "E+" + (fakee - ee);
|
||||
while(o.substr(0,2) === "0.") {
|
||||
o = o.charAt(0) + o.substr(2,period) + "." + o.substr(2+period);
|
||||
o = o.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");
|
||||
}
|
||||
o = o.replace(/\+-/,"-");
|
||||
}
|
||||
o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function($$,$1,$2,$3) { return $1 + $2 + $3.substr(0,(period+ee)%period) + "." + $3.substr(ee) + "E"; });
|
||||
} else o = val.toExponential(idx);
|
||||
if(fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0,o.length-1) + "0" + o.charAt(o.length-1);
|
||||
if(fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/,"e");
|
||||
return o.replace("e","E");
|
||||
}
|
||||
var frac1 = /# (\?+)( ?)\/( ?)(\d+)/;
|
||||
function write_num_f1(r/*:Array<string>*/, aval/*:number*/, sign/*:string*/)/*:string*/ {
|
||||
var den = parseInt(r[4],10), rr = Math.round(aval * den), base = Math.floor(rr/den);
|
||||
var myn = (rr - base*den), myd = den;
|
||||
return sign + (base === 0 ? "" : ""+base) + " " + (myn === 0 ? fill(" ", r[1].length + 1 + r[4].length) : pad_(myn,r[1].length) + r[2] + "/" + r[3] + pad0(myd,r[4].length));
|
||||
}
|
||||
function write_num_f2(r/*:Array<string>*/, aval/*:number*/, sign/*:string*/)/*:string*/ {
|
||||
return sign + (aval === 0 ? "" : ""+aval) + fill(" ", r[1].length + 2 + r[4].length);
|
||||
}
|
||||
var dec1 = /^#*0*\.([0#]+)/;
|
||||
var closeparen = /\).*[0#]/;
|
||||
var phone = /\(###\) ###\\?-####/;
|
||||
function hashq(str/*:string*/)/*:string*/ {
|
||||
var o = "", cc;
|
||||
for(var i = 0; i != str.length; ++i) switch((cc=str.charCodeAt(i))) {
|
||||
case 35: break;
|
||||
case 63: o+= " "; break;
|
||||
case 48: o+= "0"; break;
|
||||
default: o+= String.fromCharCode(cc);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
function rnd(val/*:number*/, d/*:number*/)/*:string*/ { var dd = Math.pow(10,d); return ""+(Math.round(val * dd)/dd); }
|
||||
function dec(val/*:number*/, d/*:number*/)/*:number*/ {
|
||||
var _frac = val - Math.floor(val), dd = Math.pow(10,d);
|
||||
if (d < ('' + Math.round(_frac * dd)).length) return 0;
|
||||
return Math.round(_frac * dd);
|
||||
}
|
||||
function carry(val/*:number*/, d/*:number*/)/*:number*/ {
|
||||
if (d < ('' + Math.round((val-Math.floor(val))*Math.pow(10,d))).length) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
function flr(val/*:number*/)/*:string*/ {
|
||||
if(val < 2147483647 && val > -2147483648) return ""+(val >= 0 ? (val|0) : (val-1|0));
|
||||
return ""+Math.floor(val);
|
||||
}
|
||||
function write_num_flt(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/ {
|
||||
if(type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
|
||||
var ffmt = fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");
|
||||
if(val >= 0) return write_num_flt('n', ffmt, val);
|
||||
return '(' + write_num_flt('n', ffmt, -val) + ')';
|
||||
}
|
||||
if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt, val);
|
||||
if(fmt.indexOf('%') !== -1) return write_num_pct(type, fmt, val);
|
||||
if(fmt.indexOf('E') !== -1) return write_num_exp(fmt, val);
|
||||
if(fmt.charCodeAt(0) === 36) return "$"+write_num_flt(type,fmt.substr(fmt.charAt(1)==' '?2:1),val);
|
||||
var o;
|
||||
var r/*:?Array<string>*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : "";
|
||||
if(fmt.match(/^00+$/)) return sign + pad0r(aval,fmt.length);
|
||||
if(fmt.match(/^[#?]+$/)) {
|
||||
o = pad0r(val,0); if(o === "0") o = "";
|
||||
return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o;
|
||||
}
|
||||
if((r = fmt.match(frac1))) return write_num_f1(r, aval, sign);
|
||||
if(fmt.match(/^#+0+$/)) return sign + pad0r(aval,fmt.length - fmt.indexOf("0"));
|
||||
if((r = fmt.match(dec1))) {
|
||||
o = rnd(val, r[1].length).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1])).replace(/\.(\d*)$/,function($$, $1) { return "." + $1 + fill("0", hashq(/*::(*/r/*::||[""])*/[1]).length-$1.length); });
|
||||
return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,".");
|
||||
}
|
||||
fmt = fmt.replace(/^#+([0.])/, "$1");
|
||||
if((r = fmt.match(/^(0*)\.(#*)$/))) {
|
||||
return sign + rnd(aval, r[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":".");
|
||||
}
|
||||
if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify(pad0r(aval,0));
|
||||
if((r = fmt.match(/^#,##0\.([#0]*0)$/))) {
|
||||
return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(""+(Math.floor(val) + carry(val, r[1].length))) + "." + pad0(dec(val, r[1].length),r[1].length);
|
||||
}
|
||||
if((r = fmt.match(/^#,#*,#0/))) return write_num_flt(type,fmt.replace(/^#,#*,/,""),val);
|
||||
if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) {
|
||||
o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g,""), val));
|
||||
ri = 0;
|
||||
return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri<o.length?o.charAt(ri++):x==='0'?'0':"";}));
|
||||
}
|
||||
if(fmt.match(phone)) {
|
||||
o = write_num_flt(type, "##########", val);
|
||||
return "(" + o.substr(0,3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
|
||||
}
|
||||
var oa = "";
|
||||
if((r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))) {
|
||||
ri = Math.min(/*::String(*/r[4]/*::)*/.length,7);
|
||||
ff = frac(aval, Math.pow(10,ri)-1, false);
|
||||
o = "" + sign;
|
||||
oa = write_num("n", /*::String(*/r[1]/*::)*/, ff[1]);
|
||||
if(oa.charAt(oa.length-1) == " ") oa = oa.substr(0,oa.length-1) + "0";
|
||||
o += oa + /*::String(*/r[2]/*::)*/ + "/" + /*::String(*/r[3]/*::)*/;
|
||||
oa = rpad_(ff[2],ri);
|
||||
if(oa.length < r[4].length) oa = hashq(r[4].substr(r[4].length-oa.length)) + oa;
|
||||
o += oa;
|
||||
return o;
|
||||
}
|
||||
if((r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))) {
|
||||
ri = Math.min(Math.max(r[1].length, r[4].length),7);
|
||||
ff = frac(aval, Math.pow(10,ri)-1, true);
|
||||
return sign + (ff[0]||(ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1],ri) + r[2] + "/" + r[3] + rpad_(ff[2],ri): fill(" ", 2*ri+1 + r[2].length + r[3].length));
|
||||
}
|
||||
if((r = fmt.match(/^[#0?]+$/))) {
|
||||
o = pad0r(val, 0);
|
||||
if(fmt.length <= o.length) return o;
|
||||
return hashq(fmt.substr(0,fmt.length-o.length)) + o;
|
||||
}
|
||||
if((r = fmt.match(/^([#0?]+)\.([#0]+)$/))) {
|
||||
o = "" + val.toFixed(Math.min(r[2].length,10)).replace(/([^0])0+$/,"$1");
|
||||
ri = o.indexOf(".");
|
||||
var lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres;
|
||||
return hashq(fmt.substr(0,lres) + o + fmt.substr(fmt.length-rres));
|
||||
}
|
||||
if((r = fmt.match(/^00,000\.([#0]*0)$/))) {
|
||||
ri = dec(val, r[1].length);
|
||||
return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(flr(val)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function($$) { return "00," + ($$.length < 3 ? pad0(0,3-$$.length) : "") + $$; }) + "." + pad0(ri,r[1].length);
|
||||
}
|
||||
switch(fmt) {
|
||||
case "###,##0.00": return write_num_flt(type, "#,##0.00", val);
|
||||
case "###,###":
|
||||
case "##,###":
|
||||
case "#,###": var x = commaify(pad0r(aval,0)); return x !== "0" ? sign + x : "";
|
||||
case "###,###.00": return write_num_flt(type, "###,##0.00",val).replace(/^0\./,".");
|
||||
case "#,###.00": return write_num_flt(type, "#,##0.00",val).replace(/^0\./,".");
|
||||
default:
|
||||
}
|
||||
throw new Error("unsupported format |" + fmt + "|");
|
||||
}
|
||||
function write_num_cm2(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{
|
||||
var idx = fmt.length - 1;
|
||||
while(fmt.charCodeAt(idx-1) === 44) --idx;
|
||||
return write_num(type, fmt.substr(0,idx), val / Math.pow(10,3*(fmt.length-idx)));
|
||||
}
|
||||
function write_num_pct2(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{
|
||||
var sfmt = fmt.replace(pct1,""), mul = fmt.length - sfmt.length;
|
||||
return write_num(type, sfmt, val * Math.pow(10,2*mul)) + fill("%",mul);
|
||||
}
|
||||
function write_num_exp2(fmt/*:string*/, val/*:number*/)/*:string*/{
|
||||
var o/*:string*/;
|
||||
var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1;
|
||||
if(fmt.match(/^#+0.0E\+0$/)) {
|
||||
if(val == 0) return "0.0E+0";
|
||||
else if(val < 0) return "-" + write_num_exp2(fmt, -val);
|
||||
var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E');
|
||||
var ee = Math.floor(Math.log(val)*Math.LOG10E)%period;
|
||||
if(ee < 0) ee += period;
|
||||
o = (val/Math.pow(10,ee)).toPrecision(idx+1+(period+ee)%period);
|
||||
if(!o.match(/[Ee]/)) {
|
||||
var fakee = Math.floor(Math.log(val)*Math.LOG10E);
|
||||
if(o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length+ee);
|
||||
else o += "E+" + (fakee - ee);
|
||||
o = o.replace(/\+-/,"-");
|
||||
}
|
||||
o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function($$,$1,$2,$3) { return $1 + $2 + $3.substr(0,(period+ee)%period) + "." + $3.substr(ee) + "E"; });
|
||||
} else o = val.toExponential(idx);
|
||||
if(fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0,o.length-1) + "0" + o.charAt(o.length-1);
|
||||
if(fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/,"e");
|
||||
return o.replace("e","E");
|
||||
}
|
||||
function write_num_int(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/ {
|
||||
if(type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
|
||||
var ffmt = fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");
|
||||
if(val >= 0) return write_num_int('n', ffmt, val);
|
||||
return '(' + write_num_int('n', ffmt, -val) + ')';
|
||||
}
|
||||
if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt, val);
|
||||
if(fmt.indexOf('%') !== -1) return write_num_pct2(type, fmt, val);
|
||||
if(fmt.indexOf('E') !== -1) return write_num_exp2(fmt, val);
|
||||
if(fmt.charCodeAt(0) === 36) return "$"+write_num_int(type,fmt.substr(fmt.charAt(1)==' '?2:1),val);
|
||||
var o;
|
||||
var r/*:?Array<string>*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : "";
|
||||
if(fmt.match(/^00+$/)) return sign + pad0(aval,fmt.length);
|
||||
if(fmt.match(/^[#?]+$/)) {
|
||||
o = (""+val); if(val === 0) o = "";
|
||||
return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o;
|
||||
}
|
||||
if((r = fmt.match(frac1))) return write_num_f2(r, aval, sign);
|
||||
if(fmt.match(/^#+0+$/)) return sign + pad0(aval,fmt.length - fmt.indexOf("0"));
|
||||
if((r = fmt.match(dec1))) {
|
||||
/*:: if(!Array.isArray(r)) throw new Error("unreachable"); */
|
||||
o = (""+val).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1]));
|
||||
o = o.replace(/\.(\d*)$/,function($$, $1) {
|
||||
/*:: if(!Array.isArray(r)) throw new Error("unreachable"); */
|
||||
return "." + $1 + fill("0", hashq(r[1]).length-$1.length); });
|
||||
return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,".");
|
||||
}
|
||||
fmt = fmt.replace(/^#+([0.])/, "$1");
|
||||
if((r = fmt.match(/^(0*)\.(#*)$/))) {
|
||||
return sign + (""+aval).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":".");
|
||||
}
|
||||
if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify((""+aval));
|
||||
if((r = fmt.match(/^#,##0\.([#0]*0)$/))) {
|
||||
return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify((""+val)) + "." + fill('0',r[1].length);
|
||||
}
|
||||
if((r = fmt.match(/^#,#*,#0/))) return write_num_int(type,fmt.replace(/^#,#*,/,""),val);
|
||||
if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) {
|
||||
o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g,""), val));
|
||||
ri = 0;
|
||||
return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri<o.length?o.charAt(ri++):x==='0'?'0':"";}));
|
||||
}
|
||||
if(fmt.match(phone)) {
|
||||
o = write_num_int(type, "##########", val);
|
||||
return "(" + o.substr(0,3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
|
||||
}
|
||||
var oa = "";
|
||||
if((r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))) {
|
||||
ri = Math.min(/*::String(*/r[4]/*::)*/.length,7);
|
||||
ff = frac(aval, Math.pow(10,ri)-1, false);
|
||||
o = "" + sign;
|
||||
oa = write_num("n", /*::String(*/r[1]/*::)*/, ff[1]);
|
||||
if(oa.charAt(oa.length-1) == " ") oa = oa.substr(0,oa.length-1) + "0";
|
||||
o += oa + /*::String(*/r[2]/*::)*/ + "/" + /*::String(*/r[3]/*::)*/;
|
||||
oa = rpad_(ff[2],ri);
|
||||
if(oa.length < r[4].length) oa = hashq(r[4].substr(r[4].length-oa.length)) + oa;
|
||||
o += oa;
|
||||
return o;
|
||||
}
|
||||
if((r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))) {
|
||||
ri = Math.min(Math.max(r[1].length, r[4].length),7);
|
||||
ff = frac(aval, Math.pow(10,ri)-1, true);
|
||||
return sign + (ff[0]||(ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1],ri) + r[2] + "/" + r[3] + rpad_(ff[2],ri): fill(" ", 2*ri+1 + r[2].length + r[3].length));
|
||||
}
|
||||
if((r = fmt.match(/^[#0?]+$/))) {
|
||||
o = "" + val;
|
||||
if(fmt.length <= o.length) return o;
|
||||
return hashq(fmt.substr(0,fmt.length-o.length)) + o;
|
||||
}
|
||||
if((r = fmt.match(/^([#0]+)\.([#0]+)$/))) {
|
||||
o = "" + val.toFixed(Math.min(r[2].length,10)).replace(/([^0])0+$/,"$1");
|
||||
ri = o.indexOf(".");
|
||||
var lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres;
|
||||
return hashq(fmt.substr(0,lres) + o + fmt.substr(fmt.length-rres));
|
||||
}
|
||||
if((r = fmt.match(/^00,000\.([#0]*0)$/))) {
|
||||
return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify(""+val).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function($$) { return "00," + ($$.length < 3 ? pad0(0,3-$$.length) : "") + $$; }) + "." + pad0(0,r[1].length);
|
||||
}
|
||||
switch(fmt) {
|
||||
case "###,###":
|
||||
case "##,###":
|
||||
case "#,###": var x = commaify(""+aval); return x !== "0" ? sign + x : "";
|
||||
default:
|
||||
if(fmt.match(/\.[0#?]*$/)) return write_num_int(type, fmt.slice(0,fmt.lastIndexOf(".")), val) + hashq(fmt.slice(fmt.lastIndexOf(".")));
|
||||
}
|
||||
throw new Error("unsupported format |" + fmt + "|");
|
||||
}
|
||||
return function write_num(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/ {
|
||||
return (val|0) === val ? write_num_int(type, fmt, val) : write_num_flt(type, fmt, val);
|
||||
};})();
|
||||
function split_fmt(fmt/*:string*/)/*:Array<string>*/ {
|
||||
var out/*:Array<string>*/ = [];
|
||||
var in_str = false/*, cc*/;
|
||||
for(var i = 0, j = 0; i < fmt.length; ++i) switch((/*cc=*/fmt.charCodeAt(i))) {
|
||||
case 34: /* '"' */
|
||||
in_str = !in_str; break;
|
||||
case 95: case 42: case 92: /* '_' '*' '\\' */
|
||||
++i; break;
|
||||
case 59: /* ';' */
|
||||
out[out.length] = fmt.substr(j,i-j);
|
||||
j = i+1;
|
||||
}
|
||||
out[out.length] = fmt.substr(j);
|
||||
if(in_str === true) throw new Error("Format |" + fmt + "| unterminated string ");
|
||||
return out;
|
||||
}
|
||||
SSF._split = split_fmt;
|
||||
var abstime = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
|
||||
function fmt_is_date(fmt/*:string*/)/*:boolean*/ {
|
||||
var i = 0, /*cc = 0,*/ c = "", o = "";
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
case 'B': case 'b':
|
||||
if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") return true;
|
||||
/* falls through */
|
||||
case 'M': case 'D': case 'Y': case 'H': case 'S': case 'E':
|
||||
/* falls through */
|
||||
case 'm': case 'd': case 'y': case 'h': case 's': case 'e': case 'g': return true;
|
||||
case 'A': case 'a': case '上':
|
||||
if(fmt.substr(i, 3).toUpperCase() === "A/P") return true;
|
||||
if(fmt.substr(i, 5).toUpperCase() === "AM/PM") return true;
|
||||
if(fmt.substr(i, 5).toUpperCase() === "上午/下午") return true;
|
||||
++i; break;
|
||||
case '[':
|
||||
o = c;
|
||||
while(fmt.charAt(i++) !== ']' && i < fmt.length) o += fmt.charAt(i);
|
||||
if(o.match(abstime)) return true;
|
||||
break;
|
||||
case '.':
|
||||
/* falls through */
|
||||
case '0': case '#':
|
||||
while(i < fmt.length && ("0#?.,E+-%".indexOf(c=fmt.charAt(++i)) > -1 || (c=='\\' && fmt.charAt(i+1) == "-" && "0#".indexOf(fmt.charAt(i+2))>-1))){/* empty */}
|
||||
break;
|
||||
case '?': while(fmt.charAt(++i) === c){/* empty */} break;
|
||||
case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break;
|
||||
case '(': case ')': ++i; break;
|
||||
case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
|
||||
while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1){/* empty */} break;
|
||||
case ' ': ++i; break;
|
||||
default: ++i; break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
SSF.is_date = fmt_is_date;
|
||||
function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) {
|
||||
var out = [], o = "", i = 0, c = "", lst='t', dt, j, cc;
|
||||
var hr='H';
|
||||
/* Tokenize */
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': /* General */
|
||||
if(!isgeneral(fmt, i)) throw new Error('unrecognized character ' + c + ' in ' +fmt);
|
||||
out[out.length] = {t:'G', v:'General'}; i+=7; break;
|
||||
case '"': /* Literal text */
|
||||
for(o="";(cc=fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) o += String.fromCharCode(cc);
|
||||
out[out.length] = {t:'t', v:o}; ++i; break;
|
||||
case '\\': var w = fmt.charAt(++i), t = (w === "(" || w === ")") ? w : 't';
|
||||
out[out.length] = {t:t, v:w}; ++i; break;
|
||||
case '_': out[out.length] = {t:'t', v:" "}; i+=2; break;
|
||||
case '@': /* Text Placeholder */
|
||||
out[out.length] = {t:'T', v:v}; ++i; break;
|
||||
case 'B': case 'b':
|
||||
if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") {
|
||||
if(dt==null) { dt=parse_date_code(v, opts, fmt.charAt(i+1) === "2"); if(dt==null) return ""; }
|
||||
out[out.length] = {t:'X', v:fmt.substr(i,2)}; lst = c; i+=2; break;
|
||||
}
|
||||
/* falls through */
|
||||
case 'M': case 'D': case 'Y': case 'H': case 'S': case 'E':
|
||||
c = c.toLowerCase();
|
||||
/* falls through */
|
||||
case 'm': case 'd': case 'y': case 'h': case 's': case 'e': case 'g':
|
||||
if(v < 0) return "";
|
||||
if(dt==null) { dt=parse_date_code(v, opts); if(dt==null) return ""; }
|
||||
o = c; while(++i < fmt.length && fmt.charAt(i).toLowerCase() === c) o+=c;
|
||||
if(c === 'm' && lst.toLowerCase() === 'h') c = 'M';
|
||||
if(c === 'h') c = hr;
|
||||
out[out.length] = {t:c, v:o}; lst = c; break;
|
||||
case 'A': case 'a': case '上':
|
||||
var q={t:c, v:c};
|
||||
if(dt==null) dt=parse_date_code(v, opts);
|
||||
if(fmt.substr(i, 3).toUpperCase() === "A/P") { if(dt!=null) q.v = dt.H >= 12 ? "P" : "A"; q.t = 'T'; hr='h';i+=3;}
|
||||
else if(fmt.substr(i,5).toUpperCase() === "AM/PM") { if(dt!=null) q.v = dt.H >= 12 ? "PM" : "AM"; q.t = 'T'; i+=5; hr='h'; }
|
||||
else if(fmt.substr(i,5).toUpperCase() === "上午/下午") { if(dt!=null) q.v = dt.H >= 12 ? "下午" : "上午"; q.t = 'T'; i+=5; hr='h'; }
|
||||
else { q.t = "t"; ++i; }
|
||||
if(dt==null && q.t === 'T') return "";
|
||||
out[out.length] = q; lst = c; break;
|
||||
case '[':
|
||||
o = c;
|
||||
while(fmt.charAt(i++) !== ']' && i < fmt.length) o += fmt.charAt(i);
|
||||
if(o.slice(-1) !== ']') throw 'unterminated "[" block: |' + o + '|';
|
||||
if(o.match(abstime)) {
|
||||
if(dt==null) { dt=parse_date_code(v, opts); if(dt==null) return ""; }
|
||||
out[out.length] = {t:'Z', v:o.toLowerCase()};
|
||||
lst = o.charAt(1);
|
||||
} else if(o.indexOf("$") > -1) {
|
||||
o = (o.match(/\$([^-\[\]]*)/)||[])[1]||"$";
|
||||
if(!fmt_is_date(fmt)) out[out.length] = {t:'t',v:o};
|
||||
}
|
||||
break;
|
||||
/* Numbers */
|
||||
case '.':
|
||||
if(dt != null) {
|
||||
o = c; while(++i < fmt.length && (c=fmt.charAt(i)) === "0") o += c;
|
||||
out[out.length] = {t:'s', v:o}; break;
|
||||
}
|
||||
/* falls through */
|
||||
case '0': case '#':
|
||||
o = c; while(++i < fmt.length && "0#?.,E+-%".indexOf(c=fmt.charAt(i)) > -1) o += c;
|
||||
out[out.length] = {t:'n', v:o}; break;
|
||||
case '?':
|
||||
o = c; while(fmt.charAt(++i) === c) o+=c;
|
||||
out[out.length] = {t:c, v:o}; lst = c; break;
|
||||
case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; // **
|
||||
case '(': case ')': out[out.length] = {t:(flen===1?'t':c), v:c}; ++i; break;
|
||||
case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case '$': out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan for date/time parts */
|
||||
var bt = 0, ss0 = 0, ssm;
|
||||
for(i=out.length-1, lst='t'; i >= 0; --i) {
|
||||
switch(out[i].t) {
|
||||
case 'h': case 'H': out[i].t = hr; lst='h'; if(bt < 1) bt = 1; break;
|
||||
case 's':
|
||||
if((ssm=out[i].v.match(/\.0+$/))) ss0=Math.max(ss0,ssm[0].length-1);
|
||||
if(bt < 3) bt = 3;
|
||||
/* falls through */
|
||||
case 'd': case 'y': case 'M': case 'e': lst=out[i].t; break;
|
||||
case 'm': if(lst === 's') { out[i].t = 'M'; if(bt < 2) bt = 2; } break;
|
||||
case 'X': /*if(out[i].v === "B2");*/
|
||||
break;
|
||||
case 'Z':
|
||||
if(bt < 1 && out[i].v.match(/[Hh]/)) bt = 1;
|
||||
if(bt < 2 && out[i].v.match(/[Mm]/)) bt = 2;
|
||||
if(bt < 3 && out[i].v.match(/[Ss]/)) bt = 3;
|
||||
}
|
||||
}
|
||||
/* time rounding depends on presence of minute / second / usec fields */
|
||||
switch(bt) {
|
||||
case 0: break;
|
||||
case 1:
|
||||
/*::if(!dt) break;*/
|
||||
if(dt.u >= 0.5) { dt.u = 0; ++dt.S; }
|
||||
if(dt.S >= 60) { dt.S = 0; ++dt.M; }
|
||||
if(dt.M >= 60) { dt.M = 0; ++dt.H; }
|
||||
break;
|
||||
case 2:
|
||||
/*::if(!dt) break;*/
|
||||
if(dt.u >= 0.5) { dt.u = 0; ++dt.S; }
|
||||
if(dt.S >= 60) { dt.S = 0; ++dt.M; }
|
||||
break;
|
||||
}
|
||||
|
||||
/* replace fields */
|
||||
var nstr = "", jj;
|
||||
for(i=0; i < out.length; ++i) {
|
||||
switch(out[i].t) {
|
||||
case 't': case 'T': case ' ': case 'D': break;
|
||||
case 'X': out[i].v = ""; out[i].t = ";"; break;
|
||||
case 'd': case 'm': case 'y': case 'h': case 'H': case 'M': case 's': case 'e': case 'b': case 'Z':
|
||||
/*::if(!dt) throw "unreachable"; */
|
||||
out[i].v = write_date(out[i].t.charCodeAt(0), out[i].v, dt, ss0);
|
||||
out[i].t = 't'; break;
|
||||
case 'n': case '?':
|
||||
jj = i+1;
|
||||
while(out[jj] != null && (
|
||||
(c=out[jj].t) === "?" || c === "D" ||
|
||||
((c === " " || c === "t") && out[jj+1] != null && (out[jj+1].t === '?' || out[jj+1].t === "t" && out[jj+1].v === '/')) ||
|
||||
(out[i].t === '(' && (c === ' ' || c === 'n' || c === ')')) ||
|
||||
(c === 't' && (out[jj].v === '/' || out[jj].v === ' ' && out[jj+1] != null && out[jj+1].t == '?'))
|
||||
)) {
|
||||
out[i].v += out[jj].v;
|
||||
out[jj] = {v:"", t:";"}; ++jj;
|
||||
}
|
||||
nstr += out[i].v;
|
||||
i = jj-1; break;
|
||||
case 'G': out[i].t = 't'; out[i].v = general_fmt(v,opts); break;
|
||||
}
|
||||
}
|
||||
var vv = "", myv, ostr;
|
||||
if(nstr.length > 0) {
|
||||
if(nstr.charCodeAt(0) == 40) /* '(' */ {
|
||||
myv = (v<0&&nstr.charCodeAt(0) === 45 ? -v : v);
|
||||
ostr = write_num('n', nstr, myv);
|
||||
} else {
|
||||
myv = (v<0 && flen > 1 ? -v : v);
|
||||
ostr = write_num('n', nstr, myv);
|
||||
if(myv < 0 && out[0] && out[0].t == 't') {
|
||||
ostr = ostr.substr(1);
|
||||
out[0].v = "-" + out[0].v;
|
||||
}
|
||||
}
|
||||
jj=ostr.length-1;
|
||||
var decpt = out.length;
|
||||
for(i=0; i < out.length; ++i) if(out[i] != null && out[i].t != 't' && out[i].v.indexOf(".") > -1) { decpt = i; break; }
|
||||
var lasti=out.length;
|
||||
if(decpt === out.length && ostr.indexOf("E") === -1) {
|
||||
for(i=out.length-1; i>= 0;--i) {
|
||||
if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue;
|
||||
if(jj>=out[i].v.length-1) { jj -= out[i].v.length; out[i].v = ostr.substr(jj+1, out[i].v.length); }
|
||||
else if(jj < 0) out[i].v = "";
|
||||
else { out[i].v = ostr.substr(0, jj+1); jj = -1; }
|
||||
out[i].t = 't';
|
||||
lasti = i;
|
||||
}
|
||||
if(jj>=0 && lasti<out.length) out[lasti].v = ostr.substr(0,jj+1) + out[lasti].v;
|
||||
}
|
||||
else if(decpt !== out.length && ostr.indexOf("E") === -1) {
|
||||
jj = ostr.indexOf(".")-1;
|
||||
for(i=decpt; i>= 0; --i) {
|
||||
if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue;
|
||||
j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")-1:out[i].v.length-1;
|
||||
vv = out[i].v.substr(j+1);
|
||||
for(; j>=0; --j) {
|
||||
if(jj>=0 && (out[i].v.charAt(j) === "0" || out[i].v.charAt(j) === "#")) vv = ostr.charAt(jj--) + vv;
|
||||
}
|
||||
out[i].v = vv;
|
||||
out[i].t = 't';
|
||||
lasti = i;
|
||||
}
|
||||
if(jj>=0 && lasti<out.length) out[lasti].v = ostr.substr(0,jj+1) + out[lasti].v;
|
||||
jj = ostr.indexOf(".")+1;
|
||||
for(i=decpt; i<out.length; ++i) {
|
||||
if(out[i] == null || ('n?('.indexOf(out[i].t) === -1 && i !== decpt)) continue;
|
||||
j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")+1:0;
|
||||
vv = out[i].v.substr(0,j);
|
||||
for(; j<out[i].v.length; ++j) {
|
||||
if(jj<ostr.length) vv += ostr.charAt(jj++);
|
||||
}
|
||||
out[i].v = vv;
|
||||
out[i].t = 't';
|
||||
lasti = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=0; i<out.length; ++i) if(out[i] != null && 'n?'.indexOf(out[i].t)>-1) {
|
||||
myv = (flen >1 && v < 0 && i>0 && out[i-1].v === "-" ? -v:v);
|
||||
out[i].v = write_num(out[i].t, out[i].v, myv);
|
||||
out[i].t = 't';
|
||||
}
|
||||
var retval = "";
|
||||
for(i=0; i !== out.length; ++i) if(out[i] != null) retval += out[i].v;
|
||||
return retval;
|
||||
}
|
||||
SSF._eval = eval_fmt;
|
||||
var cfregex = /\[[=<>]/;
|
||||
var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
|
||||
function chkcond(v, rr) {
|
||||
if(rr == null) return false;
|
||||
var thresh = parseFloat(rr[2]);
|
||||
switch(rr[1]) {
|
||||
case "=": if(v == thresh) return true; break;
|
||||
case ">": if(v > thresh) return true; break;
|
||||
case "<": if(v < thresh) return true; break;
|
||||
case "<>": if(v != thresh) return true; break;
|
||||
case ">=": if(v >= thresh) return true; break;
|
||||
case "<=": if(v <= thresh) return true; break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function choose_fmt(f/*:string*/, v/*:any*/) {
|
||||
var fmt = split_fmt(f);
|
||||
var l = fmt.length, lat = fmt[l-1].indexOf("@");
|
||||
if(l<4 && lat>-1) --l;
|
||||
if(fmt.length > 4) throw new Error("cannot find right format for |" + fmt.join("|") + "|");
|
||||
if(typeof v !== "number") return [4, fmt.length === 4 || lat>-1?fmt[fmt.length-1]:"@"];
|
||||
switch(fmt.length) {
|
||||
case 1: fmt = lat>-1 ? ["General", "General", "General", fmt[0]] : [fmt[0], fmt[0], fmt[0], "@"]; break;
|
||||
case 2: fmt = lat>-1 ? [fmt[0], fmt[0], fmt[0], fmt[1]] : [fmt[0], fmt[1], fmt[0], "@"]; break;
|
||||
case 3: fmt = lat>-1 ? [fmt[0], fmt[1], fmt[0], fmt[2]] : [fmt[0], fmt[1], fmt[2], "@"]; break;
|
||||
case 4: break;
|
||||
}
|
||||
var ff = v > 0 ? fmt[0] : v < 0 ? fmt[1] : fmt[2];
|
||||
if(fmt[0].indexOf("[") === -1 && fmt[1].indexOf("[") === -1) return [l, ff];
|
||||
if(fmt[0].match(cfregex) != null || fmt[1].match(cfregex) != null) {
|
||||
var m1 = fmt[0].match(cfregex2);
|
||||
var m2 = fmt[1].match(cfregex2);
|
||||
return chkcond(v, m1) ? [l, fmt[0]] : chkcond(v, m2) ? [l, fmt[1]] : [l, fmt[m1 != null && m2 != null ? 2 : 1]];
|
||||
}
|
||||
return [l, ff];
|
||||
}
|
||||
function format(fmt/*:string|number*/,v/*:any*/,o/*:?any*/) {
|
||||
if(o == null) o = {};
|
||||
var sfmt = "";
|
||||
switch(typeof fmt) {
|
||||
case "string":
|
||||
if(fmt == "m/d/yy" && o.dateNF) sfmt = o.dateNF;
|
||||
else sfmt = fmt;
|
||||
break;
|
||||
case "number":
|
||||
if(fmt == 14 && o.dateNF) sfmt = o.dateNF;
|
||||
else sfmt = (o.table != null ? (o.table/*:any*/) : table_fmt)[fmt];
|
||||
if(sfmt == null) sfmt = (o.table && o.table[default_map[fmt]]) || table_fmt[default_map[fmt]];
|
||||
if(sfmt == null) sfmt = default_str[fmt] || "General";
|
||||
break;
|
||||
}
|
||||
if(isgeneral(sfmt,0)) return general_fmt(v, o);
|
||||
if(v instanceof Date) v = datenum_local(v, o.date1904);
|
||||
var f = choose_fmt(sfmt, v);
|
||||
if(isgeneral(f[1])) return general_fmt(v, o);
|
||||
if(v === true) v = "TRUE"; else if(v === false) v = "FALSE";
|
||||
else if(v === "" || v == null) return "";
|
||||
return eval_fmt(f[1], v, o, f[0]);
|
||||
}
|
||||
function load_entry(fmt/*:string*/, idx/*:?number*/)/*:number*/ {
|
||||
if(typeof idx != 'number') {
|
||||
idx = +idx || -1;
|
||||
/*::if(typeof idx != 'number') return 0x188; */
|
||||
for(var i = 0; i < 0x0188; ++i) {
|
||||
/*::if(typeof idx != 'number') return 0x188; */
|
||||
if(table_fmt[i] == undefined) { if(idx < 0) idx = i; continue; }
|
||||
if(table_fmt[i] == fmt) { idx = i; break; }
|
||||
}
|
||||
/*::if(typeof idx != 'number') return 0x188; */
|
||||
if(idx < 0) idx = 0x187;
|
||||
}
|
||||
/*::if(typeof idx != 'number') return 0x188; */
|
||||
table_fmt[idx] = fmt;
|
||||
return idx;
|
||||
}
|
||||
SSF.load = load_entry;
|
||||
SSF._table = table_fmt;
|
||||
SSF.get_table = function get_table()/*:SSFTable*/ { return table_fmt; };
|
||||
SSF.load_table = function load_table(tbl/*:SSFTable*/)/*:void*/ {
|
||||
for(var i=0; i!=0x0188; ++i)
|
||||
if(tbl[i] !== undefined) load_entry(tbl[i], i);
|
||||
};
|
||||
SSF.init_table = init_table;
|
||||
SSF.format = format;
|
||||
};
|
||||
make_ssf(SSF);
|
||||
/*global module */
|
||||
if(typeof module !== 'undefined' && typeof DO_NOT_EXPORT_SSF === 'undefined') module.exports = SSF;
|
||||
@@ -0,0 +1,97 @@
|
||||
3.1.2 / 2022-01-27
|
||||
==================
|
||||
|
||||
* Fix return value for un-parsable strings
|
||||
|
||||
3.1.1 / 2021-11-15
|
||||
==================
|
||||
|
||||
* Fix "thousandsSeparator" incorrecting formatting fractional part
|
||||
|
||||
3.1.0 / 2019-01-22
|
||||
==================
|
||||
|
||||
* Add petabyte (`pb`) support
|
||||
|
||||
3.0.0 / 2017-08-31
|
||||
==================
|
||||
|
||||
* Change "kB" to "KB" in format output
|
||||
* Remove support for Node.js 0.6
|
||||
* Remove support for ComponentJS
|
||||
|
||||
2.5.0 / 2017-03-24
|
||||
==================
|
||||
|
||||
* Add option "unit"
|
||||
|
||||
2.4.0 / 2016-06-01
|
||||
==================
|
||||
|
||||
* Add option "unitSeparator"
|
||||
|
||||
2.3.0 / 2016-02-15
|
||||
==================
|
||||
|
||||
* Drop partial bytes on all parsed units
|
||||
* Fix non-finite numbers to `.format` to return `null`
|
||||
* Fix parsing byte string that looks like hex
|
||||
* perf: hoist regular expressions
|
||||
|
||||
2.2.0 / 2015-11-13
|
||||
==================
|
||||
|
||||
* add option "decimalPlaces"
|
||||
* add option "fixedDecimals"
|
||||
|
||||
2.1.0 / 2015-05-21
|
||||
==================
|
||||
|
||||
* add `.format` export
|
||||
* add `.parse` export
|
||||
|
||||
2.0.2 / 2015-05-20
|
||||
==================
|
||||
|
||||
* remove map recreation
|
||||
* remove unnecessary object construction
|
||||
|
||||
2.0.1 / 2015-05-07
|
||||
==================
|
||||
|
||||
* fix browserify require
|
||||
* remove node.extend dependency
|
||||
|
||||
2.0.0 / 2015-04-12
|
||||
==================
|
||||
|
||||
* add option "case"
|
||||
* add option "thousandsSeparator"
|
||||
* return "null" on invalid parse input
|
||||
* support proper round-trip: bytes(bytes(num)) === num
|
||||
* units no longer case sensitive when parsing
|
||||
|
||||
1.0.0 / 2014-05-05
|
||||
==================
|
||||
|
||||
* add negative support. fixes #6
|
||||
|
||||
0.3.0 / 2014-03-19
|
||||
==================
|
||||
|
||||
* added terabyte support
|
||||
|
||||
0.2.1 / 2013-04-01
|
||||
==================
|
||||
|
||||
* add .component
|
||||
|
||||
0.2.0 / 2012-10-28
|
||||
==================
|
||||
|
||||
* bytes(200).should.eql('200b')
|
||||
|
||||
0.1.0 / 2012-07-04
|
||||
==================
|
||||
|
||||
* add bytes to string conversion [yields]
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"2":"C K L G M","33":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","129":"N O"},C:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB EC FC","33":"gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB"},D:{"16":"I v J D E F A B C K","33":"0 1 2 3 4 5 6 7 8 9 L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"2":"I HC zB","33":"v J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"2":"F B C PC QC RC SC qB AC TC rB","33":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e"},G:{"2":"zB UC BC","33":"E VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"16":"pC qC","33":"tB I f rC sC BC tC uC"},J:{"33":"D A"},K:{"2":"A B C qB AC rB","33":"h"},L:{"33":"H"},M:{"33":"H"},N:{"2":"A B"},O:{"33":"vC"},P:{"33":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"33":"1B"},R:{"33":"9C"},S:{"2":"AD","33":"BD"}},B:5,C:"CSS line-clamp"};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
var value = require("./valid-value")
|
||||
, mixin = require("./mixin");
|
||||
|
||||
var getPrototypeOf = Object.getPrototypeOf;
|
||||
|
||||
module.exports = function (target, source) {
|
||||
target = Object(value(target));
|
||||
source = Object(value(source));
|
||||
if (target === source) return target;
|
||||
|
||||
var sources = [];
|
||||
while (source && !isPrototypeOf.call(source, target)) {
|
||||
sources.unshift(source);
|
||||
source = getPrototypeOf(source);
|
||||
}
|
||||
|
||||
var error;
|
||||
sources.forEach(function (sourceProto) {
|
||||
try { mixin(target, sourceProto); } catch (mixinError) { error = mixinError; }
|
||||
});
|
||||
if (error) throw error;
|
||||
return target;
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "@paralleldrive/cuid2",
|
||||
"private": false,
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"src/index.js",
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint --fix",
|
||||
"typescript": "npx -p typescript tsc --esModuleInterop --rootDir . src/index-test.js --noEmit --allowJs --checkJs --target es2020 --moduleResolution node && echo 'TypeScript Complete.'",
|
||||
"test": "NODE_ENV=test node src/index-test.js",
|
||||
"test-color": "NODE_ENV=test node src/index-test.js | tap-nirvana",
|
||||
"collision-test": "NODE_ENV=test node src/collision-test.js | tap-nirvana",
|
||||
"histogram": "NODE_ENV=test node src/histogram.js | tap-nirvana",
|
||||
"watch": "watch 'npm run -s test | tap-nirvana && npm run -s lint && npm run -s typescript' src",
|
||||
"update": "updtr",
|
||||
"release": "release-it"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint",
|
||||
"test-color",
|
||||
"collision-test"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ericelliott/cuid2.git"
|
||||
},
|
||||
"keywords": [
|
||||
"uuid",
|
||||
"guid",
|
||||
"cuid",
|
||||
"unique",
|
||||
"id",
|
||||
"ids",
|
||||
"identifier",
|
||||
"identifiers"
|
||||
],
|
||||
"author": "Eric Elliott",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ericelliott/cuid2/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ericelliott/cuid2#readme",
|
||||
"devDependencies": {
|
||||
"eslint": "8.30.0",
|
||||
"eslint-config-next": "13.1.1",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"next": "13.1.1",
|
||||
"pre-commit": "1.2.2",
|
||||
"prettier": "2.8.1",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"release-it": "15.5.1",
|
||||
"riteway": "7.0.0",
|
||||
"tap-nirvana": "1.1.0",
|
||||
"updtr": "4.0.0",
|
||||
"watch": "1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@noble/hashes": "^1.1.5"
|
||||
},
|
||||
"version": "2.2.0"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"commander","version":"7.2.0","files":{"LICENSE":{"checkedAt":1678883669871,"integrity":"sha512-SDdrYzWbAHFUv6ezmT7KCw4dXk0rQ182bnDDY6OEHwa5HAn++psEhHqcpE43xVNcgYoCvGZWWiTsFe+cYQOYZw==","mode":420,"size":1098},"package-support.json":{"checkedAt":1678883669873,"integrity":"sha512-HRmhkZ1wDiq8+jsuamJlhonlxc6xph8kC0FqqsVtnuI6C5xzeTalpyo+dY++lpJ2IrFat0YpiJlB6RbWoyLubg==","mode":420,"size":231},"package.json":{"checkedAt":1678883669873,"integrity":"sha512-yceWhSLvUQS24jdBBzTyrrX9lvm8wJn5hYJ+kJdmwYbix25JhP2SDjju5QbH2wQpkOYW4nGRolrEWBmGDzNYBA==","mode":420,"size":1767},"CHANGELOG.md":{"checkedAt":1678883669873,"integrity":"sha512-p//makmsdy9HMhMhFsPb3BbwJgQgdzfq87uGSaOFl4mWHqn5WoN75riOLBre37r4QwYL59Q3rVOZSVUH/h0b8g==","mode":420,"size":18812},"index.js":{"checkedAt":1678883669873,"integrity":"sha512-AaCFyRRp6B4fGFqjiMxebL5w3bnuaVknSoHL1oKnJLB9B0tFaW46k7nUHHIMxLRV2xuSqGNrtGbrjpqI/C1QcA==","mode":420,"size":67953},"Readme.md":{"checkedAt":1678883669874,"integrity":"sha512-6WqhE75gN5C+pgLqxzOZIAFOjbw2zU+TyWWwdP5FcSZ26WLMyXGeT7xDLZdWLXu/8N4CMBtPl4oviSnbObiS8w==","mode":420,"size":32975},"esm.mjs":{"checkedAt":1678883669874,"integrity":"sha512-esQctjaQ10xL6BcwIVy86evTBz1s5E1amzLKdpF7ymnrqqf8rtAtyTbm9Zt3CwpsF9beVz8RGH0zSFsoqpX91Q==","mode":420,"size":202},"typings/index.d.ts":{"checkedAt":1678883669874,"integrity":"sha512-B5nn9wl0w9q//v3MFSsRnTb/Hhb7z0jd8fXFhLYSASBihIac4HHyxP7iv4Wo/bpCfHzay3WXUtUQYytm+NvtSQ==","mode":420,"size":21672}}}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "resolve-alpn",
|
||||
"version": "1.2.1",
|
||||
"description": "Detects the ALPN protocol",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/szmarczak/resolve-alpn.git"
|
||||
},
|
||||
"keywords": [
|
||||
"alpn",
|
||||
"tls",
|
||||
"socket",
|
||||
"http2"
|
||||
],
|
||||
"author": "Szymon Marczak",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/szmarczak/resolve-alpn/issues"
|
||||
},
|
||||
"homepage": "https://github.com/szmarczak/resolve-alpn#readme",
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"nyc": "^15.1.0",
|
||||
"pem": "1.14.3",
|
||||
"xo": "^0.38.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SubscriptionLoggable = void 0;
|
||||
var SubscriptionLog_1 = require("./SubscriptionLog");
|
||||
var SubscriptionLoggable = (function () {
|
||||
function SubscriptionLoggable() {
|
||||
this.subscriptions = [];
|
||||
}
|
||||
SubscriptionLoggable.prototype.logSubscribedFrame = function () {
|
||||
this.subscriptions.push(new SubscriptionLog_1.SubscriptionLog(this.scheduler.now()));
|
||||
return this.subscriptions.length - 1;
|
||||
};
|
||||
SubscriptionLoggable.prototype.logUnsubscribedFrame = function (index) {
|
||||
var subscriptionLogs = this.subscriptions;
|
||||
var oldSubscriptionLog = subscriptionLogs[index];
|
||||
subscriptionLogs[index] = new SubscriptionLog_1.SubscriptionLog(oldSubscriptionLog.subscribedFrame, this.scheduler.now());
|
||||
};
|
||||
return SubscriptionLoggable;
|
||||
}());
|
||||
exports.SubscriptionLoggable = SubscriptionLoggable;
|
||||
//# sourceMappingURL=SubscriptionLoggable.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../../src/internal/operators/buffer.ts"],"names":[],"mappings":";;;AACA,qCAAuC;AACvC,qCAAoC;AACpC,2DAAgE;AAChE,qDAAoD;AAwCpD,SAAgB,MAAM,CAAI,eAAqC;IAC7D,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAEhC,IAAI,aAAa,GAAQ,EAAE,CAAC;QAG5B,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EACV,UAAC,KAAK,IAAK,OAAA,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAzB,CAAyB,EACpC;YACE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/B,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CACF,CACF,CAAC;QAGF,qBAAS,CAAC,eAAe,CAAC,CAAC,SAAS,CAClC,6CAAwB,CACtB,UAAU,EACV;YAEE,IAAM,CAAC,GAAG,aAAa,CAAC;YACxB,aAAa,GAAG,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,EACD,WAAI,CACL,CACF,CAAC;QAEF,OAAO;YAEL,aAAa,GAAG,IAAK,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,wBAoCC"}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.switchScan = void 0;
|
||||
var switchMap_1 = require("./switchMap");
|
||||
var lift_1 = require("../util/lift");
|
||||
function switchScan(accumulator, seed) {
|
||||
return lift_1.operate(function (source, subscriber) {
|
||||
var state = seed;
|
||||
switchMap_1.switchMap(function (value, index) { return accumulator(state, value, index); }, function (_, innerValue) { return ((state = innerValue), innerValue); })(source).subscribe(subscriber);
|
||||
return function () {
|
||||
state = null;
|
||||
};
|
||||
});
|
||||
}
|
||||
exports.switchScan = switchScan;
|
||||
//# sourceMappingURL=switchScan.js.map
|
||||
@@ -0,0 +1,145 @@
|
||||
agent-base
|
||||
==========
|
||||
### Turn a function into an [`http.Agent`][http.Agent] instance
|
||||
[](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI)
|
||||
|
||||
This module provides an `http.Agent` generator. That is, you pass it an async
|
||||
callback function, and it returns a new `http.Agent` instance that will invoke the
|
||||
given callback function when sending outbound HTTP requests.
|
||||
|
||||
#### Some subclasses:
|
||||
|
||||
Here's some more interesting uses of `agent-base`.
|
||||
Send a pull request to list yours!
|
||||
|
||||
* [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
|
||||
* [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
|
||||
* [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
|
||||
* [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install agent-base
|
||||
```
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
Here's a minimal example that creates a new `net.Socket` connection to the server
|
||||
for every HTTP request (i.e. the equivalent of `agent: false` option):
|
||||
|
||||
```js
|
||||
var net = require('net');
|
||||
var tls = require('tls');
|
||||
var url = require('url');
|
||||
var http = require('http');
|
||||
var agent = require('agent-base');
|
||||
|
||||
var endpoint = 'http://nodejs.org/api/';
|
||||
var parsed = url.parse(endpoint);
|
||||
|
||||
// This is the important part!
|
||||
parsed.agent = agent(function (req, opts) {
|
||||
var socket;
|
||||
// `secureEndpoint` is true when using the https module
|
||||
if (opts.secureEndpoint) {
|
||||
socket = tls.connect(opts);
|
||||
} else {
|
||||
socket = net.connect(opts);
|
||||
}
|
||||
return socket;
|
||||
});
|
||||
|
||||
// Everything else works just like normal...
|
||||
http.get(parsed, function (res) {
|
||||
console.log('"response" event!', res.headers);
|
||||
res.pipe(process.stdout);
|
||||
});
|
||||
```
|
||||
|
||||
Returning a Promise or using an `async` function is also supported:
|
||||
|
||||
```js
|
||||
agent(async function (req, opts) {
|
||||
await sleep(1000);
|
||||
// etc…
|
||||
});
|
||||
```
|
||||
|
||||
Return another `http.Agent` instance to "pass through" the responsibility
|
||||
for that HTTP request to that agent:
|
||||
|
||||
```js
|
||||
agent(function (req, opts) {
|
||||
return opts.secureEndpoint ? https.globalAgent : http.globalAgent;
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
## Agent(Function callback[, Object options]) → [http.Agent][]
|
||||
|
||||
Creates a base `http.Agent` that will execute the callback function `callback`
|
||||
for every HTTP request that it is used as the `agent` for. The callback function
|
||||
is responsible for creating a `stream.Duplex` instance of some kind that will be
|
||||
used as the underlying socket in the HTTP request.
|
||||
|
||||
The `options` object accepts the following properties:
|
||||
|
||||
* `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional).
|
||||
|
||||
The callback function should have the following signature:
|
||||
|
||||
### callback(http.ClientRequest req, Object options, Function cb) → undefined
|
||||
|
||||
The ClientRequest `req` can be accessed to read request headers and
|
||||
and the path, etc. The `options` object contains the options passed
|
||||
to the `http.request()`/`https.request()` function call, and is formatted
|
||||
to be directly passed to `net.connect()`/`tls.connect()`, or however
|
||||
else you want a Socket to be created. Pass the created socket to
|
||||
the callback function `cb` once created, and the HTTP request will
|
||||
continue to proceed.
|
||||
|
||||
If the `https` module is used to invoke the HTTP request, then the
|
||||
`secureEndpoint` property on `options` _will be set to `true`_.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
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.
|
||||
|
||||
[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
|
||||
@@ -0,0 +1,120 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/core/dataToCSVLine.js</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/libs/core</a> dataToCSVLine.js
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/7</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/7</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></td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </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-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </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">var fileline=<span class="cstat-no" title="statement not covered" >require("./fileline");</span>
|
||||
var csvline=<span class="cstat-no" title="statement not covered" >require("./csvline");</span>
|
||||
/**
|
||||
* Convert data chunk to csv lines with cols
|
||||
* @param {[type]} data [description]
|
||||
* @param {[type]} params [description]
|
||||
* @return {[type]} {lines:[[col1,col2,col3]],partial:String}
|
||||
*/
|
||||
<span class="cstat-no" title="statement not covered" >module.exports = <span class="fstat-no" title="function not covered" >fu</span>nction(data, params) {</span>
|
||||
var line = <span class="cstat-no" title="statement not covered" >fileline(data, params);</span>
|
||||
var lines = <span class="cstat-no" title="statement not covered" >line.lines;</span>
|
||||
var csvLines = <span class="cstat-no" title="statement not covered" >csvline(lines, params);</span>
|
||||
<span class="cstat-no" title="statement not covered" > return {</span>
|
||||
lines: csvLines.lines,
|
||||
partial: csvLines.partial + line.partial
|
||||
};
|
||||
};
|
||||
</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,38 @@
|
||||
{
|
||||
"name": "binary-extensions",
|
||||
"version": "2.2.0",
|
||||
"description": "List of binary file extensions",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/binary-extensions",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"binary-extensions.json",
|
||||
"binary-extensions.json.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"binary",
|
||||
"extensions",
|
||||
"extension",
|
||||
"file",
|
||||
"json",
|
||||
"list",
|
||||
"array"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export declare function prepareContent({ options, content, }: {
|
||||
options: any;
|
||||
content: string;
|
||||
}): string;
|
||||
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
||||
const utils = require("../utils");
|
||||
function generate(patterns, settings) {
|
||||
const positivePatterns = getPositivePatterns(patterns);
|
||||
const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
|
||||
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
|
||||
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
|
||||
const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
|
||||
const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
|
||||
return staticTasks.concat(dynamicTasks);
|
||||
}
|
||||
exports.generate = generate;
|
||||
/**
|
||||
* Returns tasks grouped by basic pattern directories.
|
||||
*
|
||||
* Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
|
||||
* This is necessary because directory traversal starts at the base directory and goes deeper.
|
||||
*/
|
||||
function convertPatternsToTasks(positive, negative, dynamic) {
|
||||
const tasks = [];
|
||||
const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
|
||||
const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
|
||||
const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
|
||||
const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
|
||||
tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
|
||||
/*
|
||||
* For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
|
||||
* into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
|
||||
*/
|
||||
if ('.' in insideCurrentDirectoryGroup) {
|
||||
tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
|
||||
}
|
||||
else {
|
||||
tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
exports.convertPatternsToTasks = convertPatternsToTasks;
|
||||
function getPositivePatterns(patterns) {
|
||||
return utils.pattern.getPositivePatterns(patterns);
|
||||
}
|
||||
exports.getPositivePatterns = getPositivePatterns;
|
||||
function getNegativePatternsAsPositive(patterns, ignore) {
|
||||
const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
|
||||
const positive = negative.map(utils.pattern.convertToPositivePattern);
|
||||
return positive;
|
||||
}
|
||||
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
||||
function groupPatternsByBaseDirectory(patterns) {
|
||||
const group = {};
|
||||
return patterns.reduce((collection, pattern) => {
|
||||
const base = utils.pattern.getBaseDirectory(pattern);
|
||||
if (base in collection) {
|
||||
collection[base].push(pattern);
|
||||
}
|
||||
else {
|
||||
collection[base] = [pattern];
|
||||
}
|
||||
return collection;
|
||||
}, group);
|
||||
}
|
||||
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
||||
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
||||
return Object.keys(positive).map((base) => {
|
||||
return convertPatternGroupToTask(base, positive[base], negative, dynamic);
|
||||
});
|
||||
}
|
||||
exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
|
||||
function convertPatternGroupToTask(base, positive, negative, dynamic) {
|
||||
return {
|
||||
dynamic,
|
||||
positive,
|
||||
negative,
|
||||
base,
|
||||
patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
|
||||
};
|
||||
}
|
||||
exports.convertPatternGroupToTask = convertPatternGroupToTask;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExplorerBase.d.ts","sourceRoot":"","sources":["../src/ExplorerBase.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,cAAM,YAAY,CAAC,CAAC,SAAS,eAAe,GAAG,mBAAmB;IAChE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;IACrC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IACvC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;gBAEV,OAAO,EAAE,CAAC;IAUtB,cAAc,IAAI,IAAI;IAMtB,gBAAgB,IAAI,IAAI;IAMxB,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,cAAc;IAwBtB,SAAS,CAAC,0BAA0B,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO;IAKxE,SAAS,CAAC,qBAAqB,CAC7B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,iBAAiB,GAC/B,MAAM,GAAG,IAAI;IAWhB,OAAO,CAAC,eAAe;IASvB,SAAS,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAkBzD,SAAS,CAAC,gCAAgC,CACxC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,iBAAiB,EAChC,SAAS,EAAE,OAAO,GACjB,iBAAiB;IAgBpB,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAKnD;AAMD,iBAAS,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user