new license file version [CI SKIP]
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
Join all arguments together and normalize the resulting URL.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install url-join
|
||||
```
|
||||
|
||||
If you want to use it directly in a browser use a CDN like [Skypack](https://www.skypack.dev/view/url-join).
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import urlJoin from 'url-join';
|
||||
|
||||
const fullUrl = urlJoin('http://www.google.com', 'a', '/b/cd', '?foo=123');
|
||||
|
||||
console.log(fullUrl);
|
||||
```
|
||||
|
||||
Prints:
|
||||
|
||||
```
|
||||
'http://www.google.com/a/b/cd?foo=123'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Reset the history of which prop type warnings have been logged.
|
||||
*/
|
||||
export function resetPropWarnings(): void;
|
||||
@@ -0,0 +1,305 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/core</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> csv2json/libs/core
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/911</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/503</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/125</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/909</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>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file low" data-value="CSVError.js"><a href="CSVError.js.html">CSVError.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="17" class="abs low">0/17</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="2" class="abs low">0/2</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5" class="abs low">0/5</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="17" class="abs low">0/17</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="Converter.js"><a href="Converter.js.html">Converter.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="375" class="abs low">0/375</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="226" class="abs low">0/226</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="43" class="abs low">0/43</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="374" class="abs low">0/374</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="csvline.js"><a href="csvline.js.html">csvline.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="13" class="abs low">0/13</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="6" class="abs low">0/6</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="13" class="abs low">0/13</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="dataToCSVLine.js"><a href="dataToCSVLine.js.html">dataToCSVLine.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="7" class="abs low">0/7</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="7" class="abs low">0/7</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="defParam.js"><a href="defParam.js.html">defParam.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="23" class="abs low">0/23</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="22" class="abs low">0/22</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="3" class="abs low">0/3</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="22" class="abs low">0/22</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="fileLineToCSVLine.js"><a href="fileLineToCSVLine.js.html">fileLineToCSVLine.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5" class="abs low">0/5</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5" class="abs low">0/5</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="fileline.js"><a href="fileline.js.html">fileline.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="6" class="abs low">0/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="6" class="abs low">0/6</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="filterRow.js"><a href="filterRow.js.html">filterRow.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="12" class="abs low">0/12</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="12" class="abs low">0/12</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="12" class="abs low">0/12</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="getDelimiter.js"><a href="getDelimiter.js.html">getDelimiter.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="15" class="abs low">0/15</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="6" class="abs low">0/6</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="2" class="abs low">0/2</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="15" class="abs low">0/15</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="getEol.js"><a href="getEol.js.html">getEol.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="14" class="abs low">0/14</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="12" class="abs low">0/12</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="14" class="abs low">0/14</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="index.js"><a href="index.js.html">index.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="3" class="abs low">0/3</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="3" class="abs low">0/3</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="linesToJson.js"><a href="linesToJson.js.html">linesToJson.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="121" class="abs low">0/121</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="88" class="abs low">0/88</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="16" class="abs low">0/16</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="121" class="abs low">0/121</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="parser.js"><a href="parser.js.html">parser.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="72" class="abs low">0/72</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="49" class="abs low">0/49</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="10" class="abs low">0/10</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="72" class="abs low">0/72</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="parserMgr.js"><a href="parserMgr.js.html">parserMgr.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="34" class="abs low">0/34</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="14" class="abs low">0/14</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="10" class="abs low">0/10</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="34" class="abs low">0/34</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="rowSplit.js"><a href="rowSplit.js.html">rowSplit.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="70" class="abs low">0/70</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="35" class="abs low">0/35</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5" class="abs low">0/5</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="70" class="abs low">0/70</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="worker.js"><a href="worker.js.html">worker.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="45" class="abs low">0/45</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="13" class="abs low">0/13</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="6" class="abs low">0/6</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="45" class="abs low">0/45</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="workerMgr.js"><a href="workerMgr.js.html">workerMgr.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="79" class="abs low">0/79</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="18" class="abs low">0/18</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="18" class="abs low">0/18</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="79" class="abs low">0/79</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[864] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ<EFBBB7><EFBBB8>ﻻﻼ<EFBBBB> ﺂ£¤ﺄ<C2A4><EFBA84>ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■<EFBBB1>", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Math, "acosh", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, isArrayLike = require("../../array-like/is");
|
||||
|
||||
describe("array-like/is", function () {
|
||||
it("Should return true on array", function () { assert.equal(isArrayLike([]), true); });
|
||||
it("Should return true on array-like object", function () {
|
||||
assert.equal(isArrayLike({ length: 1 }), true);
|
||||
});
|
||||
it("Should by default return false on string", function () {
|
||||
assert.equal(isArrayLike("foo"), false);
|
||||
});
|
||||
it("Should accept strings if specified", function () {
|
||||
assert.equal(isArrayLike("foo", { allowString: true }), true);
|
||||
});
|
||||
|
||||
it("Should return false on objects with negative length", function () {
|
||||
assert.equal(isArrayLike({ length: -1 }), false);
|
||||
});
|
||||
|
||||
it("Should return false on plain object", function () {
|
||||
assert.equal(isArrayLike({}), false);
|
||||
});
|
||||
it("Should return false on function", function () {
|
||||
assert.equal(isArrayLike(function () { return true; }), false);
|
||||
});
|
||||
|
||||
if (typeof Object.create === "function") {
|
||||
it("Should return false on object with no prototype", function () {
|
||||
assert.equal(isArrayLike(Object.create(null)), false);
|
||||
});
|
||||
}
|
||||
it("Should return false on number", function () { assert.equal(isArrayLike(123), false); });
|
||||
it("Should return false on NaN", function () { assert.equal(isArrayLike(NaN), false); });
|
||||
it("Should return false on boolean", function () { assert.equal(isArrayLike(true), false); });
|
||||
if (typeof Symbol === "function") {
|
||||
it("Should return false on symbol", function () {
|
||||
assert.equal(isArrayLike(Symbol("foo")), false);
|
||||
});
|
||||
}
|
||||
|
||||
it("Should return false on null", function () { assert.equal(isArrayLike(null), false); });
|
||||
it("Should return false on undefined", function () {
|
||||
assert.equal(isArrayLike(void 0), false);
|
||||
});
|
||||
});
|
||||
@@ -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.01151,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0.00576,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00576,"69":0,"70":0,"71":0,"72":0,"73":0.00576,"74":0,"75":0,"76":0,"77":0,"78":0.01151,"79":0,"80":0,"81":0,"82":0,"83":0.00576,"84":0,"85":0,"86":0,"87":0,"88":0.00576,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.01151,"103":0,"104":0.01151,"105":0.00576,"106":0.00576,"107":0.00576,"108":0.01727,"109":0.4317,"110":0.29931,"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.00576,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.02302,"50":0,"51":0,"52":0.01727,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.00576,"66":0.01727,"67":0.00576,"68":0.01151,"69":0.00576,"70":0.00576,"71":0.00576,"72":0.01151,"73":0.00576,"74":0.01151,"75":0.01151,"76":0.01151,"77":0.01151,"78":0.01151,"79":0.04605,"80":0.02302,"81":0.01727,"83":0.01151,"84":0.01151,"85":0.01727,"86":0.02302,"87":0.04029,"88":0.02878,"89":0.02878,"90":0.04605,"91":0.0921,"92":0.05756,"93":0.0518,"94":0.03454,"95":0.00576,"96":0.01727,"97":0.02302,"98":0.02302,"99":0.01727,"100":0.01151,"101":0.01727,"102":0.02302,"103":0.12088,"104":0.03454,"105":0.03454,"106":0.04029,"107":0.07483,"108":0.29931,"109":15.15555,"110":10.65436,"111":0.00576,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00576,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0.00576,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.01151,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.04605,"94":0.37414,"95":0.18419,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0.01151,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.00576,"79":0,"80":0.00576,"81":0.00576,"83":0.00576,"84":0.00576,"85":0.00576,"86":0.00576,"87":0,"88":0,"89":0.00576,"90":0.00576,"91":0,"92":0.00576,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00576,"100":0,"101":0,"102":0.00576,"103":0.00576,"104":0,"105":0.00576,"106":0.00576,"107":0.0518,"108":0.03454,"109":0.73677,"110":0.96701},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00576,"14":0.02302,"15":0.00576,_:"0","3.1":0,"3.2":0,"5.1":0.00576,"6.1":0,"7.1":0,"9.1":0.0518,"10.1":0,"11.1":0,"12.1":0.01151,"13.1":0.04029,"14.1":0.06332,"15.1":0.01151,"15.2-15.3":0.01151,"15.4":0.02302,"15.5":0.04029,"15.6":0.21297,"16.0":0.02302,"16.1":0.08634,"16.2":0.22448,"16.3":0.16117,"16.4":0},G:{"8":0.00432,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00432,"6.0-6.1":0.00144,"7.0-7.1":0.01008,"8.1-8.4":0.00144,"9.0-9.2":0.01152,"9.3":0.06481,"10.0-10.2":0.00144,"10.3":0.05473,"11.0-11.2":0.01584,"11.3-11.4":0.03744,"12.0-12.1":0.01728,"12.2-12.5":0.35573,"13.0-13.1":0.01008,"13.2":0.0072,"13.3":0.01584,"13.4-13.7":0.04609,"14.0-14.4":0.12962,"14.5-14.8":0.35861,"15.0-15.1":0.07777,"15.2-15.3":0.11089,"15.4":0.12242,"15.5":0.30244,"15.6":1.11471,"16.0":1.53092,"16.1":3.24618,"16.2":3.75457,"16.3":2.13292,"16.4":0.0072},P:{"4":0.10413,"20":0.2499,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.05206,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01041,"12.0":0,"13.0":0.01041,"14.0":0,"15.0":0.01041,"16.0":0.02083,"17.0":0.03124,"18.0":0.02083,"19.0":0.38527},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.02976,"4.2-4.3":0.0085,"4.4":0,"4.4.3-4.4.4":0.09354},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.00633,"9":0,"10":0,"11":0.05698,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.00424,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.03395},H:{"0":0.16072},L:{"0":52.14233},R:{_:"0"},M:{"0":0.15703},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
/*eslint-disable no-console*/
|
||||
|
||||
|
||||
var fs = require('fs');
|
||||
var argparse = require('argparse');
|
||||
var yaml = require('..');
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var cli = new argparse.ArgumentParser({
|
||||
prog: 'js-yaml',
|
||||
add_help: true
|
||||
});
|
||||
|
||||
cli.add_argument('-v', '--version', {
|
||||
action: 'version',
|
||||
version: require('../package.json').version
|
||||
});
|
||||
|
||||
cli.add_argument('-c', '--compact', {
|
||||
help: 'Display errors in compact mode',
|
||||
action: 'store_true'
|
||||
});
|
||||
|
||||
// deprecated (not needed after we removed output colors)
|
||||
// option suppressed, but not completely removed for compatibility
|
||||
cli.add_argument('-j', '--to-json', {
|
||||
help: argparse.SUPPRESS,
|
||||
dest: 'json',
|
||||
action: 'store_true'
|
||||
});
|
||||
|
||||
cli.add_argument('-t', '--trace', {
|
||||
help: 'Show stack trace on error',
|
||||
action: 'store_true'
|
||||
});
|
||||
|
||||
cli.add_argument('file', {
|
||||
help: 'File to read, utf-8 encoded without BOM',
|
||||
nargs: '?',
|
||||
default: '-'
|
||||
});
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var options = cli.parse_args();
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function readFile(filename, encoding, callback) {
|
||||
if (options.file === '-') {
|
||||
// read from stdin
|
||||
|
||||
var chunks = [];
|
||||
|
||||
process.stdin.on('data', function (chunk) {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
|
||||
process.stdin.on('end', function () {
|
||||
return callback(null, Buffer.concat(chunks).toString(encoding));
|
||||
});
|
||||
} else {
|
||||
fs.readFile(filename, encoding, callback);
|
||||
}
|
||||
}
|
||||
|
||||
readFile(options.file, 'utf8', function (error, input) {
|
||||
var output, isYaml;
|
||||
|
||||
if (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
console.error('File not found: ' + options.file);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
console.error(
|
||||
options.trace && error.stack ||
|
||||
error.message ||
|
||||
String(error));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
output = JSON.parse(input);
|
||||
isYaml = false;
|
||||
} catch (err) {
|
||||
if (err instanceof SyntaxError) {
|
||||
try {
|
||||
output = [];
|
||||
yaml.loadAll(input, function (doc) { output.push(doc); }, {});
|
||||
isYaml = true;
|
||||
|
||||
if (output.length === 0) output = null;
|
||||
else if (output.length === 1) output = output[0];
|
||||
|
||||
} catch (e) {
|
||||
if (options.trace && err.stack) console.error(e.stack);
|
||||
else console.error(e.toString(options.compact));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
console.error(
|
||||
options.trace && err.stack ||
|
||||
err.message ||
|
||||
String(err));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (isYaml) console.log(JSON.stringify(output, null, ' '));
|
||||
else console.log(yaml.dump(output));
|
||||
});
|
||||
@@ -0,0 +1,65 @@
|
||||
# lru-queue
|
||||
## Size limited queue based on [LRU](http://en.wikipedia.org/wiki/Least_Recently_Used#LRU) algorithm
|
||||
|
||||
_Originally derived from [memoizee](https://github.com/medikoo/memoize) package._
|
||||
|
||||
It's low-level utility meant to be used internally within cache algorithms. It backs up [`max`](https://github.com/medikoo/memoize#limiting-cache-size) functionality in [memoizee](https://github.com/medikoo/memoize) project.
|
||||
|
||||
### Installation
|
||||
|
||||
$ npm install lru-queue
|
||||
|
||||
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
|
||||
|
||||
### Usage
|
||||
|
||||
Create queue, and provide a limit
|
||||
|
||||
```javascript
|
||||
var lruQueue = require('lru-queue');
|
||||
var queue = lruQueue(3); // limit size to 3
|
||||
```
|
||||
|
||||
Each queue exposes three methods:
|
||||
|
||||
#### queue.hit(id)
|
||||
|
||||
Registers hit for given _id_ (must be plain string).
|
||||
|
||||
```javascript
|
||||
queue.hit('raz'); // size: 1
|
||||
```
|
||||
|
||||
If hit doesn't remove any old item from list it returns `undefined`, otherwise it returns removed _id_.
|
||||
|
||||
|
||||
```javascript
|
||||
queue.hit('dwa'); // undefined, size: 2
|
||||
queue.hit('trzy'); // undefined, size: 3 (at max)
|
||||
queue.hit('raz'); // undefined, size: 3 (at max)
|
||||
queue.hit('dwa'); // undefined, size: 3 (at max)
|
||||
queue.hit('cztery'); // 'trzy', size: 3 (at max)
|
||||
|
||||
```
|
||||
|
||||
#### queue.delete(id);
|
||||
|
||||
_id's_ can be cleared from queue externally
|
||||
|
||||
```javascript
|
||||
queue.delete('raz'); // size: 2
|
||||
queue.delete('cztery'); // size: 1
|
||||
```
|
||||
|
||||
#### queue.clear();
|
||||
|
||||
Resets queue
|
||||
|
||||
```javascript
|
||||
queue.clear(); // size: 0
|
||||
```
|
||||
|
||||
### Tests [](https://travis-ci.org/medikoo/lru-queue)
|
||||
|
||||
$ npm test
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,154 @@
|
||||
/* eslint consistent-this: 0, no-shadow:0, no-eq-null: 0, eqeqeq: 0, no-unused-vars: 0 */
|
||||
|
||||
// Support for asynchronous functions
|
||||
|
||||
"use strict";
|
||||
|
||||
var aFrom = require("es5-ext/array/from")
|
||||
, objectMap = require("es5-ext/object/map")
|
||||
, mixin = require("es5-ext/object/mixin")
|
||||
, defineLength = require("es5-ext/function/_define-length")
|
||||
, nextTick = require("next-tick");
|
||||
|
||||
var slice = Array.prototype.slice, apply = Function.prototype.apply, create = Object.create;
|
||||
|
||||
require("../lib/registered-extensions").async = function (tbi, conf) {
|
||||
var waiting = create(null)
|
||||
, cache = create(null)
|
||||
, base = conf.memoized
|
||||
, original = conf.original
|
||||
, currentCallback
|
||||
, currentContext
|
||||
, currentArgs;
|
||||
|
||||
// Initial
|
||||
conf.memoized = defineLength(function (arg) {
|
||||
var args = arguments, last = args[args.length - 1];
|
||||
if (typeof last === "function") {
|
||||
currentCallback = last;
|
||||
args = slice.call(args, 0, -1);
|
||||
}
|
||||
return base.apply(currentContext = this, currentArgs = args);
|
||||
}, base);
|
||||
try { mixin(conf.memoized, base); }
|
||||
catch (ignore) {}
|
||||
|
||||
// From cache (sync)
|
||||
conf.on("get", function (id) {
|
||||
var cb, context, args;
|
||||
if (!currentCallback) return;
|
||||
|
||||
// Unresolved
|
||||
if (waiting[id]) {
|
||||
if (typeof waiting[id] === "function") waiting[id] = [waiting[id], currentCallback];
|
||||
else waiting[id].push(currentCallback);
|
||||
currentCallback = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolved, assure next tick invocation
|
||||
cb = currentCallback;
|
||||
context = currentContext;
|
||||
args = currentArgs;
|
||||
currentCallback = currentContext = currentArgs = null;
|
||||
nextTick(function () {
|
||||
var data;
|
||||
if (hasOwnProperty.call(cache, id)) {
|
||||
data = cache[id];
|
||||
conf.emit("getasync", id, args, context);
|
||||
apply.call(cb, data.context, data.args);
|
||||
} else {
|
||||
// Purged in a meantime, we shouldn't rely on cached value, recall
|
||||
currentCallback = cb;
|
||||
currentContext = context;
|
||||
currentArgs = args;
|
||||
base.apply(context, args);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Not from cache
|
||||
conf.original = function () {
|
||||
var args, cb, origCb, result;
|
||||
if (!currentCallback) return apply.call(original, this, arguments);
|
||||
args = aFrom(arguments);
|
||||
cb = function self(err) {
|
||||
var cb, args, id = self.id;
|
||||
if (id == null) {
|
||||
// Shouldn't happen, means async callback was called sync way
|
||||
nextTick(apply.bind(self, this, arguments));
|
||||
return undefined;
|
||||
}
|
||||
delete self.id;
|
||||
cb = waiting[id];
|
||||
delete waiting[id];
|
||||
if (!cb) {
|
||||
// Already processed,
|
||||
// outcome of race condition: asyncFn(1, cb), asyncFn.clear(), asyncFn(1, cb)
|
||||
return undefined;
|
||||
}
|
||||
args = aFrom(arguments);
|
||||
if (conf.has(id)) {
|
||||
if (err) {
|
||||
conf.delete(id);
|
||||
} else {
|
||||
cache[id] = { context: this, args: args };
|
||||
conf.emit("setasync", id, typeof cb === "function" ? 1 : cb.length);
|
||||
}
|
||||
}
|
||||
if (typeof cb === "function") {
|
||||
result = apply.call(cb, this, args);
|
||||
} else {
|
||||
cb.forEach(function (cb) { result = apply.call(cb, this, args); }, this);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
origCb = currentCallback;
|
||||
currentCallback = currentContext = currentArgs = null;
|
||||
args.push(cb);
|
||||
result = apply.call(original, this, args);
|
||||
cb.cb = origCb;
|
||||
currentCallback = cb;
|
||||
return result;
|
||||
};
|
||||
|
||||
// After not from cache call
|
||||
conf.on("set", function (id) {
|
||||
if (!currentCallback) {
|
||||
conf.delete(id);
|
||||
return;
|
||||
}
|
||||
if (waiting[id]) {
|
||||
// Race condition: asyncFn(1, cb), asyncFn.clear(), asyncFn(1, cb)
|
||||
if (typeof waiting[id] === "function") waiting[id] = [waiting[id], currentCallback.cb];
|
||||
else waiting[id].push(currentCallback.cb);
|
||||
} else {
|
||||
waiting[id] = currentCallback.cb;
|
||||
}
|
||||
delete currentCallback.cb;
|
||||
currentCallback.id = id;
|
||||
currentCallback = null;
|
||||
});
|
||||
|
||||
// On delete
|
||||
conf.on("delete", function (id) {
|
||||
var result;
|
||||
// If false, we don't have value yet, so we assume that intention is not
|
||||
// to memoize this call. After value is obtained we don't cache it but
|
||||
// gracefully pass to callback
|
||||
if (hasOwnProperty.call(waiting, id)) return;
|
||||
if (!cache[id]) return;
|
||||
result = cache[id];
|
||||
delete cache[id];
|
||||
conf.emit("deleteasync", id, slice.call(result.args, 1));
|
||||
});
|
||||
|
||||
// On clear
|
||||
conf.on("clear", function () {
|
||||
var oldCache = cache;
|
||||
cache = create(null);
|
||||
conf.emit(
|
||||
"clearasync", objectMap(oldCache, function (data) { return slice.call(data.args, 1); })
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/internal/ajax/errors.ts"],"names":[],"mappings":";;;AACA,mDAAkD;AAClD,6DAA4D;AAsD/C,QAAA,SAAS,GAAkB,mCAAgB,CACtD,UAAC,MAAM;IACL,OAAA,SAAS,aAAa,CAAY,OAAe,EAAE,GAAmB,EAAE,OAAoB;QAC1F,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;QACrC,IAAI,QAAa,CAAC;QAClB,IAAI;YAGF,QAAQ,GAAG,+BAAc,CAAC,GAAG,CAAC,CAAC;SAChC;QAAC,OAAO,GAAG,EAAE;YACZ,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC;SAC7B;QACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;AAhBD,CAgBC,CACJ,CAAC;AAsBW,QAAA,gBAAgB,GAAyB,CAAC;IACrD,SAAS,oBAAoB,CAAY,GAAmB,EAAE,OAAoB;QAChF,iBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,oBAAoB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;IACpE,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC,EAAS,CAAC"}
|
||||
@@ -0,0 +1,14 @@
|
||||
function getProperty(target, prop) {
|
||||
if (typeof prop === "string") {
|
||||
for (const [name, value] of Object.entries(target)) {
|
||||
if (prop.toLowerCase() === name.toLowerCase()) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
export const proxyHeaders = (object) => new Proxy(object, {
|
||||
get: (target, prop) => getProperty(target, prop),
|
||||
has: (target, prop) => getProperty(target, prop) !== undefined
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
# define-lazy-prop [](https://travis-ci.org/sindresorhus/define-lazy-prop)
|
||||
|
||||
> Define a [lazily evaluated](https://en.wikipedia.org/wiki/Lazy_evaluation) property on an object
|
||||
|
||||
Useful when the value of a property is expensive to generate, so you want to delay the computation until the property is needed. For example, improving startup performance by deferring nonessential operations.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install define-lazy-prop
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const defineLazyProp = require('define-lazy-prop');
|
||||
|
||||
const unicorn = {
|
||||
// …
|
||||
};
|
||||
|
||||
defineLazyProp(unicorn, 'rainbow', () => expensiveComputation());
|
||||
|
||||
app.on('user-action', () => {
|
||||
doSomething(unicorn.rainbow);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### defineLazyProp(object, propertyName, fn)
|
||||
|
||||
#### object
|
||||
|
||||
Type: `Object`
|
||||
|
||||
Object to add property to.
|
||||
|
||||
#### propertyName
|
||||
|
||||
Type: `string`
|
||||
|
||||
Name of the property to add.
|
||||
|
||||
#### fn
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Called the first time `propertyName` is accessed. Expected to return a value.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [lazy-value](https://github.com/sindresorhus/lazy-value) - Create a lazily evaluated value
|
||||
- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily
|
||||
- [p-lazy](https://github.com/sindresorhus/p-lazy) - Create a lazy promise
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"toArray.js","sourceRoot":"","sources":["../../../../src/internal/operators/toArray.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAElC,qCAAuC;AAEvC,IAAM,UAAU,GAAG,UAAC,GAAU,EAAE,KAAU,IAAK,OAAA,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAtB,CAAsB,CAAC;AAgCtE,SAAgB,OAAO;IAIrB,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,eAAM,CAAC,UAAU,EAAE,EAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC;AAPD,0BAOC"}
|
||||
@@ -0,0 +1,7 @@
|
||||
export type ResponseStatsTeam = {
|
||||
id: number;
|
||||
name: string;
|
||||
distance: number;
|
||||
donationAmount: number;
|
||||
parent: any;
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createErrorClass } from './createErrorClass';
|
||||
|
||||
export interface UnsubscriptionError extends Error {
|
||||
readonly errors: any[];
|
||||
}
|
||||
|
||||
export interface UnsubscriptionErrorCtor {
|
||||
/**
|
||||
* @deprecated Internal implementation detail. Do not construct error instances.
|
||||
* Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
|
||||
*/
|
||||
new (errors: any[]): UnsubscriptionError;
|
||||
}
|
||||
|
||||
/**
|
||||
* An error thrown when one or more errors have occurred during the
|
||||
* `unsubscribe` of a {@link Subscription}.
|
||||
*/
|
||||
export const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(
|
||||
(_super) =>
|
||||
function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {
|
||||
_super(this);
|
||||
this.message = errors
|
||||
? `${errors.length} errors occurred during unsubscription:
|
||||
${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
|
||||
: '';
|
||||
this.name = 'UnsubscriptionError';
|
||||
this.errors = errors;
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"F A B CC","8":"J D E"},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":"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 e i j k l m n o p q r s t u f H xB yB","2":"DC","8":"0 1 2 3 4 5 6 7 8 9 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 EC FC","194":"NB OB"},D:{"1":"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","8":"I v J D E F A B","257":"0 1 2 3 4 5 6 7 8 9 w g x y z AB BB","769":"C K L G M N O"},E:{"1":"C K L G rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","8":"I v HC zB IC","257":"J D E F A JC KC LC","1025":"B 0B qB"},F:{"1":"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","2":"C qB AC TC rB","8":"F B PC QC RC SC"},G:{"1":"E WC XC YC ZC aC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","8":"zB UC BC VC","1025":"bC cC dC"},H:{"8":"oC"},I:{"1":"I f sC BC tC uC","8":"tB pC qC rC"},J:{"1":"A","8":"D"},K:{"1":"h","8":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"Details & Summary elements"};
|
||||
@@ -0,0 +1,58 @@
|
||||
# internal-slot <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Truly private storage, akin to the JS spec’s concept of internal slots.
|
||||
|
||||
Uses a WeakMap when available; a Map when not; and a regular object in even older engines. Performance and garbage collection behavior will reflect the environment’s capabilities accordingly.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var SLOT = require('internal-slot');
|
||||
var assert = require('assert');
|
||||
|
||||
var o = {};
|
||||
|
||||
assert.throws(function () { SLOT.assert(o, 'foo'); });
|
||||
|
||||
assert.equal(SLOT.has(o, 'foo'), false);
|
||||
assert.equal(SLOT.get(o, 'foo'), undefined);
|
||||
|
||||
SLOT.set(o, 'foo', 42);
|
||||
|
||||
assert.equal(SLOT.has(o, 'foo'), true);
|
||||
assert.equal(SLOT.get(o, 'foo'), 42);
|
||||
|
||||
assert.doesNotThrow(function () { SLOT.assert(o, 'foo'); });
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
## Security
|
||||
|
||||
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
||||
|
||||
[package-url]: https://npmjs.org/package/internal-slot
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/internal-slot.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/internal-slot.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/internal-slot
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/internal-slot/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/internal-slot#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/internal-slot.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/internal-slot.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/internal-slot.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=internal-slot
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/internal-slot/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/internal-slot/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/internal-slot
|
||||
[actions-url]: https://github.com/ljharb/internal-slot/actions
|
||||
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isDataURI;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var validMediaType = /^[a-z]+\/[a-z0-9\-\+\._]+$/i;
|
||||
var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i;
|
||||
var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;
|
||||
|
||||
function isDataURI(str) {
|
||||
(0, _assertString.default)(str);
|
||||
var data = str.split(',');
|
||||
|
||||
if (data.length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var attributes = data.shift().trim().split(';');
|
||||
var schemeAndMediaType = attributes.shift();
|
||||
|
||||
if (schemeAndMediaType.slice(0, 5) !== 'data:') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var mediaType = schemeAndMediaType.slice(5);
|
||||
|
||||
if (mediaType !== '' && !validMediaType.test(mediaType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < attributes.length; i++) {
|
||||
if (!(i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') && !validAttribute.test(attributes[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < data.length; _i++) {
|
||||
if (!validData.test(data[_i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.3",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:dfcreative/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dfcreative/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dfcreative/color-name"
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "escodegen",
|
||||
"description": "ECMAScript code generator",
|
||||
"homepage": "http://github.com/estools/escodegen",
|
||||
"main": "escodegen.js",
|
||||
"bin": {
|
||||
"esgenerate": "./bin/esgenerate.js",
|
||||
"escodegen": "./bin/escodegen.js"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE.BSD",
|
||||
"README.md",
|
||||
"bin",
|
||||
"escodegen.js",
|
||||
"package.json"
|
||||
],
|
||||
"version": "1.14.3",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"web": "http://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/estools/escodegen.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"estraverse": "^4.2.0",
|
||||
"esutils": "^2.0.2",
|
||||
"esprima": "^4.0.1",
|
||||
"optionator": "^0.8.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"source-map": "~0.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acorn": "^7.1.0",
|
||||
"bluebird": "^3.4.7",
|
||||
"bower-registry-client": "^1.0.0",
|
||||
"chai": "^3.5.0",
|
||||
"commonjs-everywhere": "^0.9.7",
|
||||
"gulp": "^3.8.10",
|
||||
"gulp-eslint": "^3.0.1",
|
||||
"gulp-mocha": "^3.0.1",
|
||||
"semver": "^5.1.0"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"scripts": {
|
||||
"test": "gulp travis",
|
||||
"unit-test": "gulp test",
|
||||
"lint": "gulp lint",
|
||||
"release": "node tools/release.js",
|
||||
"build-min": "./node_modules/.bin/cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js",
|
||||
"build": "./node_modules/.bin/cjsify -a path: tools/entry-point.js > escodegen.browser.js"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,585 @@
|
||||
import path from 'node:path';
|
||||
import test from 'ava';
|
||||
import semver from 'semver';
|
||||
import sh from 'shelljs';
|
||||
import _ from 'lodash';
|
||||
import sinon from 'sinon';
|
||||
import Log from '../lib/log.js';
|
||||
import Spinner from '../lib/spinner.js';
|
||||
import Config from '../lib/config.js';
|
||||
import runTasks from '../lib/index.js';
|
||||
import { mkTmpDir, gitAdd, getArgs } from './util/helpers.js';
|
||||
import ShellStub from './stub/shell.js';
|
||||
import {
|
||||
interceptUser as interceptGitLabUser,
|
||||
interceptCollaborator as interceptGitLabCollaborator,
|
||||
interceptPublish as interceptGitLabPublish,
|
||||
interceptAsset as interceptGitLabAsset
|
||||
} from './stub/gitlab.js';
|
||||
import {
|
||||
interceptAuthentication as interceptGitHubAuthentication,
|
||||
interceptCollaborator as interceptGitHubCollaborator,
|
||||
interceptCreate as interceptGitHubCreate,
|
||||
interceptAsset as interceptGitHubAsset
|
||||
} from './stub/github.js';
|
||||
|
||||
const rootDir = new URL('..', import.meta.url);
|
||||
|
||||
const noop = Promise.resolve();
|
||||
|
||||
const sandbox = sinon.createSandbox();
|
||||
|
||||
const npmMajorVersion = semver.major(process.env.npm_config_user_agent.match(/npm\/([^ ]+)/)[1]);
|
||||
|
||||
const testConfig = {
|
||||
ci: true,
|
||||
config: false
|
||||
};
|
||||
|
||||
const log = sandbox.createStubInstance(Log);
|
||||
const spinner = sandbox.createStubInstance(Spinner);
|
||||
spinner.show.callsFake(({ enabled = true, task }) => (enabled ? task() : noop));
|
||||
|
||||
const getContainer = options => {
|
||||
const config = new Config(Object.assign({}, testConfig, options));
|
||||
const shell = new ShellStub({ container: { log, config } });
|
||||
return {
|
||||
log,
|
||||
spinner,
|
||||
config,
|
||||
shell
|
||||
};
|
||||
};
|
||||
|
||||
test.before(t => {
|
||||
t.timeout(90 * 1000);
|
||||
});
|
||||
|
||||
test.serial.beforeEach(t => {
|
||||
const bare = mkTmpDir();
|
||||
const target = mkTmpDir();
|
||||
sh.pushd('-q', bare);
|
||||
sh.exec(`git init --bare .`);
|
||||
sh.exec(`git clone ${bare} ${target}`);
|
||||
sh.pushd('-q', target);
|
||||
gitAdd('line', 'file', 'Add file');
|
||||
t.context = { bare, target };
|
||||
});
|
||||
|
||||
test.serial.afterEach(() => {
|
||||
sandbox.resetHistory();
|
||||
});
|
||||
|
||||
test.serial('should run tasks without throwing errors', async t => {
|
||||
sh.mv('.git', 'foo');
|
||||
const { name, latestVersion, version } = await runTasks({}, getContainer());
|
||||
t.true(log.obtrusive.firstCall.args[0].includes(`release ${name} (${latestVersion}...${version})`));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
});
|
||||
|
||||
test.serial('should run tasks without package.json', async t => {
|
||||
sh.exec('git tag 1.0.0');
|
||||
gitAdd('line', 'file', 'Add file');
|
||||
const { name } = await runTasks({}, getContainer({ increment: 'major', git: { commit: false } }));
|
||||
t.true(log.obtrusive.firstCall.args[0].includes(`release ${name} (1.0.0...2.0.0)`));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
t.is(log.warn.callCount, 0);
|
||||
{
|
||||
const { stdout } = sh.exec('git describe --tags --match=* --abbrev=0');
|
||||
t.is(stdout.trim(), '2.0.0');
|
||||
}
|
||||
});
|
||||
|
||||
test.serial('should disable plugins', async t => {
|
||||
gitAdd('{"name":"my-package","version":"1.2.3"}', 'package.json', 'Add package.json');
|
||||
sh.exec('git tag 1.2.3');
|
||||
gitAdd('line', 'file', 'Add file');
|
||||
const container = getContainer({ increment: 'minor', git: false, npm: false });
|
||||
const { latestVersion, version } = await runTasks({}, container);
|
||||
t.is(latestVersion, '0.0.0');
|
||||
t.is(version, '0.1.0');
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
});
|
||||
|
||||
test.serial('should run tasks with minimal config and without any warnings/errors', async t => {
|
||||
gitAdd('{"name":"my-package","version":"1.2.3"}', 'package.json', 'Add package.json');
|
||||
sh.exec('git tag 1.2.3');
|
||||
gitAdd('line', 'file', 'More file');
|
||||
await runTasks({}, getContainer({ increment: 'patch' }));
|
||||
t.true(log.obtrusive.firstCall.args[0].includes('release my-package (1.2.3...1.2.4)'));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
const { stdout } = sh.exec('git describe --tags --match=* --abbrev=0');
|
||||
t.is(stdout.trim(), '1.2.4');
|
||||
});
|
||||
|
||||
test.serial('should use pkg.version', async t => {
|
||||
gitAdd('{"name":"my-package","version":"1.2.3"}', 'package.json', 'Add package.json');
|
||||
await runTasks({}, getContainer({ increment: 'minor' }));
|
||||
t.true(log.obtrusive.firstCall.args[0].includes('release my-package (1.2.3...1.3.0)'));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
const { stdout } = sh.exec('git describe --tags --match=* --abbrev=0');
|
||||
t.is(stdout.trim(), '1.3.0');
|
||||
});
|
||||
|
||||
test.serial('should use pkg.version (in sub dir) w/o tagging repo', async t => {
|
||||
gitAdd('{"name":"root-package","version":"1.0.0"}', 'package.json', 'Add package.json');
|
||||
sh.exec('git tag 1.0.0');
|
||||
sh.mkdir('my-package');
|
||||
sh.pushd('-q', 'my-package');
|
||||
gitAdd('{"name":"my-package","version":"1.2.3"}', 'package.json', 'Add package.json');
|
||||
const container = getContainer({ increment: 'minor', git: { tag: false } });
|
||||
const exec = sinon.spy(container.shell, 'exec');
|
||||
await runTasks({}, container);
|
||||
t.true(log.obtrusive.firstCall.args[0].endsWith('release my-package (1.2.3...1.3.0)'));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
const { stdout } = sh.exec('git describe --tags --match=* --abbrev=0');
|
||||
t.is(stdout.trim(), '1.0.0');
|
||||
const npmArgs = getArgs(exec.args, 'npm');
|
||||
t.is(npmArgs[5], 'npm version 1.3.0 --no-git-tag-version');
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should ignore version in pkg.version and use git tag instead', async t => {
|
||||
gitAdd('{"name":"my-package","version":"0.0.0"}', 'package.json', 'Add package.json');
|
||||
sh.exec('git tag 1.1.1');
|
||||
gitAdd('line', 'file', 'More file');
|
||||
await runTasks({}, getContainer({ increment: 'minor', npm: { ignoreVersion: true } }));
|
||||
t.true(log.obtrusive.firstCall.args[0].includes('release my-package (1.1.1...1.2.0)'));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
const { stdout } = sh.exec('git describe --tags --match=* --abbrev=0');
|
||||
t.is(stdout.trim(), '1.2.0');
|
||||
});
|
||||
|
||||
test.serial('should release all the things (basic)', async t => {
|
||||
const { bare, target } = t.context;
|
||||
const project = path.basename(bare);
|
||||
const pkgName = path.basename(target);
|
||||
const owner = path.basename(path.dirname(bare));
|
||||
gitAdd(`{"name":"${pkgName}","version":"1.0.0"}`, 'package.json', 'Add package.json');
|
||||
sh.exec('git tag 1.0.0');
|
||||
const sha = gitAdd('line', 'file', 'More file');
|
||||
|
||||
interceptGitHubAuthentication();
|
||||
interceptGitHubCollaborator({ owner, project });
|
||||
interceptGitHubCreate({
|
||||
owner,
|
||||
project,
|
||||
body: { tag_name: '1.0.1', name: 'Release 1.0.1', body: `* More file (${sha})`, prerelease: false }
|
||||
});
|
||||
|
||||
const container = getContainer({
|
||||
github: { release: true, pushRepo: `https://github.com/${owner}/${project}` },
|
||||
npm: { name: pkgName }
|
||||
});
|
||||
const exec = sinon.spy(container.shell, 'exec');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const npmArgs = getArgs(container.shell.exec.args, 'npm');
|
||||
|
||||
t.deepEqual(npmArgs, [
|
||||
'npm ping',
|
||||
'npm whoami',
|
||||
`npm show ${pkgName}@latest version`,
|
||||
'npm --version',
|
||||
`npm access ${npmMajorVersion >= 9 ? 'list collaborators --json' : 'ls-collaborators'} ${pkgName}`,
|
||||
'npm version 1.0.1 --no-git-tag-version',
|
||||
'npm publish . --tag latest'
|
||||
]);
|
||||
|
||||
t.true(log.obtrusive.firstCall.args[0].endsWith(`release ${pkgName} (1.0.0...1.0.1)`));
|
||||
t.true(log.log.firstCall.args[0].endsWith(`https://www.npmjs.com/package/${pkgName}`));
|
||||
t.true(log.log.secondCall.args[0].endsWith(`https://github.com/${owner}/${project}/releases/tag/1.0.1`));
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should release with correct tag name', async t => {
|
||||
const { bare, target } = t.context;
|
||||
const project = path.basename(bare);
|
||||
const pkgName = path.basename(target);
|
||||
const owner = path.basename(path.dirname(bare));
|
||||
const { stdout } = sh.exec('git rev-parse --abbrev-ref HEAD');
|
||||
const branchName = stdout.trim();
|
||||
gitAdd(`{"name":"${pkgName}","version":"1.0.0"}`, 'package.json', 'Add package.json');
|
||||
sh.exec(`git tag ${pkgName}-${branchName}-1.0.0`);
|
||||
const sha = gitAdd('line', 'file', 'More file');
|
||||
|
||||
interceptGitHubCreate({
|
||||
owner,
|
||||
project,
|
||||
body: {
|
||||
tag_name: `${pkgName}-${branchName}-1.0.1`,
|
||||
name: 'Release 1.0.1',
|
||||
body: `* More file (${sha})`,
|
||||
prerelease: false
|
||||
}
|
||||
});
|
||||
|
||||
const container = getContainer({
|
||||
git: { tagName: '${npm.name}-${branchName}-${version}' },
|
||||
github: { release: true, skipChecks: true, pushRepo: `https://github.com/${owner}/${project}` }
|
||||
});
|
||||
|
||||
const exec = sinon.spy(container.shell, 'exec');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const gitArgs = getArgs(container.shell.exec.args, 'git');
|
||||
|
||||
t.true(gitArgs.includes(`git tag --annotate --message Release 1.0.1 ${pkgName}-${branchName}-1.0.1`));
|
||||
t.true(
|
||||
log.log.secondCall.args[0].endsWith(
|
||||
`https://github.com/${owner}/${project}/releases/tag/${pkgName}-${branchName}-1.0.1`
|
||||
)
|
||||
);
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should release all the things (pre-release, github, gitlab)', async t => {
|
||||
const { bare, target } = t.context;
|
||||
const project = path.basename(bare);
|
||||
const pkgName = path.basename(target);
|
||||
const owner = path.basename(path.dirname(bare));
|
||||
const url = `https://gitlab.com/${owner}/${project}`;
|
||||
gitAdd(`{"name":"${pkgName}","version":"1.0.0"}`, 'package.json', 'Add package.json');
|
||||
sh.exec('git tag v1.0.0');
|
||||
const sha = gitAdd('line', 'file', 'More file');
|
||||
sh.exec('git push --follow-tags');
|
||||
|
||||
interceptGitHubAuthentication();
|
||||
interceptGitHubCollaborator({ owner, project });
|
||||
interceptGitHubCreate({
|
||||
owner,
|
||||
project,
|
||||
body: {
|
||||
tag_name: 'v1.1.0-alpha.0',
|
||||
name: 'Release 1.1.0-alpha.0',
|
||||
body: `Notes for ${pkgName} [v1.1.0-alpha.0]: ${sha}`,
|
||||
prerelease: true
|
||||
}
|
||||
});
|
||||
interceptGitHubAsset({ owner, project, body: 'lineline' });
|
||||
|
||||
interceptGitLabUser({ owner });
|
||||
interceptGitLabCollaborator({ owner, project });
|
||||
interceptGitLabAsset({ owner, project });
|
||||
interceptGitLabPublish({
|
||||
owner,
|
||||
project,
|
||||
body: {
|
||||
name: 'Release 1.1.0-alpha.0',
|
||||
tag_name: 'v1.1.0-alpha.0',
|
||||
description: `Notes for ${pkgName}: ${sha}`,
|
||||
assets: {
|
||||
links: [
|
||||
{
|
||||
name: 'file',
|
||||
url: `${url}/uploads/7e8bec1fe27cc46a4bc6a91b9e82a07c/file`
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const container = getContainer({
|
||||
increment: 'minor',
|
||||
preRelease: 'alpha',
|
||||
git: {
|
||||
changelog: 'git log --pretty=format:%h ${latestTag}...HEAD',
|
||||
commitMessage: 'Release ${version} for ${name} (from ${latestVersion})',
|
||||
tagAnnotation: '${repo.owner} ${repo.repository} ${repo.project}'
|
||||
},
|
||||
github: {
|
||||
release: true,
|
||||
pushRepo: `https://github.com/${owner}/${project}`,
|
||||
releaseNotes: 'echo Notes for ${name} [v${version}]: ${changelog}',
|
||||
assets: ['file']
|
||||
},
|
||||
gitlab: {
|
||||
release: true,
|
||||
pushRepo: url,
|
||||
releaseNotes: 'echo Notes for ${name}: ${changelog}',
|
||||
assets: ['file']
|
||||
},
|
||||
npm: { name: pkgName }
|
||||
});
|
||||
|
||||
const exec = sinon.spy(container.shell, 'exec');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const npmArgs = getArgs(container.shell.exec.args, 'npm');
|
||||
t.deepEqual(npmArgs, [
|
||||
'npm ping',
|
||||
'npm whoami',
|
||||
`npm show ${pkgName}@latest version`,
|
||||
'npm --version',
|
||||
`npm access ${npmMajorVersion >= 9 ? 'list collaborators --json' : 'ls-collaborators'} ${pkgName}`,
|
||||
'npm version 1.1.0-alpha.0 --no-git-tag-version',
|
||||
'npm publish . --tag alpha'
|
||||
]);
|
||||
|
||||
const { stdout: commitMessage } = sh.exec('git log --oneline --format=%B -n 1 HEAD');
|
||||
t.is(commitMessage.trim(), `Release 1.1.0-alpha.0 for ${pkgName} (from 1.0.0)`);
|
||||
|
||||
const { stdout: tagName } = sh.exec('git describe --tags --match=* --abbrev=0');
|
||||
t.is(tagName.trim(), 'v1.1.0-alpha.0');
|
||||
|
||||
const { stdout: tagAnnotation } = sh.exec('git for-each-ref refs/tags/v1.1.0-alpha.0 --format="%(contents)"');
|
||||
t.is(tagAnnotation.trim(), `${owner} ${owner}/${project} ${project}`);
|
||||
|
||||
t.true(log.obtrusive.firstCall.args[0].endsWith(`release ${pkgName} (1.0.0...1.1.0-alpha.0)`));
|
||||
t.true(log.log.firstCall.args[0].endsWith(`https://www.npmjs.com/package/${pkgName}`));
|
||||
t.true(log.log.secondCall.args[0].endsWith(`https://github.com/${owner}/${project}/releases/tag/v1.1.0-alpha.0`));
|
||||
t.true(log.log.thirdCall.args[0].endsWith(`${project}/-/releases`));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should publish pre-release without pre-id with different npm.tag', async t => {
|
||||
const { target } = t.context;
|
||||
const pkgName = path.basename(target);
|
||||
gitAdd(`{"name":"${pkgName}","version":"1.0.0"}`, 'package.json', 'Add package.json');
|
||||
sh.exec('git tag v1.0.0');
|
||||
|
||||
const container = getContainer({ increment: 'major', preRelease: true, npm: { name: pkgName, tag: 'next' } });
|
||||
const exec = sinon.spy(container.shell, 'exec');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const npmArgs = getArgs(container.shell.exec.args, 'npm');
|
||||
t.deepEqual(npmArgs, [
|
||||
'npm ping',
|
||||
'npm whoami',
|
||||
`npm show ${pkgName}@latest version`,
|
||||
'npm --version',
|
||||
`npm access ${npmMajorVersion >= 9 ? 'list collaborators --json' : 'ls-collaborators'} ${pkgName}`,
|
||||
'npm version 2.0.0-0 --no-git-tag-version',
|
||||
'npm publish . --tag next'
|
||||
]);
|
||||
|
||||
const { stdout } = sh.exec('git describe --tags --match=* --abbrev=0');
|
||||
t.is(stdout.trim(), 'v2.0.0-0');
|
||||
t.true(log.obtrusive.firstCall.args[0].endsWith(`release ${pkgName} (1.0.0...2.0.0-0)`));
|
||||
t.true(log.log.firstCall.args[0].endsWith(`https://www.npmjs.com/package/${pkgName}`));
|
||||
t.regex(log.log.lastCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should handle private package correctly, bump lockfile', async t => {
|
||||
const { target } = t.context;
|
||||
const pkgName = path.basename(target);
|
||||
gitAdd(`{"name":"${pkgName}","version":"1.0.0","private":true}`, 'package.json', 'Add package.json');
|
||||
gitAdd(`{"name":"${pkgName}","version":"1.0.0","private":true}`, 'package-lock.json', 'Add package-lock.json');
|
||||
|
||||
const container = getContainer({ npm: { name: pkgName, private: true } });
|
||||
const exec = sinon.spy(container.shell, 'exec');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const npmArgs = getArgs(container.shell.exec.args, 'npm');
|
||||
t.deepEqual(npmArgs, ['npm version 1.0.1 --no-git-tag-version']);
|
||||
t.true(log.obtrusive.firstCall.args[0].endsWith(`release ${pkgName} (1.0.0...1.0.1)`));
|
||||
t.is(log.warn.length, 0);
|
||||
t.regex(log.log.firstCall.args[0], /Done \(in [0-9]+s\.\)/);
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should initially publish non-private scoped npm package privately', async t => {
|
||||
const { target } = t.context;
|
||||
const pkgName = path.basename(target);
|
||||
gitAdd(`{"name":"@scope/${pkgName}","version":"1.0.0"}`, 'package.json', 'Add package.json');
|
||||
|
||||
const container = getContainer({ npm: { name: pkgName } });
|
||||
|
||||
const exec = sinon.stub(container.shell, 'exec').callThrough();
|
||||
exec.withArgs(`npm show @scope/${pkgName}@latest version`).rejects();
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const npmArgs = getArgs(container.shell.exec.args, 'npm');
|
||||
t.is(npmArgs[6], 'npm publish . --tag latest');
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should use pkg.publishConfig.registry', async t => {
|
||||
const { target } = t.context;
|
||||
const pkgName = path.basename(target);
|
||||
const registry = 'https://my-registry.example.org';
|
||||
|
||||
gitAdd(
|
||||
JSON.stringify({
|
||||
name: pkgName,
|
||||
version: '1.2.3',
|
||||
publishConfig: { registry }
|
||||
}),
|
||||
'package.json',
|
||||
'Add package.json'
|
||||
);
|
||||
|
||||
const container = getContainer();
|
||||
|
||||
const exec = sinon.spy(container.shell, 'exec');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const npmArgs = getArgs(exec.args, 'npm');
|
||||
t.is(npmArgs[0], `npm ping --registry ${registry}`);
|
||||
t.is(npmArgs[1], `npm whoami --registry ${registry}`);
|
||||
t.true(container.log.log.firstCall.args[0].endsWith(`${registry}/package/${pkgName}`));
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
test.serial('should propagate errors', async t => {
|
||||
const config = {
|
||||
hooks: {
|
||||
'before:init': 'some-failing-command'
|
||||
}
|
||||
};
|
||||
const container = getContainer(config);
|
||||
|
||||
await t.throwsAsync(runTasks({}, container), { message: /some-failing-command/ });
|
||||
|
||||
t.is(log.error.callCount, 1);
|
||||
});
|
||||
|
||||
test.serial('should use custom changelog command with context', async t => {
|
||||
const { bare } = t.context;
|
||||
const project = path.basename(bare);
|
||||
const owner = path.basename(path.dirname(bare));
|
||||
sh.exec('git tag v1.0.0');
|
||||
gitAdd('line', 'file', 'More file');
|
||||
|
||||
interceptGitHubAuthentication();
|
||||
interceptGitHubCollaborator({ owner, project });
|
||||
interceptGitHubCreate({
|
||||
owner,
|
||||
project,
|
||||
body: {
|
||||
tag_name: 'v1.1.0',
|
||||
name: 'Release 1.1.0',
|
||||
body: 'custom-changelog-generator --from=v1.0.0 --to=v1.1.0',
|
||||
draft: false,
|
||||
prerelease: false
|
||||
}
|
||||
});
|
||||
|
||||
const container = getContainer({
|
||||
increment: 'minor',
|
||||
github: {
|
||||
release: true,
|
||||
releaseNotes: 'echo custom-changelog-generator --from=${latestTag} --to=${tagName}',
|
||||
pushRepo: `https://github.com/${owner}/${project}`
|
||||
}
|
||||
});
|
||||
|
||||
const exec = sinon.spy(container.shell, 'execStringCommand');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const command = exec.args.find(([command]) => command.includes('custom-changelog-generator'));
|
||||
|
||||
t.is(command[0], 'echo custom-changelog-generator --from=v1.0.0 --to=v1.1.0');
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
|
||||
{
|
||||
test.serial('should run all hooks', async t => {
|
||||
gitAdd(`{"name":"hooked","version":"1.0.0","type":"module"}`, 'package.json', 'Add package.json');
|
||||
sh.exec(`npm install ${rootDir}`);
|
||||
const plugin = "import { Plugin } from 'release-it'; class MyPlugin extends Plugin {}; export default MyPlugin;";
|
||||
sh.ShellString(plugin).toEnd('my-plugin.js');
|
||||
|
||||
const hooks = {};
|
||||
['before', 'after'].forEach(prefix => {
|
||||
['version', 'git', 'npm', 'my-plugin'].forEach(ns => {
|
||||
['init', 'beforeBump', 'bump', 'beforeRelease', 'release', 'afterRelease'].forEach(cycle => {
|
||||
hooks[`${prefix}:${cycle}`] = `echo ${prefix}:${cycle}`;
|
||||
hooks[`${prefix}:${ns}:${cycle}`] = `echo ${prefix}:${ns}:${cycle}`;
|
||||
});
|
||||
});
|
||||
});
|
||||
const container = getContainer({
|
||||
plugins: { './my-plugin.js': {} },
|
||||
git: { requireCleanWorkingDir: false },
|
||||
hooks
|
||||
});
|
||||
const exec = sinon.spy(container.shell, 'execFormattedCommand');
|
||||
|
||||
await runTasks({}, container);
|
||||
|
||||
const commands = _.flatten(exec.args).filter(arg => typeof arg === 'string' && arg.startsWith('echo'));
|
||||
|
||||
t.deepEqual(commands, [
|
||||
'echo before:init',
|
||||
'echo before:my-plugin:init',
|
||||
'echo after:my-plugin:init',
|
||||
'echo before:npm:init',
|
||||
'echo after:npm:init',
|
||||
'echo before:git:init',
|
||||
'echo after:git:init',
|
||||
'echo before:version:init',
|
||||
'echo after:version:init',
|
||||
'echo after:init',
|
||||
'echo before:beforeBump',
|
||||
'echo before:my-plugin:beforeBump',
|
||||
'echo after:my-plugin:beforeBump',
|
||||
'echo before:npm:beforeBump',
|
||||
'echo after:npm:beforeBump',
|
||||
'echo before:git:beforeBump',
|
||||
'echo after:git:beforeBump',
|
||||
'echo before:version:beforeBump',
|
||||
'echo after:version:beforeBump',
|
||||
'echo after:beforeBump',
|
||||
'echo before:bump',
|
||||
'echo before:my-plugin:bump',
|
||||
'echo after:my-plugin:bump',
|
||||
'echo before:npm:bump',
|
||||
'echo after:npm:bump',
|
||||
'echo before:git:bump',
|
||||
'echo after:git:bump',
|
||||
'echo before:version:bump',
|
||||
'echo after:version:bump',
|
||||
'echo after:bump',
|
||||
'echo before:beforeRelease',
|
||||
'echo before:my-plugin:beforeRelease',
|
||||
'echo after:my-plugin:beforeRelease',
|
||||
'echo before:npm:beforeRelease',
|
||||
'echo after:npm:beforeRelease',
|
||||
'echo before:git:beforeRelease',
|
||||
'echo after:git:beforeRelease',
|
||||
'echo before:version:beforeRelease',
|
||||
'echo after:version:beforeRelease',
|
||||
'echo after:beforeRelease',
|
||||
'echo before:release',
|
||||
'echo before:npm:release',
|
||||
'echo after:npm:release',
|
||||
'echo before:git:release',
|
||||
'echo after:git:release',
|
||||
'echo before:version:release',
|
||||
'echo after:version:release',
|
||||
'echo before:my-plugin:release',
|
||||
'echo after:my-plugin:release',
|
||||
'echo after:release',
|
||||
'echo before:afterRelease',
|
||||
'echo before:npm:afterRelease',
|
||||
'echo after:npm:afterRelease',
|
||||
'echo before:git:afterRelease',
|
||||
'echo after:git:afterRelease',
|
||||
'echo before:version:afterRelease',
|
||||
'echo after:version:afterRelease',
|
||||
'echo before:my-plugin:afterRelease',
|
||||
'echo after:my-plugin:afterRelease',
|
||||
'echo after:afterRelease'
|
||||
]);
|
||||
|
||||
exec.restore();
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import ENDPOINTS from "./generated/endpoints";
|
||||
import { VERSION } from "./version";
|
||||
import { endpointsToMethods } from "./endpoints-to-methods";
|
||||
export function restEndpointMethods(octokit) {
|
||||
const api = endpointsToMethods(octokit, ENDPOINTS);
|
||||
return {
|
||||
rest: api,
|
||||
};
|
||||
}
|
||||
restEndpointMethods.VERSION = VERSION;
|
||||
export function legacyRestEndpointMethods(octokit) {
|
||||
const api = endpointsToMethods(octokit, ENDPOINTS);
|
||||
return {
|
||||
...api,
|
||||
rest: api,
|
||||
};
|
||||
}
|
||||
legacyRestEndpointMethods.VERSION = VERSION;
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import updater from 'update-notifier';
|
||||
import parseArgs from 'yargs-parser';
|
||||
import release from '../lib/cli.js';
|
||||
import { readJSON } from '../lib/util.js';
|
||||
|
||||
const pkg = readJSON(new URL('../package.json', import.meta.url));
|
||||
|
||||
const aliases = {
|
||||
c: 'config',
|
||||
d: 'dry-run',
|
||||
h: 'help',
|
||||
i: 'increment',
|
||||
v: 'version',
|
||||
V: 'verbose'
|
||||
};
|
||||
|
||||
const parseCliArguments = args => {
|
||||
const options = parseArgs(args, {
|
||||
boolean: ['dry-run', 'ci'],
|
||||
alias: aliases,
|
||||
configuration: {
|
||||
'parse-numbers': false,
|
||||
'camel-case-expansion': false
|
||||
}
|
||||
});
|
||||
if (options.V) {
|
||||
options.verbose = typeof options.V === 'boolean' ? options.V : options.V.length;
|
||||
delete options.V;
|
||||
}
|
||||
options.increment = options._[0] || options.i;
|
||||
return options;
|
||||
};
|
||||
|
||||
const options = parseCliArguments([].slice.call(process.argv, 2));
|
||||
|
||||
updater({ pkg: pkg }).notify();
|
||||
release(options).then(
|
||||
() => process.exit(0),
|
||||
({ code }) => process.exit(Number.isInteger(code) ? code : 1)
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Math, "tanh", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../../src/internal/operators/concat.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAY1C,MAAM,UAAU,MAAM;IAAO,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,yBAAc;;IACzC,IAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,SAAS,EAAE,CAAC,IAAI,gBAAE,MAAM,UAAK,IAAI,IAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opções:",
|
||||
"Examples:": "Exemplos:",
|
||||
"boolean": "boolean",
|
||||
"count": "contagem",
|
||||
"string": "cadeia de caracteres",
|
||||
"number": "número",
|
||||
"array": "arranjo",
|
||||
"required": "requerido",
|
||||
"default": "padrão",
|
||||
"default:": "padrão:",
|
||||
"choices:": "escolhas:",
|
||||
"generated-value": "valor-gerado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s",
|
||||
"other": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Excesso de argumentos não opcionais: recebido %s, máximo de %s",
|
||||
"other": "Excesso de argumentos não opcionais: recebido %s, máximo de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta valor de argumento: %s",
|
||||
"other": "Falta valores de argumento: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Falta argumento obrigatório: %s",
|
||||
"other": "Faltando argumentos obrigatórios: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argumento desconhecido: %s",
|
||||
"other": "Argumentos desconhecidos: %s"
|
||||
},
|
||||
"Invalid values:": "Valores inválidos:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s",
|
||||
"Argument check failed: %s": "Verificação de argumento falhou: %s",
|
||||
"Implications failed:": "Implicações falharam:",
|
||||
"Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s",
|
||||
"Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s",
|
||||
"Path to JSON config file": "Caminho para o arquivo de configuração em JSON",
|
||||
"Show help": "Mostra ajuda",
|
||||
"Show version number": "Mostra número de versão",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') {
|
||||
test('has native Symbol support', function (t) {
|
||||
t.equal(typeof Symbol, 'function');
|
||||
t.equal(typeof Symbol(), 'symbol');
|
||||
t.end();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var hasSymbolToStringTag = require('../../shams');
|
||||
|
||||
test('polyfilled Symbols', function (t) {
|
||||
/* eslint-disable global-require */
|
||||
t.equal(hasSymbolToStringTag(), false, 'hasSymbolToStringTag is false before polyfilling');
|
||||
|
||||
require('get-own-property-symbols');
|
||||
|
||||
require('../tests')(t);
|
||||
|
||||
var hasToStringTagAfter = hasSymbolToStringTag();
|
||||
t.equal(hasToStringTagAfter, true, 'hasSymbolToStringTag is true after polyfilling');
|
||||
/* eslint-enable global-require */
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"universal-user-agent","version":"6.0.0","files":{"dist-node/index.js":{"checkedAt":1678883670399,"integrity":"sha512-GqU7PsXS7ueJOcj+WyCfAzolRdmUkFyQg4oWTbtkXmotrmTm6bIy5CzWXPWLm8y3v9TxkdIqOCXgPUr2pjcWYw==","mode":420,"size":478},"dist-src/index.js":{"checkedAt":1678883670399,"integrity":"sha512-VMdflyPVzx1qCavSv6tUep6ZTSFGX57t89UESkunweQd1jLQqGANrN0YIyx4Fr1y+avQIHbzxUZUS9hZCPxFYA==","mode":420,"size":350},"dist-web/index.js":{"checkedAt":1678883670399,"integrity":"sha512-pHEHkVTFw4r6EfcZKForg28SMWNqQO44X18Zi4M4cmRKGyoZ6eWtcKhTtNoKVPU6RVOTMsTMhF/2KqJLA/Aj6w==","mode":420,"size":403},"package.json":{"checkedAt":1678883670399,"integrity":"sha512-J8GhcgArX/4VRiu762dHuNpHLUmv2ei4L+TTMnv9m+Kp8P1g94tAG8gKHyOSjKumSaXlRwLBQphaJi8A6JLqLw==","mode":420,"size":840},"dist-node/index.js.map":{"checkedAt":1678883670399,"integrity":"sha512-uQKGKbe0EKXIQAeFiKSAUR3AOfYPcoK8zCnPcHhQLpRoLUKjKYpB0qO60JXT4I2kYAl0l8che02QT8mhe5lMHg==","mode":420,"size":887},"LICENSE.md":{"checkedAt":1678883670399,"integrity":"sha512-EQk4tL2VTNhaYSyl3b1C2jUHAwlbqpdIAuG0hAxsM6dvYUf4nomq/r/xDDnTY2GRGuSHzt8Np1Qlvsyihey92g==","mode":420,"size":808},"README.md":{"checkedAt":1678883670399,"integrity":"sha512-Fx/PMH8ZlT5yVvW1bPNWtziZd/L7WM03XDvt8R9VpJyIpeOy2X/tWxAYRxlwruoKsi0XFg9QG1mtEiAzAM/8Dg==","mode":420,"size":995},"dist-web/index.js.map":{"checkedAt":1678883670399,"integrity":"sha512-aL04N2xmSBoitZw/mZxA/X5gaYZNnJqMr91qS8BIro8i5L94sJqROfTK39dSAAT/L++7z2P3+2cJ6UvZTTFC+Q==","mode":420,"size":868},"dist-types/index.d.ts":{"checkedAt":1678883670399,"integrity":"sha512-MuLoAd73InhPMbAbCRG1in6IzVBFfQCcg7kL3z1q+I/fWHzH7P9bYuaG2/ujBrqzVLHlRpkdR/Kkbl3E+KD6bA==","mode":420,"size":48}}}
|
||||
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/is-map
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -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.0135,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0.00338,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.00338,"67":0,"68":0.00338,"69":0,"70":0,"71":0,"72":0,"73":0.00338,"74":0,"75":0,"76":0,"77":0,"78":0.00338,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0.00675,"87":0,"88":0.00675,"89":0,"90":0,"91":0.03713,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00338,"100":0,"101":0,"102":0.00675,"103":0.00338,"104":0.00675,"105":0.00675,"106":0.00675,"107":0.00675,"108":0.0135,"109":0.243,"110":0.16538,"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.00338,"35":0,"36":0,"37":0,"38":0.00675,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.05063,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0.00338,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.01688,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0.00338,"73":0,"74":0.00338,"75":0.00338,"76":0.00338,"77":0.00338,"78":0.00338,"79":0.0135,"80":0.00338,"81":0.00675,"83":0.00338,"84":0.00338,"85":0.00675,"86":0.00338,"87":0.00338,"88":0.00338,"89":0.00338,"90":0.00338,"91":0.01013,"92":0.00338,"93":0.00338,"94":0.0135,"95":0.00675,"96":0.01688,"97":0.01013,"98":0.01013,"99":0.01688,"100":0.01013,"101":0.0135,"102":0.0135,"103":0.0405,"104":0.02363,"105":0.03375,"106":0.027,"107":0.04388,"108":0.16875,"109":5.184,"110":2.84513,"111":0,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00338,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0.00338,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.00675,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.00338,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.06075,"94":0.46913,"95":0.14513,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0.00338,"16":0,"17":0.00338,"18":0.00338,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00338,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.00675,"108":0.0135,"109":0.28013,"110":0.34763},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00675,"15":0.00338,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.00338,"12.1":0,"13.1":0.01013,"14.1":0.01688,"15.1":0.00338,"15.2-15.3":0.00338,"15.4":0.00338,"15.5":0.00675,"15.6":0.04725,"16.0":0.00675,"16.1":0.02025,"16.2":0.03713,"16.3":0.03375,"16.4":0},G:{"8":0,"3.2":0.00144,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.01442,"6.0-6.1":0.00072,"7.0-7.1":0.00144,"8.1-8.4":0.00144,"9.0-9.2":0,"9.3":0.02308,"10.0-10.2":0.00072,"10.3":0.01731,"11.0-11.2":0.00216,"11.3-11.4":0.06779,"12.0-12.1":0.00288,"12.2-12.5":0.16226,"13.0-13.1":0.00649,"13.2":0.00216,"13.3":0.00793,"13.4-13.7":0.02668,"14.0-14.4":0.0613,"14.5-14.8":0.17596,"15.0-15.1":0.03317,"15.2-15.3":0.04687,"15.4":0.075,"15.5":0.13413,"15.6":0.54302,"16.0":0.53581,"16.1":1.84614,"16.2":1.68316,"16.3":0.92451,"16.4":0.00361},P:{"4":0.11154,"20":0.69965,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.22308,"8.2":0,"9.2":0.01014,"10.1":0,"11.1-11.2":0.03042,"12.0":0.01014,"13.0":0.04056,"14.0":0.03042,"15.0":0.02028,"16.0":0.06084,"17.0":0.16224,"18.0":0.08112,"19.0":1.17622},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00277,"4.2-4.3":0.01386,"4.4":0,"4.4.3-4.4.4":0.06375},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.03375,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.01988},H:{"0":0.14426},L:{"0":78.51113},R:{_:"0"},M:{"0":0.11263},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,323 @@
|
||||
import csv from "../src";
|
||||
import assert from "assert";
|
||||
var fs = require("fs");
|
||||
import { sandbox } from "sinon";
|
||||
import CSVError from "../src/CSVError";
|
||||
const sb = sandbox.create();
|
||||
describe("testCSVConverter3", function () {
|
||||
afterEach(function () {
|
||||
sb.restore();
|
||||
});
|
||||
it("should parse large csv file with UTF-8 without spliting characters", function (done) {
|
||||
var testData = __dirname + "/data/large-utf8.csv";
|
||||
var rs = fs.createReadStream(testData);
|
||||
var csvConverter = csv({
|
||||
});
|
||||
var count = 0;
|
||||
csvConverter.preRawData(function (csvRawData) {
|
||||
assert(csvRawData.charCodeAt(0) < 2000);
|
||||
return csvRawData;
|
||||
})
|
||||
csvConverter.on("data", function () {
|
||||
count++;
|
||||
});
|
||||
csvConverter.then(function () {
|
||||
assert(count === 5290);
|
||||
done();
|
||||
});
|
||||
rs.pipe(csvConverter);
|
||||
});
|
||||
it("should setup customise type convert function", function (done) {
|
||||
csv({
|
||||
checkType: true,
|
||||
colParser: {
|
||||
"column1": "string",
|
||||
"column5": function (item, head, resultRow, row, i) {
|
||||
assert.equal(item, '{"hello":"world"}');
|
||||
assert.equal(head, "column5"),
|
||||
assert(resultRow);
|
||||
assert(row);
|
||||
assert.equal(i, 5);
|
||||
return "hello world";
|
||||
}
|
||||
}
|
||||
})
|
||||
.fromFile(__dirname + "/data/dataWithType")
|
||||
.subscribe(function (json) {
|
||||
assert.equal(typeof json.column1, "string");
|
||||
assert.equal(json.column5, "hello world");
|
||||
assert.strictEqual(json["name#!"], false);
|
||||
assert.strictEqual(json["column9"], true);
|
||||
})
|
||||
.on('done', function () {
|
||||
done()
|
||||
});
|
||||
})
|
||||
it("should accept pipe as quote", function (done) {
|
||||
csv({
|
||||
quote: "|",
|
||||
output: "csv"
|
||||
})
|
||||
.fromFile(__dirname + "/data/pipeAsQuote")
|
||||
.subscribe(function (csv) {
|
||||
assert.equal(csv[2], "blahhh, blah");
|
||||
})
|
||||
.on('done', function () {
|
||||
done()
|
||||
});
|
||||
})
|
||||
it("emit file not exists error when try to open a non-exists file", function () {
|
||||
let called = false;
|
||||
const cb = sb.spy((err) => {
|
||||
assert(err.toString().indexOf("File does not exist") > -1);
|
||||
});
|
||||
return csv()
|
||||
.fromFile("somefile")
|
||||
.subscribe(function (csv) {
|
||||
|
||||
})
|
||||
.on("error", cb)
|
||||
.then(() => {
|
||||
assert(false);
|
||||
}, (err) => {
|
||||
assert.equal(cb.callCount, 1);
|
||||
})
|
||||
|
||||
})
|
||||
it("should include column that is both included and excluded", () => {
|
||||
return csv({
|
||||
includeColumns: /b/,
|
||||
ignoreColumns: /a|b/
|
||||
})
|
||||
.fromString(`a,b,c
|
||||
1,2,3
|
||||
4,5,6`)
|
||||
.subscribe((d) => {
|
||||
assert(d.b);
|
||||
assert(!d.a);
|
||||
})
|
||||
})
|
||||
it("should allow async preLine hook", () => {
|
||||
return csv()
|
||||
.preFileLine((line) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve(line + "changed")
|
||||
}, 20);
|
||||
|
||||
})
|
||||
})
|
||||
.fromString(`a,b
|
||||
1,2`)
|
||||
.subscribe((d) => {
|
||||
assert(d.bchanged);
|
||||
assert.equal(d.bchanged, "2changed");
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
it("should allow async subscribe function", () => {
|
||||
return csv({ trim: true })
|
||||
.fromString(`a,b,c
|
||||
1,2,3
|
||||
4,5,6`)
|
||||
.subscribe((d) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
d.a = 10;
|
||||
resolve();
|
||||
}, 20);
|
||||
})
|
||||
})
|
||||
.then((d) => {
|
||||
assert.equal(d[0].a, 10);
|
||||
assert.equal(d[1].a, 10);
|
||||
})
|
||||
})
|
||||
it("should propagate value to next then", () => {
|
||||
return csv({ trim: true })
|
||||
.fromString(`a,b,c
|
||||
1,2,3
|
||||
4,5,6`)
|
||||
.then(undefined, undefined)
|
||||
.then((d) => {
|
||||
assert.equal(d.length, 2);
|
||||
assert.equal(d[0].a, "1");
|
||||
})
|
||||
|
||||
})
|
||||
it("should propagate error to next then", () => {
|
||||
return csv({ trim: true })
|
||||
.fromFile(__dirname + "/data/dataWithUnclosedQuotes")
|
||||
.then(undefined, undefined)
|
||||
.then(() => {
|
||||
assert(false)
|
||||
}, (err: CSVError) => {
|
||||
assert(err);
|
||||
assert.equal(err.err, "unclosed_quote");
|
||||
})
|
||||
})
|
||||
it("should fallback to text is number can not be parsed", () => {
|
||||
return csv({
|
||||
colParser: {
|
||||
"a": "number"
|
||||
}
|
||||
})
|
||||
.fromString(`a,b,c
|
||||
1,2,3
|
||||
fefe,5,6`)
|
||||
.then((d) => {
|
||||
assert.strictEqual(d[0].a, 1);
|
||||
assert.equal(d[1].a, "fefe");
|
||||
})
|
||||
})
|
||||
it("should omit a column", () => {
|
||||
return csv({
|
||||
colParser: {
|
||||
"a": "omit"
|
||||
}
|
||||
})
|
||||
.fromString(`a,b,c
|
||||
1,2,3
|
||||
fefe,5,6`)
|
||||
.then((d) => {
|
||||
assert.strictEqual(d[0].a, undefined);
|
||||
assert.equal(d[1].a, undefined);
|
||||
})
|
||||
})
|
||||
it("could turn off quote and should trim even quote is turned off", () => {
|
||||
return csv({
|
||||
quote: "off",
|
||||
trim: true
|
||||
})
|
||||
.fromString(`a,b,c
|
||||
"1","2","3"
|
||||
"fefe,5",6`)
|
||||
.then((d) => {
|
||||
assert.equal(d[0].a, '"1"');
|
||||
assert.equal(d[0].b, '"2"');
|
||||
assert.equal(d[1].a, '"fefe');
|
||||
assert.equal(d[1].b, '5"');
|
||||
})
|
||||
})
|
||||
it("should allow ignoreEmpty with checkColumn", () => {
|
||||
return csv({
|
||||
checkColumn: true,
|
||||
ignoreEmpty: true
|
||||
})
|
||||
.fromString(`date,altitude,airtime
|
||||
2016-07-08,2000,23
|
||||
|
||||
2016-07-09,3000,43`)
|
||||
.then((data) => {
|
||||
|
||||
}, (err) => {
|
||||
console.log(err);
|
||||
assert(!err);
|
||||
})
|
||||
});
|
||||
it("should allow quotes without content", () => {
|
||||
const data = "a|^^|^b^";
|
||||
return csv({
|
||||
delimiter: '|',
|
||||
quote: '^',
|
||||
noheader: true,
|
||||
})
|
||||
.fromString(data)
|
||||
.then((jsonObj) => {
|
||||
assert.equal(jsonObj[0].field2, "");
|
||||
});
|
||||
})
|
||||
it("should parse header with quotes correctly", function () {
|
||||
var testData = __dirname + "/data/csvWithUnclosedHeader";
|
||||
return csv({
|
||||
headers: ["exam_date", "sample_no", "status", "sample_type", "patient_id", "last_name", "first_name", "gender_of_patient", "patient_birth_date", "patient_note", "patient_department", "accession_number", "sample_site", "physician", "operator", "department", "note", "test_order_code", "draw_time", "approval_status", "approval_time", "report_layout", "patient_account_number", "none_1", "errors_detected_during_measurement", "age", "error_code_01", "weight", "error_code_02", "height", "error_code_03", "hcg_beta_p", "error_code_04", "troponin_i_p", "error_code_05", "ck_mb_p", "error_code_06", "d_dimer_p", "error_code_07", "hscrp_p", "error_code_08", "myoglobin_p", "error_code_09", "nt_probnp", "error_code_10", "crp", "error_code_11", "bnp", "error_code_12", "tnt", "error_code_13", "demo_p", "error_code_14", "pct", "error_code_15"]
|
||||
})
|
||||
.fromFile(testData)
|
||||
.then((d) => {
|
||||
assert.equal(d.length, 2);
|
||||
assert.equal(d[0].sample_no, "12669");
|
||||
})
|
||||
|
||||
});
|
||||
it ("should stream json string correctly",function(done){
|
||||
const data=`a,b,c
|
||||
1,2,3
|
||||
4,5,6`
|
||||
let hasLeftBracket=false;
|
||||
let hasRightBracket=false;
|
||||
csv({
|
||||
downstreamFormat:"array"
|
||||
})
|
||||
.fromString(data)
|
||||
.on("data",(d)=>{
|
||||
const str=d.toString();
|
||||
if (str[0]==="[" && str.length ===2){
|
||||
hasLeftBracket=true;
|
||||
}else if (str[0]==="]" && str.length===2){
|
||||
hasRightBracket=true;
|
||||
}else{
|
||||
assert.equal(str[str.length-2],",");
|
||||
}
|
||||
|
||||
})
|
||||
.on("end",()=>{
|
||||
assert.equal(hasLeftBracket,true);
|
||||
assert.equal(hasRightBracket,true);
|
||||
done();
|
||||
})
|
||||
})
|
||||
it ("should stream json line correctly",function(done){
|
||||
const data=`a,b,c
|
||||
1,2,3
|
||||
4,5,6`
|
||||
csv({
|
||||
downstreamFormat:"line"
|
||||
})
|
||||
.fromString(data)
|
||||
.on("data",(d)=>{
|
||||
const str=d.toString();
|
||||
|
||||
assert.notEqual(str[str.length-2],",");
|
||||
})
|
||||
.on("end",()=>{
|
||||
done();
|
||||
})
|
||||
})
|
||||
it ("should not send json if needEmitAll is false",async function(){
|
||||
const data=`a,b,c
|
||||
1,2,3
|
||||
4,5,6`
|
||||
return csv({
|
||||
needEmitAll:false
|
||||
})
|
||||
.fromString(data)
|
||||
.then((d)=>{
|
||||
assert(d.length===0);
|
||||
})
|
||||
})
|
||||
it ("should convert null to null object",async function(){
|
||||
const data=`a,b,c
|
||||
null,2,3
|
||||
4,5,6`
|
||||
return csv({
|
||||
nullObject:true
|
||||
})
|
||||
.fromString(data)
|
||||
.then((d)=>{
|
||||
assert.equal(d[0].a,null)
|
||||
})
|
||||
})
|
||||
it ("should process period properly",async function(){
|
||||
const data=`a..,b,c
|
||||
1,2,3
|
||||
4,5,6`
|
||||
return csv({
|
||||
})
|
||||
.fromString(data)
|
||||
.then((d)=>{
|
||||
assert.equal(d[0]["a.."],1);
|
||||
assert.equal(d[1]["a.."],4);
|
||||
})
|
||||
})
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,109 @@
|
||||
export default class Rows {
|
||||
rawRows;
|
||||
triggerChange;
|
||||
sorted;
|
||||
constructor(context) {
|
||||
this.rawRows = context.rawRows;
|
||||
this.triggerChange = context.triggerChange;
|
||||
this.sorted = context.sorted;
|
||||
}
|
||||
sort(orderBy) {
|
||||
if (!orderBy)
|
||||
return;
|
||||
const sorted = this.getSorted();
|
||||
const parsed = this.parse(orderBy);
|
||||
if (sorted.identifier !== parsed.identifier) {
|
||||
this.sorted.update(store => store.direction = null);
|
||||
}
|
||||
if (sorted.direction === null || sorted.direction === 'desc') {
|
||||
this.sortAsc(orderBy);
|
||||
}
|
||||
else if (sorted.direction === 'asc') {
|
||||
this.sortDesc(orderBy);
|
||||
}
|
||||
}
|
||||
sortAsc(orderBy) {
|
||||
const parsed = this.parse(orderBy);
|
||||
this.sorted.set({ identifier: parsed.identifier, direction: 'asc', fn: parsed.fn });
|
||||
this.rawRows.update(store => {
|
||||
try {
|
||||
store.sort((a, b) => {
|
||||
if (typeof (parsed.fn(b)) === "boolean") {
|
||||
return parsed.fn(a) ? -1 : 1;
|
||||
}
|
||||
else if (!parsed.fn(b))
|
||||
return 1;
|
||||
else if (!parsed.fn(a))
|
||||
return -1;
|
||||
else {
|
||||
return parsed.fn(a).localeCompare(parsed.fn(b));
|
||||
}
|
||||
});
|
||||
return store;
|
||||
}
|
||||
catch (e) {
|
||||
return store.sort((a, b) => parseFloat(parsed.fn(a)) - parseFloat(parsed.fn(b)));
|
||||
}
|
||||
});
|
||||
this.triggerChange.update(store => { return store + 1; });
|
||||
}
|
||||
sortDesc(orderBy) {
|
||||
const parsed = this.parse(orderBy);
|
||||
this.sorted.set({ identifier: parsed.identifier, direction: 'desc', fn: parsed.fn });
|
||||
this.rawRows.update(store => {
|
||||
try {
|
||||
store.sort((a, b) => {
|
||||
if (typeof (parsed.fn(b)) === "boolean") {
|
||||
return parsed.fn(a) ? 1 : -1;
|
||||
}
|
||||
else if (!parsed.fn(a))
|
||||
return 1;
|
||||
else if (!parsed.fn(b))
|
||||
return -1;
|
||||
else {
|
||||
return parsed.fn(b).localeCompare(parsed.fn(a));
|
||||
}
|
||||
});
|
||||
return store;
|
||||
}
|
||||
catch (e) {
|
||||
return store.sort((a, b) => parseFloat(parsed.fn(b)) - parseFloat(parsed.fn(a)));
|
||||
}
|
||||
});
|
||||
this.triggerChange.update(store => { return store + 1; });
|
||||
}
|
||||
applySorting(params = null) {
|
||||
if (params) {
|
||||
switch (params.direction) {
|
||||
case 'asc': return this.sortAsc(params.orderBy);
|
||||
case 'desc': return this.sortDesc(params.orderBy);
|
||||
default: return this.sort(params.orderBy);
|
||||
}
|
||||
}
|
||||
const sorted = this.getSorted();
|
||||
if (sorted.identifier) {
|
||||
return this.applySorting({
|
||||
orderBy: sorted.fn,
|
||||
direction: sorted.direction
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
parse(orderBy) {
|
||||
if (typeof (orderBy) === 'string') {
|
||||
return {
|
||||
fn: (row) => row[orderBy],
|
||||
identifier: orderBy.toString()
|
||||
};
|
||||
}
|
||||
return {
|
||||
fn: orderBy,
|
||||
identifier: orderBy.toString()
|
||||
};
|
||||
}
|
||||
getSorted() {
|
||||
let $sorted;
|
||||
this.sorted.subscribe(store => $sorted = store);
|
||||
return $sorted;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,82 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { ObservableInput } from '../types';
|
||||
/**
|
||||
* Checks a boolean at subscription time, and chooses between one of two observable sources
|
||||
*
|
||||
* `iif` expects a function that returns a boolean (the `condition` function), and two sources,
|
||||
* the `trueResult` and the `falseResult`, and returns an Observable.
|
||||
*
|
||||
* At the moment of subscription, the `condition` function is called. If the result is `true`, the
|
||||
* subscription will be to the source passed as the `trueResult`, otherwise, the subscription will be
|
||||
* to the source passed as the `falseResult`.
|
||||
*
|
||||
* If you need to check more than two options to choose between more than one observable, have a look at the {@link defer} creation method.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Change at runtime which Observable will be subscribed
|
||||
*
|
||||
* ```ts
|
||||
* import { iif, of } from 'rxjs';
|
||||
*
|
||||
* let subscribeToFirst;
|
||||
* const firstOrSecond = iif(
|
||||
* () => subscribeToFirst,
|
||||
* of('first'),
|
||||
* of('second')
|
||||
* );
|
||||
*
|
||||
* subscribeToFirst = true;
|
||||
* firstOrSecond.subscribe(value => console.log(value));
|
||||
*
|
||||
* // Logs:
|
||||
* // 'first'
|
||||
*
|
||||
* subscribeToFirst = false;
|
||||
* firstOrSecond.subscribe(value => console.log(value));
|
||||
*
|
||||
* // Logs:
|
||||
* // 'second'
|
||||
* ```
|
||||
*
|
||||
* Control access to an Observable
|
||||
*
|
||||
* ```ts
|
||||
* import { iif, of, EMPTY } from 'rxjs';
|
||||
*
|
||||
* let accessGranted;
|
||||
* const observableIfYouHaveAccess = iif(
|
||||
* () => accessGranted,
|
||||
* of('It seems you have an access...'),
|
||||
* EMPTY
|
||||
* );
|
||||
*
|
||||
* accessGranted = true;
|
||||
* observableIfYouHaveAccess.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('The end')
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 'It seems you have an access...'
|
||||
* // 'The end'
|
||||
*
|
||||
* accessGranted = false;
|
||||
* observableIfYouHaveAccess.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('The end')
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 'The end'
|
||||
* ```
|
||||
*
|
||||
* @see {@link defer}
|
||||
*
|
||||
* @param condition Condition which Observable should be chosen.
|
||||
* @param trueResult An Observable that will be subscribed if condition is true.
|
||||
* @param falseResult An Observable that will be subscribed if condition is false.
|
||||
* @return An observable that proxies to `trueResult` or `falseResult`, depending on the result of the `condition` function.
|
||||
*/
|
||||
export declare function iif<T, F>(condition: () => boolean, trueResult: ObservableInput<T>, falseResult: ObservableInput<F>): Observable<T | F>;
|
||||
//# sourceMappingURL=iif.d.ts.map
|
||||
@@ -0,0 +1,39 @@
|
||||
var castPath = require('./_castPath'),
|
||||
isArguments = require('./isArguments'),
|
||||
isArray = require('./isArray'),
|
||||
isIndex = require('./_isIndex'),
|
||||
isLength = require('./isLength'),
|
||||
toKey = require('./_toKey');
|
||||
|
||||
/**
|
||||
* Checks if `path` exists on `object`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array|string} path The path to check.
|
||||
* @param {Function} hasFunc The function to check properties.
|
||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||
*/
|
||||
function hasPath(object, path, hasFunc) {
|
||||
path = castPath(path, object);
|
||||
|
||||
var index = -1,
|
||||
length = path.length,
|
||||
result = false;
|
||||
|
||||
while (++index < length) {
|
||||
var key = toKey(path[index]);
|
||||
if (!(result = object != null && hasFunc(object, key))) {
|
||||
break;
|
||||
}
|
||||
object = object[key];
|
||||
}
|
||||
if (result || ++index != length) {
|
||||
return result;
|
||||
}
|
||||
length = object == null ? 0 : object.length;
|
||||
return !!length && isLength(length) && isIndex(key, length) &&
|
||||
(isArray(object) || isArguments(object));
|
||||
}
|
||||
|
||||
module.exports = hasPath;
|
||||
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.18.5",
|
||||
"author": "sheetjs",
|
||||
"description": "SheetJS Spreadsheet data parser and writer",
|
||||
"keywords": [
|
||||
"excel",
|
||||
"xls",
|
||||
"xlsx",
|
||||
"xlsb",
|
||||
"xlsm",
|
||||
"ods",
|
||||
"csv",
|
||||
"dbf",
|
||||
"dif",
|
||||
"sylk",
|
||||
"office",
|
||||
"spreadsheet"
|
||||
],
|
||||
"bin": {
|
||||
"xlsx": "./bin/xlsx.njs"
|
||||
},
|
||||
"main": "xlsx.js",
|
||||
"module": "xlsx.mjs",
|
||||
"unpkg": "dist/xlsx.full.min.js",
|
||||
"jsdelivr": "dist/xlsx.full.min.js",
|
||||
"types": "types/index.d.ts",
|
||||
"browser": {
|
||||
"buffer": false,
|
||||
"crypto": false,
|
||||
"stream": false,
|
||||
"process": false,
|
||||
"fs": false
|
||||
},
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"cfb": "~1.2.1",
|
||||
"codepage": "~1.15.0",
|
||||
"crc-32": "~1.2.1",
|
||||
"ssf": "~0.11.2",
|
||||
"wmf": "~1.0.1",
|
||||
"word": "~0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sheetjs/uglify-js": "~2.7.3",
|
||||
"@types/node": "^8.5.9",
|
||||
"acorn": "7.4.1",
|
||||
"alex": "8.1.1",
|
||||
"blanket": "~1.2.3",
|
||||
"commander": "~2.17.1",
|
||||
"dtslint": "^0.1.2",
|
||||
"eslint": "7.23.0",
|
||||
"eslint-plugin-html": "^6.1.2",
|
||||
"eslint-plugin-json": "^2.1.2",
|
||||
"exit-on-epipe": "~1.0.1",
|
||||
"fflate": "^0.7.1",
|
||||
"jsdom": "~11.1.0",
|
||||
"markdown-spellcheck": "^1.3.1",
|
||||
"mocha": "~2.5.3",
|
||||
"sinon": "^1.17.7",
|
||||
"typescript": "2.2.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/SheetJS/sheetjs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"pretest-only": "git submodule init && git submodule update",
|
||||
"tests-only": "make travis",
|
||||
"build": "make",
|
||||
"lint": "make fullint",
|
||||
"dtslint": "dtslint types"
|
||||
},
|
||||
"config": {
|
||||
"blanket": {
|
||||
"pattern": "xlsx.js"
|
||||
}
|
||||
},
|
||||
"alex": {
|
||||
"allow": [
|
||||
"chinese",
|
||||
"special",
|
||||
"simple",
|
||||
"just",
|
||||
"crash",
|
||||
"wtf",
|
||||
"holes"
|
||||
]
|
||||
},
|
||||
"homepage": "https://sheetjs.com/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/SheetJS/sheetjs/issues"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class AlignContent extends Declaration {
|
||||
/**
|
||||
* Change property name for 2012 spec
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-line-pack'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-content'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2012 spec and ignore prefix for 2009
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec === 2012) {
|
||||
decl.value = AlignContent.oldValues[decl.value] || decl.value
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
if (spec === 'final') {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
AlignContent.names = ['align-content', 'flex-line-pack']
|
||||
|
||||
AlignContent.oldValues = {
|
||||
'flex-end': 'end',
|
||||
'flex-start': 'start',
|
||||
'space-between': 'justify',
|
||||
'space-around': 'distribute'
|
||||
}
|
||||
|
||||
module.exports = AlignContent
|
||||
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isSemVer;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
var _multilineRegex = _interopRequireDefault(require("./util/multilineRegex"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Regular Expression to match
|
||||
* semantic versioning (SemVer)
|
||||
* built from multi-line, multi-parts regexp
|
||||
* Reference: https://semver.org/
|
||||
*/
|
||||
var semanticVersioningRegex = (0, _multilineRegex.default)(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$'], 'i');
|
||||
|
||||
function isSemVer(str) {
|
||||
(0, _assertString.default)(str);
|
||||
return semanticVersioningRegex.test(str);
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromEventPattern = void 0;
|
||||
var Observable_1 = require("../Observable");
|
||||
var isFunction_1 = require("../util/isFunction");
|
||||
var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
|
||||
function fromEventPattern(addHandler, removeHandler, resultSelector) {
|
||||
if (resultSelector) {
|
||||
return fromEventPattern(addHandler, removeHandler).pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector));
|
||||
}
|
||||
return new Observable_1.Observable(function (subscriber) {
|
||||
var handler = function () {
|
||||
var e = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
e[_i] = arguments[_i];
|
||||
}
|
||||
return subscriber.next(e.length === 1 ? e[0] : e);
|
||||
};
|
||||
var retValue = addHandler(handler);
|
||||
return isFunction_1.isFunction(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
|
||||
});
|
||||
}
|
||||
exports.fromEventPattern = fromEventPattern;
|
||||
//# sourceMappingURL=fromEventPattern.js.map
|
||||
@@ -0,0 +1,239 @@
|
||||
import { __assign } from "tslib";
|
||||
import { map } from '../operators/map';
|
||||
import { Observable } from '../Observable';
|
||||
import { AjaxResponse } from './AjaxResponse';
|
||||
import { AjaxTimeoutError, AjaxError } from './errors';
|
||||
function ajaxGet(url, headers) {
|
||||
return ajax({ method: 'GET', url: url, headers: headers });
|
||||
}
|
||||
function ajaxPost(url, body, headers) {
|
||||
return ajax({ method: 'POST', url: url, body: body, headers: headers });
|
||||
}
|
||||
function ajaxDelete(url, headers) {
|
||||
return ajax({ method: 'DELETE', url: url, headers: headers });
|
||||
}
|
||||
function ajaxPut(url, body, headers) {
|
||||
return ajax({ method: 'PUT', url: url, body: body, headers: headers });
|
||||
}
|
||||
function ajaxPatch(url, body, headers) {
|
||||
return ajax({ method: 'PATCH', url: url, body: body, headers: headers });
|
||||
}
|
||||
var mapResponse = map(function (x) { return x.response; });
|
||||
function ajaxGetJSON(url, headers) {
|
||||
return mapResponse(ajax({
|
||||
method: 'GET',
|
||||
url: url,
|
||||
headers: headers,
|
||||
}));
|
||||
}
|
||||
export var ajax = (function () {
|
||||
var create = function (urlOrConfig) {
|
||||
var config = typeof urlOrConfig === 'string'
|
||||
? {
|
||||
url: urlOrConfig,
|
||||
}
|
||||
: urlOrConfig;
|
||||
return fromAjax(config);
|
||||
};
|
||||
create.get = ajaxGet;
|
||||
create.post = ajaxPost;
|
||||
create.delete = ajaxDelete;
|
||||
create.put = ajaxPut;
|
||||
create.patch = ajaxPatch;
|
||||
create.getJSON = ajaxGetJSON;
|
||||
return create;
|
||||
})();
|
||||
var UPLOAD = 'upload';
|
||||
var DOWNLOAD = 'download';
|
||||
var LOADSTART = 'loadstart';
|
||||
var PROGRESS = 'progress';
|
||||
var LOAD = 'load';
|
||||
export function fromAjax(init) {
|
||||
return new Observable(function (destination) {
|
||||
var _a, _b;
|
||||
var config = __assign({ async: true, crossDomain: false, withCredentials: false, method: 'GET', timeout: 0, responseType: 'json' }, init);
|
||||
var queryParams = config.queryParams, configuredBody = config.body, configuredHeaders = config.headers;
|
||||
var url = config.url;
|
||||
if (!url) {
|
||||
throw new TypeError('url is required');
|
||||
}
|
||||
if (queryParams) {
|
||||
var searchParams_1;
|
||||
if (url.includes('?')) {
|
||||
var parts = url.split('?');
|
||||
if (2 < parts.length) {
|
||||
throw new TypeError('invalid url');
|
||||
}
|
||||
searchParams_1 = new URLSearchParams(parts[1]);
|
||||
new URLSearchParams(queryParams).forEach(function (value, key) { return searchParams_1.set(key, value); });
|
||||
url = parts[0] + '?' + searchParams_1;
|
||||
}
|
||||
else {
|
||||
searchParams_1 = new URLSearchParams(queryParams);
|
||||
url = url + '?' + searchParams_1;
|
||||
}
|
||||
}
|
||||
var headers = {};
|
||||
if (configuredHeaders) {
|
||||
for (var key in configuredHeaders) {
|
||||
if (configuredHeaders.hasOwnProperty(key)) {
|
||||
headers[key.toLowerCase()] = configuredHeaders[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
var crossDomain = config.crossDomain;
|
||||
if (!crossDomain && !('x-requested-with' in headers)) {
|
||||
headers['x-requested-with'] = 'XMLHttpRequest';
|
||||
}
|
||||
var withCredentials = config.withCredentials, xsrfCookieName = config.xsrfCookieName, xsrfHeaderName = config.xsrfHeaderName;
|
||||
if ((withCredentials || !crossDomain) && xsrfCookieName && xsrfHeaderName) {
|
||||
var xsrfCookie = (_b = (_a = document === null || document === void 0 ? void 0 : document.cookie.match(new RegExp("(^|;\\s*)(" + xsrfCookieName + ")=([^;]*)"))) === null || _a === void 0 ? void 0 : _a.pop()) !== null && _b !== void 0 ? _b : '';
|
||||
if (xsrfCookie) {
|
||||
headers[xsrfHeaderName] = xsrfCookie;
|
||||
}
|
||||
}
|
||||
var body = extractContentTypeAndMaybeSerializeBody(configuredBody, headers);
|
||||
var _request = __assign(__assign({}, config), { url: url,
|
||||
headers: headers,
|
||||
body: body });
|
||||
var xhr;
|
||||
xhr = init.createXHR ? init.createXHR() : new XMLHttpRequest();
|
||||
{
|
||||
var progressSubscriber_1 = init.progressSubscriber, _c = init.includeDownloadProgress, includeDownloadProgress = _c === void 0 ? false : _c, _d = init.includeUploadProgress, includeUploadProgress = _d === void 0 ? false : _d;
|
||||
var addErrorEvent = function (type, errorFactory) {
|
||||
xhr.addEventListener(type, function () {
|
||||
var _a;
|
||||
var error = errorFactory();
|
||||
(_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.error) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1, error);
|
||||
destination.error(error);
|
||||
});
|
||||
};
|
||||
addErrorEvent('timeout', function () { return new AjaxTimeoutError(xhr, _request); });
|
||||
addErrorEvent('abort', function () { return new AjaxError('aborted', xhr, _request); });
|
||||
var createResponse_1 = function (direction, event) {
|
||||
return new AjaxResponse(event, xhr, _request, direction + "_" + event.type);
|
||||
};
|
||||
var addProgressEvent_1 = function (target, type, direction) {
|
||||
target.addEventListener(type, function (event) {
|
||||
destination.next(createResponse_1(direction, event));
|
||||
});
|
||||
};
|
||||
if (includeUploadProgress) {
|
||||
[LOADSTART, PROGRESS, LOAD].forEach(function (type) { return addProgressEvent_1(xhr.upload, type, UPLOAD); });
|
||||
}
|
||||
if (progressSubscriber_1) {
|
||||
[LOADSTART, PROGRESS].forEach(function (type) { return xhr.upload.addEventListener(type, function (e) { var _a; return (_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.next) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1, e); }); });
|
||||
}
|
||||
if (includeDownloadProgress) {
|
||||
[LOADSTART, PROGRESS].forEach(function (type) { return addProgressEvent_1(xhr, type, DOWNLOAD); });
|
||||
}
|
||||
var emitError_1 = function (status) {
|
||||
var msg = 'ajax error' + (status ? ' ' + status : '');
|
||||
destination.error(new AjaxError(msg, xhr, _request));
|
||||
};
|
||||
xhr.addEventListener('error', function (e) {
|
||||
var _a;
|
||||
(_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.error) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1, e);
|
||||
emitError_1();
|
||||
});
|
||||
xhr.addEventListener(LOAD, function (event) {
|
||||
var _a, _b;
|
||||
var status = xhr.status;
|
||||
if (status < 400) {
|
||||
(_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.complete) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1);
|
||||
var response = void 0;
|
||||
try {
|
||||
response = createResponse_1(DOWNLOAD, event);
|
||||
}
|
||||
catch (err) {
|
||||
destination.error(err);
|
||||
return;
|
||||
}
|
||||
destination.next(response);
|
||||
destination.complete();
|
||||
}
|
||||
else {
|
||||
(_b = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.error) === null || _b === void 0 ? void 0 : _b.call(progressSubscriber_1, event);
|
||||
emitError_1(status);
|
||||
}
|
||||
});
|
||||
}
|
||||
var user = _request.user, method = _request.method, async = _request.async;
|
||||
if (user) {
|
||||
xhr.open(method, url, async, user, _request.password);
|
||||
}
|
||||
else {
|
||||
xhr.open(method, url, async);
|
||||
}
|
||||
if (async) {
|
||||
xhr.timeout = _request.timeout;
|
||||
xhr.responseType = _request.responseType;
|
||||
}
|
||||
if ('withCredentials' in xhr) {
|
||||
xhr.withCredentials = _request.withCredentials;
|
||||
}
|
||||
for (var key in headers) {
|
||||
if (headers.hasOwnProperty(key)) {
|
||||
xhr.setRequestHeader(key, headers[key]);
|
||||
}
|
||||
}
|
||||
if (body) {
|
||||
xhr.send(body);
|
||||
}
|
||||
else {
|
||||
xhr.send();
|
||||
}
|
||||
return function () {
|
||||
if (xhr && xhr.readyState !== 4) {
|
||||
xhr.abort();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
function extractContentTypeAndMaybeSerializeBody(body, headers) {
|
||||
var _a;
|
||||
if (!body ||
|
||||
typeof body === 'string' ||
|
||||
isFormData(body) ||
|
||||
isURLSearchParams(body) ||
|
||||
isArrayBuffer(body) ||
|
||||
isFile(body) ||
|
||||
isBlob(body) ||
|
||||
isReadableStream(body)) {
|
||||
return body;
|
||||
}
|
||||
if (isArrayBufferView(body)) {
|
||||
return body.buffer;
|
||||
}
|
||||
if (typeof body === 'object') {
|
||||
headers['content-type'] = (_a = headers['content-type']) !== null && _a !== void 0 ? _a : 'application/json;charset=utf-8';
|
||||
return JSON.stringify(body);
|
||||
}
|
||||
throw new TypeError('Unknown body type');
|
||||
}
|
||||
var _toString = Object.prototype.toString;
|
||||
function toStringCheck(obj, name) {
|
||||
return _toString.call(obj) === "[object " + name + "]";
|
||||
}
|
||||
function isArrayBuffer(body) {
|
||||
return toStringCheck(body, 'ArrayBuffer');
|
||||
}
|
||||
function isFile(body) {
|
||||
return toStringCheck(body, 'File');
|
||||
}
|
||||
function isBlob(body) {
|
||||
return toStringCheck(body, 'Blob');
|
||||
}
|
||||
function isArrayBufferView(body) {
|
||||
return typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(body);
|
||||
}
|
||||
function isFormData(body) {
|
||||
return typeof FormData !== 'undefined' && body instanceof FormData;
|
||||
}
|
||||
function isURLSearchParams(body) {
|
||||
return typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams;
|
||||
}
|
||||
function isReadableStream(body) {
|
||||
return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream;
|
||||
}
|
||||
//# sourceMappingURL=ajax.js.map
|
||||
@@ -0,0 +1,17 @@
|
||||
export declare const foreign = "https://svelte.dev/docs#template-syntax-svelte-options";
|
||||
export declare const html = "http://www.w3.org/1999/xhtml";
|
||||
export declare const mathml = "http://www.w3.org/1998/Math/MathML";
|
||||
export declare const svg = "http://www.w3.org/2000/svg";
|
||||
export declare const xlink = "http://www.w3.org/1999/xlink";
|
||||
export declare const xml = "http://www.w3.org/XML/1998/namespace";
|
||||
export declare const xmlns = "http://www.w3.org/2000/xmlns";
|
||||
export declare const valid_namespaces: string[];
|
||||
export declare const namespaces: {
|
||||
readonly foreign: "https://svelte.dev/docs#template-syntax-svelte-options";
|
||||
readonly html: "http://www.w3.org/1999/xhtml";
|
||||
readonly mathml: "http://www.w3.org/1998/Math/MathML";
|
||||
readonly svg: "http://www.w3.org/2000/svg";
|
||||
readonly xlink: "http://www.w3.org/1999/xlink";
|
||||
readonly xml: "http://www.w3.org/XML/1998/namespace";
|
||||
readonly xmlns: "http://www.w3.org/2000/xmlns";
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
# next-tick
|
||||
## Environment agnostic nextTick polyfill
|
||||
|
||||
To be used in environment agnostic modules that need nextTick functionality.
|
||||
|
||||
- When run in Node.js `process.nextTick` is used
|
||||
- In modern engines, microtask resolution is guaranteed by `queueMicrotask`
|
||||
- In older browsers, `MutationObserver` is used as a fallback
|
||||
- In other engines `setImmediate` or `setTimeout(fn, 0)` is used as fallback.
|
||||
- If none of the above is supported module resolves to `null`
|
||||
|
||||
## Installation
|
||||
### NPM
|
||||
|
||||
In your project path:
|
||||
|
||||
$ npm install next-tick
|
||||
|
||||
#### Browser
|
||||
|
||||
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
|
||||
|
||||
## Tests [](https://travis-ci.org/medikoo/next-tick)
|
||||
|
||||
$ npm test
|
||||
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-next-tick?utm_source=npm-next-tick&utm_medium=referral&utm_campaign=readme">Get professional support for d with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,4 @@
|
||||
import { LoadersSync } from './types';
|
||||
declare const loaders: LoadersSync;
|
||||
export { loaders };
|
||||
//# sourceMappingURL=loaders.d.ts.map
|
||||
Reference in New Issue
Block a user