├── .gitignore
├── .npmignore
├── .travis.yml
├── LICENSE.txt
├── README.md
├── benchmark.js
├── cjs
└── index.js
├── coverage
├── coverage.json
├── lcov-report
│ ├── base.css
│ ├── index.html
│ ├── majinbuu
│ │ ├── cjs
│ │ │ ├── index.html
│ │ │ └── index.js.html
│ │ ├── index.html
│ │ └── test.js.html
│ ├── prettify.css
│ ├── prettify.js
│ ├── sort-arrow-sprite.png
│ └── sorter.js
└── lcov.info
├── esm
└── index.js
├── index.js
├── levenstein.c
├── min.js
├── package.json
└── test.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | levenstein
4 | package-lock.json
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | coverage/*
2 | node_modules/*
3 | .gitignore
4 | .travis.yml
5 | benchmark.js
6 | levenstein
7 | levenstein.*
8 | test.js
9 | package-lock.json
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 8
4 | git:
5 | depth: 1
6 | branches:
7 | only:
8 | - master
9 | after_success:
10 | - "npm run coveralls"
11 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | ISC License
2 |
3 | Copyright (c) 2017, Andrea Giammarchi, @WebReflection
4 |
5 | Permission to use, copy, modify, and/or distribute this software for any
6 | purpose with or without fee is hereby granted, provided that the above
7 | copyright notice and this permission notice appear in all copies.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 | OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 | PERFORMANCE OF THIS SOFTWARE.
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Majin Buu
2 |
3 | [](https://opensource.org/licenses/ISC) [](https://travis-ci.org/WebReflection/majinbuu) [](https://coveralls.io/github/WebReflection/majinbuu?branch=master) [](https://github.com/WebReflection/donate)
4 |
5 |
6 | Apply the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to transform / morph an Array into another, performing the least amount of needed `.splice(...)` operations.
7 |
8 | ```js
9 | const abra = ['a', 'b', 'r', 'a'];
10 | majinbuu(abra, ['c', 'a', 'd', 'a', 'b', 'r', 'a']);
11 |
12 | abra; // now ['c', 'a', 'd', 'a', 'b', 'r', 'a']
13 | ```
14 |
15 | It is also possible to intercept all splice calls using an `aura`,
16 | which augments the `splice` method of the list,
17 | delegating the interceptor one.
18 | ```js
19 | const abra = ['a', 'b', 'r', 'a'];
20 | const interceptor = {
21 | splice(index, removal, ...items) {
22 | console.log(index, removal, ...items);
23 | abra.splice.apply(abra, arguments);
24 | }
25 | };
26 | const aura = majinbuu.aura(interceptor, abra);
27 |
28 | majinbuu(aura, ['c', 'a', 'd', 'a', 'b', 'r', 'a']);
29 | // 0 0 "c"
30 | // 2 0 "d" "a"
31 | ```
32 |
33 | The optional third argument avoid processing grids that are too big (comparing lists with too many items).
34 | ```js
35 | const noMoreThan1K = 1000;
36 | majinbuu(list1, list2, noMoreThan1K);
37 | ```
38 | If the square of the `list1` and `list2` product is higher than `noMoreThan1K`,
39 | the splice operation will remove all `list1` items and push all `list2`.
40 |
41 | ### Compatibility
42 |
43 | Every. JavaScript. Engine.
44 |
--------------------------------------------------------------------------------
/benchmark.js:
--------------------------------------------------------------------------------
1 | var times = process.argv.length < 3 ? 10 : parseFloat(process.argv[2]);
2 |
3 | var log = require('tressa').log;
4 | var majinbuu = require('./index.js');
5 | var a1 = Array(times + 1).join('.').split('.').map(Math.random);
6 | var a2 = a1.slice();
7 | var b = Array(times + 1).join('.').split('.').map(Math.random);
8 |
9 | log('');
10 | log('# Majin Buu');
11 | log('size: **' + times + '**');
12 | console.time('time');
13 | majinbuu(a1, b);
14 | console.timeEnd('time');
15 | console.assert(a1.join('') === b.join(''));
16 | console.time('aura time');
17 | majinbuu(
18 | majinbuu.aura(
19 | {
20 | splice: function () {
21 | a2.splice.apply(a2, arguments);
22 | }
23 | },
24 | a2
25 | ),
26 | b
27 | );
28 | console.timeEnd('aura time');
29 | console.assert(a2.join('') === b.join(''));
30 |
31 | log('- - -');
32 | var crypto = require("crypto");
33 | var a = crypto.randomBytes(Math.ceil(times / 2)).toString('hex');
34 | var b = crypto.randomBytes(Math.ceil(times / 2)).toString('hex');
35 | console.time('C time');
36 | var ls = require('child_process').spawnSync('./levenstein', [a, b]);
37 | console.timeEnd('C time');
38 | log('C distance: ' + ls.stdout.toString());
39 |
--------------------------------------------------------------------------------
/cjs/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | /*! Copyright (c) 2017, Andrea Giammarchi, @WebReflection */
3 |
4 | // grid operations
5 | const DELETE = 'del';
6 | const INSERT = 'ins';
7 | const SUBSTITUTE = 'sub';
8 |
9 | // typed Array
10 | const TypedArray = typeof Int32Array === 'function' ? Int32Array : Array;
11 |
12 | // shortcuts
13 | const { min, sqrt } = Math;
14 |
15 | const majinbuu = function (
16 | from, to,
17 | fromStart, fromEnd, fromLength,
18 | toStart, toEnd, toLength,
19 | SIZE
20 | ) {
21 |
22 | if(from === to) {
23 | //# same arrays. Do nothing
24 | return;
25 | }
26 |
27 | if (arguments.length < 4) {
28 | SIZE = fromStart || Infinity;
29 | fromLength = from.length;
30 | fromStart = 0;
31 | fromEnd = fromLength;
32 | toLength = to.length;
33 | toStart = 0;
34 | toEnd = toLength;
35 | } else {
36 | SIZE = SIZE || Infinity;
37 | }
38 |
39 | const TOO_MANY = SIZE !== Infinity &&
40 | SIZE < sqrt(
41 | ((fromEnd - fromStart) || 1) *
42 | ((toEnd - toStart) || 1)
43 | );
44 |
45 | if (TOO_MANY || fromLength < 1) {
46 | if (TOO_MANY || toLength) {
47 | from.splice.apply(from, [0, fromLength].concat(to));
48 | }
49 | return;
50 | }
51 | if (toLength < 1) {
52 | from.splice(0);
53 | return;
54 | }
55 | const minLength = min(fromLength, toLength);
56 | let beginIndex = fromStart;
57 | while(beginIndex < minLength && from[beginIndex] === to[beginIndex]) {
58 | beginIndex += 1;
59 | }
60 | if(beginIndex == fromLength && fromLength == toLength) {
61 | // content of { from } and { to } are equal. Do nothing
62 | return;
63 | }
64 | else {
65 | // relative from both ends { from } and { to }. { -1 } is last element,
66 | // { -2 } is { to[to.length - 2] } and { from[fromLength - 2] } etc
67 | let endRelIndex = 0;
68 | const fromLengthMinus1 = fromEnd - 1;
69 | const toLengthMinus1 = toEnd - 1;
70 | while(
71 | beginIndex < (minLength + endRelIndex) &&
72 | from[fromLengthMinus1 + endRelIndex] === to[toLengthMinus1 + endRelIndex]
73 | ) {
74 | endRelIndex--;
75 | }
76 | performOperations(
77 | from,
78 | getOperations(
79 | levenstein(
80 | from, beginIndex, fromLength,
81 | to, endRelIndex, toLength
82 | ),
83 | from, beginIndex, fromLength,
84 | to, endRelIndex, toLength
85 | )
86 | );
87 | }
88 | };
89 |
90 | // given an object that would like to intercept
91 | // all splice operations performed through a list,
92 | // wraps the list.splice method to delegate such object
93 | // and it puts back original splice right before every invocation.
94 | // Note: do not use the same list in two different aura
95 | const aura = (splicer, list) => {
96 | const splice = list.splice;
97 | function $splice() {
98 | list.splice = splice;
99 | const result = splicer.splice.apply(splicer, arguments);
100 | list.splice = $splice;
101 | return result;
102 | }
103 | list.splice = $splice;
104 | return list;
105 | };
106 |
107 | // Helpers - - - - - - - - - - - - - - - - - - - - - -
108 |
109 | // originally readapted from:
110 | // http://webreflection.blogspot.co.uk/2009/02/levenshtein-algorithm-revisited-25.html
111 | // then rewritten in C for Emscripten (see levenstein.c)
112 | // then "screw you ASM" due no much gain but very bloated code
113 | const levenstein = (from, beginIndex, fromLength, to, endRelIndex, toLength) => {
114 | const fLength = fromLength + 1 - beginIndex + endRelIndex;
115 | const tLength = toLength + 1 - beginIndex + endRelIndex;
116 | const size = fLength * tLength;
117 | const grid = new TypedArray(size);
118 | let x = 0;
119 | let y = 0;
120 | let X = 0;
121 | let Y = 0;
122 | let crow = 0;
123 | let prow = 0;
124 | let del, ins, sub;
125 | grid[0] = 0;
126 | while (++x < tLength) grid[x] = x;
127 | while (++y < fLength) {
128 | X = x = 0;
129 | prow = crow;
130 | crow = y * tLength;
131 | grid[crow + x] = y;
132 | while (++x < tLength) {
133 | del = grid[prow + x] + 1;
134 | ins = grid[crow + X] + 1;
135 | sub = grid[prow + X] + (from[Y + beginIndex] == to[X + beginIndex] ? 0 : 1);
136 | grid[crow + x] = del < ins ?
137 | (del < sub ?
138 | del : sub) :
139 | (ins < sub ?
140 | ins : sub);
141 | ++X;
142 | };
143 | Y = y;
144 | }
145 | return grid;
146 | };
147 |
148 | // add operations (in reversed order)
149 | const addOperation = (list, type, x, y, count, items) => {
150 | list.unshift({type, x, y, count, items});
151 | };
152 |
153 | // walk the Levenshtein grid bottom -> up
154 | const getOperations = (grid, Y, beginIndex, YLength, X, endRelIndex, XLength) => {
155 | const list = [];
156 | const YL = YLength + 1 - beginIndex + endRelIndex;
157 | const XL = XLength + 1 - beginIndex + endRelIndex;
158 | let y = YL - 1;
159 | let x = XL - 1;
160 | let cell,
161 | top, left, diagonal,
162 | crow, prow;
163 | while (x && y) {
164 | crow = y * XL + x;
165 | prow = crow - XL;
166 | cell = grid[crow];
167 | top = grid[prow];
168 | left = grid[crow - 1];
169 | diagonal = grid[prow - 1];
170 | if (diagonal <= left && diagonal <= top && diagonal <= cell) {
171 | x--;
172 | y--;
173 | if (diagonal < cell) {
174 | addOperation(list, SUBSTITUTE, x + beginIndex, y + beginIndex, 1, [X[x + beginIndex]]);
175 | }
176 | }
177 | else if (left <= top && left <= cell) {
178 | x--;
179 | addOperation(list, INSERT, x + beginIndex, y + beginIndex, 0, [X[x + beginIndex]]);
180 | }
181 | else {
182 | y--;
183 | addOperation(list, DELETE, x + beginIndex, y + beginIndex, 1, []);
184 | }
185 | }
186 | while (x--) {
187 | addOperation(list, INSERT, x + beginIndex, y + beginIndex, 0, [X[x + beginIndex]]);
188 | }
189 | while (y--) {
190 | addOperation(list, DELETE, x + beginIndex, y + beginIndex, 1, []);
191 | }
192 | return list;
193 | };
194 |
195 | /* grouped operations */
196 | const performOperations = (target, operations) => {
197 | const length = operations.length;
198 | let diff = 0;
199 | let i = 1;
200 | let curr, prev, op;
201 | op = (prev = operations[0]);
202 | while (i < length) {
203 | curr = operations[i++];
204 | if (prev.type === curr.type && (curr.x - prev.x) <= 1 && (curr.y - prev.y) <= 1) {
205 | op.count += curr.count;
206 | op.items = op.items.concat(curr.items);
207 | } else {
208 | target.splice.apply(target, [op.y + diff, op.count].concat(op.items));
209 | diff += op.type === INSERT ?
210 | op.items.length : (op.type === DELETE ?
211 | -op.count : 0);
212 | op = curr;
213 | }
214 | prev = curr;
215 | }
216 | target.splice.apply(target, [op.y + diff, op.count].concat(op.items));
217 | };
218 |
219 | majinbuu.aura = aura;
220 |
221 | Object.defineProperty(exports, '__esModule', {value: true}).default = majinbuu;
222 | exports.aura = aura;
223 | exports.majinbuu = majinbuu;
224 |
--------------------------------------------------------------------------------
/coverage/coverage.json:
--------------------------------------------------------------------------------
1 | {"/home/webreflection/code/majinbuu/test.js":{"path":"/home/webreflection/code/majinbuu/test.js","s":{"1":1,"2":1,"3":1,"4":1,"5":9,"6":1,"7":26,"8":26,"9":9,"10":9,"11":9,"12":9,"13":9,"14":9,"15":9,"16":7,"17":7,"18":7,"19":7,"20":7,"21":7,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1,"28":1,"29":1,"30":1,"31":1,"32":1,"33":1,"34":1,"35":1,"36":1,"37":1,"38":1,"39":3,"40":3,"41":1,"42":1,"43":1,"44":1,"45":1,"46":1,"47":1,"48":1,"49":1,"50":1,"51":1,"52":1,"53":1,"54":1,"55":1,"56":1},"b":{"1":[9,1],"2":[9,2],"3":[7,2],"4":[7,1],"5":[1,1,1]},"f":{"1":9,"2":26,"3":3,"4":1},"fnMap":{"1":{"name":"test","line":6,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":20}}},"2":{"name":"splice","line":8,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":20}}},"3":{"name":"(anonymous_3)","line":48,"loc":{"start":{"line":48,"column":10},"end":{"line":48,"column":22}}},"4":{"name":"(anonymous_4)","line":70,"loc":{"start":{"line":70,"column":12},"end":{"line":70,"column":35}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}},"2":{"start":{"line":2,"column":0},"end":{"line":2,"column":40}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":19}},"4":{"start":{"line":6,"column":0},"end":{"line":26,"column":1}},"5":{"start":{"line":7,"column":2},"end":{"line":7,"column":12}},"6":{"start":{"line":8,"column":2},"end":{"line":11,"column":3}},"7":{"start":{"line":9,"column":4},"end":{"line":9,"column":12}},"8":{"start":{"line":10,"column":4},"end":{"line":10,"column":44}},"9":{"start":{"line":12,"column":2},"end":{"line":12,"column":24}},"10":{"start":{"line":13,"column":2},"end":{"line":13,"column":24}},"11":{"start":{"line":14,"column":2},"end":{"line":14,"column":12}},"12":{"start":{"line":15,"column":2},"end":{"line":15,"column":22}},"13":{"start":{"line":16,"column":2},"end":{"line":16,"column":25}},"14":{"start":{"line":17,"column":2},"end":{"line":17,"column":108}},"15":{"start":{"line":18,"column":2},"end":{"line":25,"column":3}},"16":{"start":{"line":19,"column":4},"end":{"line":19,"column":22}},"17":{"start":{"line":20,"column":4},"end":{"line":20,"column":22}},"18":{"start":{"line":21,"column":4},"end":{"line":21,"column":14}},"19":{"start":{"line":22,"column":4},"end":{"line":22,"column":24}},"20":{"start":{"line":23,"column":4},"end":{"line":23,"column":23}},"21":{"start":{"line":24,"column":4},"end":{"line":24,"column":97}},"22":{"start":{"line":28,"column":0},"end":{"line":28,"column":19}},"23":{"start":{"line":28,"column":20},"end":{"line":28,"column":51}},"24":{"start":{"line":30,"column":0},"end":{"line":30,"column":13}},"25":{"start":{"line":31,"column":0},"end":{"line":31,"column":21}},"26":{"start":{"line":32,"column":0},"end":{"line":32,"column":31}},"27":{"start":{"line":33,"column":0},"end":{"line":33,"column":26}},"28":{"start":{"line":34,"column":0},"end":{"line":34,"column":16}},"29":{"start":{"line":35,"column":0},"end":{"line":35,"column":21}},"30":{"start":{"line":36,"column":0},"end":{"line":36,"column":24}},"31":{"start":{"line":37,"column":0},"end":{"line":37,"column":26}},"32":{"start":{"line":38,"column":0},"end":{"line":38,"column":31}},"33":{"start":{"line":40,"column":0},"end":{"line":40,"column":25}},"34":{"start":{"line":41,"column":0},"end":{"line":41,"column":47}},"35":{"start":{"line":42,"column":0},"end":{"line":42,"column":40}},"36":{"start":{"line":44,"column":0},"end":{"line":44,"column":24}},"37":{"start":{"line":45,"column":0},"end":{"line":45,"column":28}},"38":{"start":{"line":46,"column":0},"end":{"line":52,"column":2}},"39":{"start":{"line":49,"column":4},"end":{"line":49,"column":24}},"40":{"start":{"line":50,"column":4},"end":{"line":50,"column":53}},"41":{"start":{"line":54,"column":0},"end":{"line":54,"column":37}},"42":{"start":{"line":56,"column":0},"end":{"line":56,"column":36}},"43":{"start":{"line":57,"column":0},"end":{"line":57,"column":57}},"44":{"start":{"line":58,"column":0},"end":{"line":58,"column":62}},"45":{"start":{"line":59,"column":0},"end":{"line":59,"column":58}},"46":{"start":{"line":61,"column":0},"end":{"line":61,"column":14}},"47":{"start":{"line":62,"column":0},"end":{"line":62,"column":33}},"48":{"start":{"line":63,"column":0},"end":{"line":63,"column":27}},"49":{"start":{"line":64,"column":0},"end":{"line":64,"column":57}},"50":{"start":{"line":66,"column":0},"end":{"line":66,"column":30}},"51":{"start":{"line":67,"column":0},"end":{"line":67,"column":21}},"52":{"start":{"line":68,"column":0},"end":{"line":81,"column":2}},"53":{"start":{"line":71,"column":6},"end":{"line":76,"column":8}},"54":{"start":{"line":83,"column":0},"end":{"line":83,"column":34}},"55":{"start":{"line":84,"column":0},"end":{"line":90,"column":2}},"56":{"start":{"line":92,"column":0},"end":{"line":92,"column":75}}},"branchMap":{"1":{"line":17,"type":"binary-expr","locations":[{"start":{"line":17,"column":69},"end":{"line":17,"column":70}},{"start":{"line":17,"column":74},"end":{"line":17,"column":83}}]},"2":{"line":17,"type":"binary-expr","locations":[{"start":{"line":17,"column":90},"end":{"line":17,"column":91}},{"start":{"line":17,"column":95},"end":{"line":17,"column":104}}]},"3":{"line":18,"type":"if","locations":[{"start":{"line":18,"column":2},"end":{"line":18,"column":2}},{"start":{"line":18,"column":2},"end":{"line":18,"column":2}}]},"4":{"line":24,"type":"binary-expr","locations":[{"start":{"line":24,"column":71},"end":{"line":24,"column":72}},{"start":{"line":24,"column":76},"end":{"line":24,"column":85}}]},"5":{"line":72,"type":"binary-expr","locations":[{"start":{"line":72,"column":8},"end":{"line":72,"column":19}},{"start":{"line":73,"column":8},"end":{"line":73,"column":28}},{"start":{"line":74,"column":8},"end":{"line":74,"column":55}}]}}},"/home/webreflection/code/majinbuu/cjs/index.js":{"path":"/home/webreflection/code/majinbuu/cjs/index.js","s":{"1":2,"2":2,"3":2,"4":2,"5":2,"6":2,"7":21,"8":1,"9":20,"10":19,"11":19,"12":19,"13":19,"14":19,"15":19,"16":19,"17":1,"18":20,"19":20,"20":3,"21":2,"22":3,"23":17,"24":1,"25":1,"26":16,"27":16,"28":16,"29":16,"30":16,"31":1,"32":15,"33":15,"34":15,"35":15,"36":13,"37":15,"38":2,"39":3,"40":1,"41":4,"42":4,"43":4,"44":4,"45":3,"46":3,"47":2,"48":15,"49":15,"50":15,"51":15,"52":15,"53":15,"54":15,"55":15,"56":15,"57":15,"58":15,"59":15,"60":15,"61":72,"62":15,"63":65,"64":65,"65":65,"66":65,"67":65,"68":380,"69":380,"70":380,"71":380,"72":380,"73":65,"74":15,"75":2,"76":66,"77":2,"78":15,"79":15,"80":15,"81":15,"82":15,"83":15,"84":15,"85":60,"86":60,"87":60,"88":60,"89":60,"90":60,"91":60,"92":48,"93":48,"94":48,"95":25,"96":12,"97":7,"98":7,"99":5,"100":5,"101":15,"102":17,"103":15,"104":12,"105":15,"106":2,"107":15,"108":15,"109":15,"110":15,"111":15,"112":15,"113":51,"114":51,"115":37,"116":37,"117":14,"118":14,"119":14,"120":51,"121":15,"122":2,"123":2,"124":2,"125":2},"b":{"1":[1,1],"2":[1,20],"3":[19,1],"4":[19,9],"5":[1,1],"6":[20,10],"7":[10,1],"8":[10,2],"9":[3,17],"10":[20,19],"11":[2,1],"12":[3,2],"13":[1,16],"14":[32,29],"15":[1,15],"16":[16,2],"17":[28,23],"18":[42,338],"19":[150,230],"20":[47,103],"21":[51,179],"22":[75,66],"23":[48,12],"24":[60,53,48],"25":[25,23],"26":[7,5],"27":[12,7],"28":[37,14],"29":[51,42,37],"30":[4,10],"31":[2,8]},"f":{"1":21,"2":4},"fnMap":{"1":{"name":"(anonymous_1)","line":15,"loc":{"start":{"line":15,"column":17},"end":{"line":20,"column":2}}},"2":{"name":"$splice","line":97,"loc":{"start":{"line":97,"column":2},"end":{"line":97,"column":21}}}},"statementMap":{"1":{"start":{"line":5,"column":0},"end":{"line":5,"column":21}},"2":{"start":{"line":6,"column":0},"end":{"line":6,"column":21}},"3":{"start":{"line":7,"column":0},"end":{"line":7,"column":25}},"4":{"start":{"line":10,"column":0},"end":{"line":10,"column":73}},"5":{"start":{"line":13,"column":0},"end":{"line":13,"column":27}},"6":{"start":{"line":15,"column":0},"end":{"line":88,"column":2}},"7":{"start":{"line":22,"column":2},"end":{"line":25,"column":3}},"8":{"start":{"line":24,"column":4},"end":{"line":24,"column":11}},"9":{"start":{"line":27,"column":2},"end":{"line":37,"column":3}},"10":{"start":{"line":28,"column":4},"end":{"line":28,"column":33}},"11":{"start":{"line":29,"column":4},"end":{"line":29,"column":29}},"12":{"start":{"line":30,"column":4},"end":{"line":30,"column":18}},"13":{"start":{"line":31,"column":4},"end":{"line":31,"column":25}},"14":{"start":{"line":32,"column":4},"end":{"line":32,"column":25}},"15":{"start":{"line":33,"column":4},"end":{"line":33,"column":16}},"16":{"start":{"line":34,"column":4},"end":{"line":34,"column":21}},"17":{"start":{"line":36,"column":4},"end":{"line":36,"column":28}},"18":{"start":{"line":39,"column":2},"end":{"line":43,"column":22}},"19":{"start":{"line":45,"column":2},"end":{"line":50,"column":3}},"20":{"start":{"line":46,"column":4},"end":{"line":48,"column":5}},"21":{"start":{"line":47,"column":6},"end":{"line":47,"column":58}},"22":{"start":{"line":49,"column":4},"end":{"line":49,"column":11}},"23":{"start":{"line":51,"column":2},"end":{"line":54,"column":3}},"24":{"start":{"line":52,"column":4},"end":{"line":52,"column":19}},"25":{"start":{"line":53,"column":4},"end":{"line":53,"column":11}},"26":{"start":{"line":55,"column":2},"end":{"line":55,"column":46}},"27":{"start":{"line":56,"column":2},"end":{"line":56,"column":29}},"28":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"29":{"start":{"line":58,"column":4},"end":{"line":58,"column":20}},"30":{"start":{"line":60,"column":2},"end":{"line":87,"column":3}},"31":{"start":{"line":62,"column":4},"end":{"line":62,"column":11}},"32":{"start":{"line":67,"column":4},"end":{"line":67,"column":24}},"33":{"start":{"line":68,"column":4},"end":{"line":68,"column":41}},"34":{"start":{"line":69,"column":4},"end":{"line":69,"column":37}},"35":{"start":{"line":70,"column":4},"end":{"line":75,"column":5}},"36":{"start":{"line":74,"column":6},"end":{"line":74,"column":20}},"37":{"start":{"line":76,"column":4},"end":{"line":86,"column":6}},"38":{"start":{"line":95,"column":0},"end":{"line":105,"column":2}},"39":{"start":{"line":96,"column":2},"end":{"line":96,"column":29}},"40":{"start":{"line":97,"column":2},"end":{"line":102,"column":3}},"41":{"start":{"line":98,"column":4},"end":{"line":98,"column":25}},"42":{"start":{"line":99,"column":4},"end":{"line":99,"column":60}},"43":{"start":{"line":100,"column":4},"end":{"line":100,"column":26}},"44":{"start":{"line":101,"column":4},"end":{"line":101,"column":18}},"45":{"start":{"line":103,"column":2},"end":{"line":103,"column":24}},"46":{"start":{"line":104,"column":2},"end":{"line":104,"column":14}},"47":{"start":{"line":113,"column":0},"end":{"line":146,"column":2}},"48":{"start":{"line":114,"column":2},"end":{"line":114,"column":60}},"49":{"start":{"line":115,"column":2},"end":{"line":115,"column":58}},"50":{"start":{"line":116,"column":2},"end":{"line":116,"column":33}},"51":{"start":{"line":117,"column":2},"end":{"line":117,"column":36}},"52":{"start":{"line":118,"column":2},"end":{"line":118,"column":12}},"53":{"start":{"line":119,"column":2},"end":{"line":119,"column":12}},"54":{"start":{"line":120,"column":2},"end":{"line":120,"column":12}},"55":{"start":{"line":121,"column":2},"end":{"line":121,"column":12}},"56":{"start":{"line":122,"column":2},"end":{"line":122,"column":15}},"57":{"start":{"line":123,"column":2},"end":{"line":123,"column":15}},"58":{"start":{"line":124,"column":2},"end":{"line":124,"column":20}},"59":{"start":{"line":125,"column":2},"end":{"line":125,"column":14}},"60":{"start":{"line":126,"column":2},"end":{"line":126,"column":36}},"61":{"start":{"line":126,"column":24},"end":{"line":126,"column":36}},"62":{"start":{"line":127,"column":2},"end":{"line":144,"column":3}},"63":{"start":{"line":128,"column":4},"end":{"line":128,"column":14}},"64":{"start":{"line":129,"column":4},"end":{"line":129,"column":16}},"65":{"start":{"line":130,"column":4},"end":{"line":130,"column":23}},"66":{"start":{"line":131,"column":4},"end":{"line":131,"column":23}},"67":{"start":{"line":132,"column":4},"end":{"line":142,"column":5}},"68":{"start":{"line":133,"column":6},"end":{"line":133,"column":31}},"69":{"start":{"line":134,"column":6},"end":{"line":134,"column":31}},"70":{"start":{"line":135,"column":6},"end":{"line":135,"column":82}},"71":{"start":{"line":136,"column":6},"end":{"line":140,"column":37}},"72":{"start":{"line":141,"column":6},"end":{"line":141,"column":10}},"73":{"start":{"line":143,"column":4},"end":{"line":143,"column":10}},"74":{"start":{"line":145,"column":2},"end":{"line":145,"column":14}},"75":{"start":{"line":149,"column":0},"end":{"line":151,"column":2}},"76":{"start":{"line":150,"column":2},"end":{"line":150,"column":43}},"77":{"start":{"line":154,"column":0},"end":{"line":193,"column":2}},"78":{"start":{"line":155,"column":2},"end":{"line":155,"column":18}},"79":{"start":{"line":156,"column":2},"end":{"line":156,"column":52}},"80":{"start":{"line":157,"column":2},"end":{"line":157,"column":52}},"81":{"start":{"line":158,"column":2},"end":{"line":158,"column":17}},"82":{"start":{"line":159,"column":2},"end":{"line":159,"column":17}},"83":{"start":{"line":160,"column":2},"end":{"line":162,"column":17}},"84":{"start":{"line":163,"column":2},"end":{"line":185,"column":3}},"85":{"start":{"line":164,"column":4},"end":{"line":164,"column":22}},"86":{"start":{"line":165,"column":4},"end":{"line":165,"column":21}},"87":{"start":{"line":166,"column":4},"end":{"line":166,"column":22}},"88":{"start":{"line":167,"column":4},"end":{"line":167,"column":21}},"89":{"start":{"line":168,"column":4},"end":{"line":168,"column":26}},"90":{"start":{"line":169,"column":4},"end":{"line":169,"column":30}},"91":{"start":{"line":170,"column":4},"end":{"line":184,"column":5}},"92":{"start":{"line":171,"column":6},"end":{"line":171,"column":10}},"93":{"start":{"line":172,"column":6},"end":{"line":172,"column":10}},"94":{"start":{"line":173,"column":6},"end":{"line":175,"column":7}},"95":{"start":{"line":174,"column":8},"end":{"line":174,"column":95}},"96":{"start":{"line":177,"column":9},"end":{"line":184,"column":5}},"97":{"start":{"line":178,"column":6},"end":{"line":178,"column":10}},"98":{"start":{"line":179,"column":6},"end":{"line":179,"column":89}},"99":{"start":{"line":182,"column":6},"end":{"line":182,"column":10}},"100":{"start":{"line":183,"column":6},"end":{"line":183,"column":72}},"101":{"start":{"line":186,"column":2},"end":{"line":188,"column":3}},"102":{"start":{"line":187,"column":4},"end":{"line":187,"column":87}},"103":{"start":{"line":189,"column":2},"end":{"line":191,"column":3}},"104":{"start":{"line":190,"column":4},"end":{"line":190,"column":70}},"105":{"start":{"line":192,"column":2},"end":{"line":192,"column":14}},"106":{"start":{"line":196,"column":0},"end":{"line":217,"column":2}},"107":{"start":{"line":197,"column":2},"end":{"line":197,"column":35}},"108":{"start":{"line":198,"column":2},"end":{"line":198,"column":15}},"109":{"start":{"line":199,"column":2},"end":{"line":199,"column":12}},"110":{"start":{"line":200,"column":2},"end":{"line":200,"column":21}},"111":{"start":{"line":201,"column":2},"end":{"line":201,"column":30}},"112":{"start":{"line":202,"column":2},"end":{"line":215,"column":3}},"113":{"start":{"line":203,"column":4},"end":{"line":203,"column":27}},"114":{"start":{"line":204,"column":4},"end":{"line":213,"column":5}},"115":{"start":{"line":205,"column":6},"end":{"line":205,"column":29}},"116":{"start":{"line":206,"column":6},"end":{"line":206,"column":45}},"117":{"start":{"line":208,"column":6},"end":{"line":208,"column":76}},"118":{"start":{"line":209,"column":6},"end":{"line":211,"column":25}},"119":{"start":{"line":212,"column":6},"end":{"line":212,"column":16}},"120":{"start":{"line":214,"column":4},"end":{"line":214,"column":16}},"121":{"start":{"line":216,"column":2},"end":{"line":216,"column":72}},"122":{"start":{"line":219,"column":0},"end":{"line":219,"column":21}},"123":{"start":{"line":221,"column":0},"end":{"line":221,"column":79}},"124":{"start":{"line":222,"column":0},"end":{"line":222,"column":20}},"125":{"start":{"line":223,"column":0},"end":{"line":223,"column":28}}},"branchMap":{"1":{"line":10,"type":"cond-expr","locations":[{"start":{"line":10,"column":54},"end":{"line":10,"column":64}},{"start":{"line":10,"column":67},"end":{"line":10,"column":72}}]},"2":{"line":22,"type":"if","locations":[{"start":{"line":22,"column":2},"end":{"line":22,"column":2}},{"start":{"line":22,"column":2},"end":{"line":22,"column":2}}]},"3":{"line":27,"type":"if","locations":[{"start":{"line":27,"column":2},"end":{"line":27,"column":2}},{"start":{"line":27,"column":2},"end":{"line":27,"column":2}}]},"4":{"line":28,"type":"binary-expr","locations":[{"start":{"line":28,"column":11},"end":{"line":28,"column":20}},{"start":{"line":28,"column":24},"end":{"line":28,"column":32}}]},"5":{"line":36,"type":"binary-expr","locations":[{"start":{"line":36,"column":11},"end":{"line":36,"column":15}},{"start":{"line":36,"column":19},"end":{"line":36,"column":27}}]},"6":{"line":39,"type":"binary-expr","locations":[{"start":{"line":39,"column":20},"end":{"line":39,"column":37}},{"start":{"line":40,"column":20},"end":{"line":43,"column":21}}]},"7":{"line":41,"type":"binary-expr","locations":[{"start":{"line":41,"column":24},"end":{"line":41,"column":43}},{"start":{"line":41,"column":48},"end":{"line":41,"column":49}}]},"8":{"line":42,"type":"binary-expr","locations":[{"start":{"line":42,"column":24},"end":{"line":42,"column":39}},{"start":{"line":42,"column":44},"end":{"line":42,"column":45}}]},"9":{"line":45,"type":"if","locations":[{"start":{"line":45,"column":2},"end":{"line":45,"column":2}},{"start":{"line":45,"column":2},"end":{"line":45,"column":2}}]},"10":{"line":45,"type":"binary-expr","locations":[{"start":{"line":45,"column":6},"end":{"line":45,"column":14}},{"start":{"line":45,"column":18},"end":{"line":45,"column":32}}]},"11":{"line":46,"type":"if","locations":[{"start":{"line":46,"column":4},"end":{"line":46,"column":4}},{"start":{"line":46,"column":4},"end":{"line":46,"column":4}}]},"12":{"line":46,"type":"binary-expr","locations":[{"start":{"line":46,"column":8},"end":{"line":46,"column":16}},{"start":{"line":46,"column":20},"end":{"line":46,"column":28}}]},"13":{"line":51,"type":"if","locations":[{"start":{"line":51,"column":2},"end":{"line":51,"column":2}},{"start":{"line":51,"column":2},"end":{"line":51,"column":2}}]},"14":{"line":57,"type":"binary-expr","locations":[{"start":{"line":57,"column":8},"end":{"line":57,"column":30}},{"start":{"line":57,"column":34},"end":{"line":57,"column":69}}]},"15":{"line":60,"type":"if","locations":[{"start":{"line":60,"column":2},"end":{"line":60,"column":2}},{"start":{"line":60,"column":2},"end":{"line":60,"column":2}}]},"16":{"line":60,"type":"binary-expr","locations":[{"start":{"line":60,"column":5},"end":{"line":60,"column":29}},{"start":{"line":60,"column":33},"end":{"line":60,"column":55}}]},"17":{"line":71,"type":"binary-expr","locations":[{"start":{"line":71,"column":6},"end":{"line":71,"column":44}},{"start":{"line":72,"column":6},"end":{"line":72,"column":79}}]},"18":{"line":135,"type":"cond-expr","locations":[{"start":{"line":135,"column":75},"end":{"line":135,"column":76}},{"start":{"line":135,"column":79},"end":{"line":135,"column":80}}]},"19":{"line":136,"type":"cond-expr","locations":[{"start":{"line":137,"column":25},"end":{"line":138,"column":35}},{"start":{"line":139,"column":25},"end":{"line":140,"column":35}}]},"20":{"line":137,"type":"cond-expr","locations":[{"start":{"line":138,"column":26},"end":{"line":138,"column":29}},{"start":{"line":138,"column":32},"end":{"line":138,"column":35}}]},"21":{"line":139,"type":"cond-expr","locations":[{"start":{"line":140,"column":26},"end":{"line":140,"column":29}},{"start":{"line":140,"column":32},"end":{"line":140,"column":35}}]},"22":{"line":163,"type":"binary-expr","locations":[{"start":{"line":163,"column":9},"end":{"line":163,"column":10}},{"start":{"line":163,"column":14},"end":{"line":163,"column":15}}]},"23":{"line":170,"type":"if","locations":[{"start":{"line":170,"column":4},"end":{"line":170,"column":4}},{"start":{"line":170,"column":4},"end":{"line":170,"column":4}}]},"24":{"line":170,"type":"binary-expr","locations":[{"start":{"line":170,"column":8},"end":{"line":170,"column":24}},{"start":{"line":170,"column":28},"end":{"line":170,"column":43}},{"start":{"line":170,"column":47},"end":{"line":170,"column":63}}]},"25":{"line":173,"type":"if","locations":[{"start":{"line":173,"column":6},"end":{"line":173,"column":6}},{"start":{"line":173,"column":6},"end":{"line":173,"column":6}}]},"26":{"line":177,"type":"if","locations":[{"start":{"line":177,"column":9},"end":{"line":177,"column":9}},{"start":{"line":177,"column":9},"end":{"line":177,"column":9}}]},"27":{"line":177,"type":"binary-expr","locations":[{"start":{"line":177,"column":13},"end":{"line":177,"column":24}},{"start":{"line":177,"column":28},"end":{"line":177,"column":40}}]},"28":{"line":204,"type":"if","locations":[{"start":{"line":204,"column":4},"end":{"line":204,"column":4}},{"start":{"line":204,"column":4},"end":{"line":204,"column":4}}]},"29":{"line":204,"type":"binary-expr","locations":[{"start":{"line":204,"column":8},"end":{"line":204,"column":31}},{"start":{"line":204,"column":35},"end":{"line":204,"column":57}},{"start":{"line":204,"column":61},"end":{"line":204,"column":83}}]},"30":{"line":209,"type":"cond-expr","locations":[{"start":{"line":210,"column":8},"end":{"line":210,"column":23}},{"start":{"line":210,"column":27},"end":{"line":211,"column":23}}]},"31":{"line":210,"type":"cond-expr","locations":[{"start":{"line":211,"column":10},"end":{"line":211,"column":19}},{"start":{"line":211,"column":22},"end":{"line":211,"column":23}}]}}}}
--------------------------------------------------------------------------------
/coverage/lcov-report/base.css:
--------------------------------------------------------------------------------
1 | body, html {
2 | margin:0; padding: 0;
3 | height: 100%;
4 | }
5 | body {
6 | font-family: Helvetica Neue, Helvetica, Arial;
7 | font-size: 14px;
8 | color:#333;
9 | }
10 | .small { font-size: 12px; }
11 | *, *:after, *:before {
12 | -webkit-box-sizing:border-box;
13 | -moz-box-sizing:border-box;
14 | box-sizing:border-box;
15 | }
16 | h1 { font-size: 20px; margin: 0;}
17 | h2 { font-size: 14px; }
18 | pre {
19 | font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
20 | margin: 0;
21 | padding: 0;
22 | -moz-tab-size: 2;
23 | -o-tab-size: 2;
24 | tab-size: 2;
25 | }
26 | a { color:#0074D9; text-decoration:none; }
27 | a:hover { text-decoration:underline; }
28 | .strong { font-weight: bold; }
29 | .space-top1 { padding: 10px 0 0 0; }
30 | .pad2y { padding: 20px 0; }
31 | .pad1y { padding: 10px 0; }
32 | .pad2x { padding: 0 20px; }
33 | .pad2 { padding: 20px; }
34 | .pad1 { padding: 10px; }
35 | .space-left2 { padding-left:55px; }
36 | .space-right2 { padding-right:20px; }
37 | .center { text-align:center; }
38 | .clearfix { display:block; }
39 | .clearfix:after {
40 | content:'';
41 | display:block;
42 | height:0;
43 | clear:both;
44 | visibility:hidden;
45 | }
46 | .fl { float: left; }
47 | @media only screen and (max-width:640px) {
48 | .col3 { width:100%; max-width:100%; }
49 | .hide-mobile { display:none!important; }
50 | }
51 |
52 | .quiet {
53 | color: #7f7f7f;
54 | color: rgba(0,0,0,0.5);
55 | }
56 | .quiet a { opacity: 0.7; }
57 |
58 | .fraction {
59 | font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
60 | font-size: 10px;
61 | color: #555;
62 | background: #E8E8E8;
63 | padding: 4px 5px;
64 | border-radius: 3px;
65 | vertical-align: middle;
66 | }
67 |
68 | div.path a:link, div.path a:visited { color: #333; }
69 | table.coverage {
70 | border-collapse: collapse;
71 | margin: 10px 0 0 0;
72 | padding: 0;
73 | }
74 |
75 | table.coverage td {
76 | margin: 0;
77 | padding: 0;
78 | vertical-align: top;
79 | }
80 | table.coverage td.line-count {
81 | text-align: right;
82 | padding: 0 5px 0 20px;
83 | }
84 | table.coverage td.line-coverage {
85 | text-align: right;
86 | padding-right: 10px;
87 | min-width:20px;
88 | }
89 |
90 | table.coverage td span.cline-any {
91 | display: inline-block;
92 | padding: 0 5px;
93 | width: 100%;
94 | }
95 | .missing-if-branch {
96 | display: inline-block;
97 | margin-right: 5px;
98 | border-radius: 3px;
99 | position: relative;
100 | padding: 0 4px;
101 | background: #333;
102 | color: yellow;
103 | }
104 |
105 | .skip-if-branch {
106 | display: none;
107 | margin-right: 10px;
108 | position: relative;
109 | padding: 0 4px;
110 | background: #ccc;
111 | color: white;
112 | }
113 | .missing-if-branch .typ, .skip-if-branch .typ {
114 | color: inherit !important;
115 | }
116 | .coverage-summary {
117 | border-collapse: collapse;
118 | width: 100%;
119 | }
120 | .coverage-summary tr { border-bottom: 1px solid #bbb; }
121 | .keyline-all { border: 1px solid #ddd; }
122 | .coverage-summary td, .coverage-summary th { padding: 10px; }
123 | .coverage-summary tbody { border: 1px solid #bbb; }
124 | .coverage-summary td { border-right: 1px solid #bbb; }
125 | .coverage-summary td:last-child { border-right: none; }
126 | .coverage-summary th {
127 | text-align: left;
128 | font-weight: normal;
129 | white-space: nowrap;
130 | }
131 | .coverage-summary th.file { border-right: none !important; }
132 | .coverage-summary th.pct { }
133 | .coverage-summary th.pic,
134 | .coverage-summary th.abs,
135 | .coverage-summary td.pct,
136 | .coverage-summary td.abs { text-align: right; }
137 | .coverage-summary td.file { white-space: nowrap; }
138 | .coverage-summary td.pic { min-width: 120px !important; }
139 | .coverage-summary tfoot td { }
140 |
141 | .coverage-summary .sorter {
142 | height: 10px;
143 | width: 7px;
144 | display: inline-block;
145 | margin-left: 0.5em;
146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
147 | }
148 | .coverage-summary .sorted .sorter {
149 | background-position: 0 -20px;
150 | }
151 | .coverage-summary .sorted-desc .sorter {
152 | background-position: 0 -10px;
153 | }
154 | .status-line { height: 10px; }
155 | /* dark red */
156 | .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
157 | .low .chart { border:1px solid #C21F39 }
158 | /* medium red */
159 | .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
160 | /* light red */
161 | .low, .cline-no { background:#FCE1E5 }
162 | /* light green */
163 | .high, .cline-yes { background:rgb(230,245,208) }
164 | /* medium green */
165 | .cstat-yes { background:rgb(161,215,106) }
166 | /* dark green */
167 | .status-line.high, .high .cover-fill { background:rgb(77,146,33) }
168 | .high .chart { border:1px solid rgb(77,146,33) }
169 | /* dark yellow (gold) */
170 | .medium .chart { border:1px solid #f9cd0b; }
171 | .status-line.medium, .medium .cover-fill { background: #f9cd0b; }
172 | /* light yellow */
173 | .medium { background: #fff4c2; }
174 | /* light gray */
175 | span.cline-neutral { background: #eaeaea; }
176 |
177 | .cbranch-no { background: yellow !important; color: #111; }
178 |
179 | .cstat-skip { background: #ddd; color: #111; }
180 | .fstat-skip { background: #ddd; color: #111 !important; }
181 | .cbranch-skip { background: #ddd !important; color: #111; }
182 |
183 |
184 | .cover-fill, .cover-empty {
185 | display:inline-block;
186 | height: 12px;
187 | }
188 | .chart {
189 | line-height: 0;
190 | }
191 | .cover-empty {
192 | background: white;
193 | }
194 | .cover-full {
195 | border-right: none !important;
196 | }
197 | pre.prettyprint {
198 | border: none !important;
199 | padding: 0 !important;
200 | margin: 0 !important;
201 | }
202 | .com { color: #999 !important; }
203 | .ignore-none { color: #999; font-weight: normal; }
204 |
205 | .wrapper {
206 | min-height: 100%;
207 | height: auto !important;
208 | height: 100%;
209 | margin: 0 auto -48px;
210 | }
211 | .footer, .push {
212 | height: 48px;
213 | }
214 |
--------------------------------------------------------------------------------
/coverage/lcov-report/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code coverage report for All files
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 | /
20 |
21 |
22 |
23 | 100%
24 | Statements
25 | 181/181
26 |
27 |
28 | 100%
29 | Branches
30 | 75/75
31 |
32 |
33 | 100%
34 | Functions
35 | 6/6
36 |
37 |
38 | 100%
39 | Lines
40 | 179/179
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | File |
50 | |
51 | Statements |
52 | |
53 | Branches |
54 | |
55 | Functions |
56 | |
57 | Lines |
58 | |
59 |
60 |
61 |
62 | majinbuu/ |
63 | |
64 | 100% |
65 | 56/56 |
66 | 100% |
67 | 11/11 |
68 | 100% |
69 | 4/4 |
70 | 100% |
71 | 55/55 |
72 |
73 |
74 |
75 | majinbuu/cjs/ |
76 | |
77 | 100% |
78 | 125/125 |
79 | 100% |
80 | 64/64 |
81 | 100% |
82 | 2/2 |
83 | 100% |
84 | 124/124 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
95 |
96 |
97 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/coverage/lcov-report/majinbuu/cjs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code coverage report for majinbuu/cjs/
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 | all files majinbuu/cjs/
20 |
21 |
22 |
23 | 100%
24 | Statements
25 | 125/125
26 |
27 |
28 | 100%
29 | Branches
30 | 64/64
31 |
32 |
33 | 100%
34 | Functions
35 | 2/2
36 |
37 |
38 | 100%
39 | Lines
40 | 124/124
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | File |
50 | |
51 | Statements |
52 | |
53 | Branches |
54 | |
55 | Functions |
56 | |
57 | Lines |
58 | |
59 |
60 |
61 |
62 | index.js |
63 | |
64 | 100% |
65 | 125/125 |
66 | 100% |
67 | 64/64 |
68 | 100% |
69 | 2/2 |
70 | 100% |
71 | 124/124 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
82 |
83 |
84 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/coverage/lcov-report/majinbuu/cjs/index.js.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code coverage report for majinbuu/cjs/index.js
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 | 100%
24 | Statements
25 | 125/125
26 |
27 |
28 | 100%
29 | Branches
30 | 64/64
31 |
32 |
33 | 100%
34 | Functions
35 | 2/2
36 |
37 |
38 | 100%
39 | Lines
40 | 124/124
41 |
42 |
43 |
44 |
45 |
46 | 1
47 | 2
48 | 3
49 | 4
50 | 5
51 | 6
52 | 7
53 | 8
54 | 9
55 | 10
56 | 11
57 | 12
58 | 13
59 | 14
60 | 15
61 | 16
62 | 17
63 | 18
64 | 19
65 | 20
66 | 21
67 | 22
68 | 23
69 | 24
70 | 25
71 | 26
72 | 27
73 | 28
74 | 29
75 | 30
76 | 31
77 | 32
78 | 33
79 | 34
80 | 35
81 | 36
82 | 37
83 | 38
84 | 39
85 | 40
86 | 41
87 | 42
88 | 43
89 | 44
90 | 45
91 | 46
92 | 47
93 | 48
94 | 49
95 | 50
96 | 51
97 | 52
98 | 53
99 | 54
100 | 55
101 | 56
102 | 57
103 | 58
104 | 59
105 | 60
106 | 61
107 | 62
108 | 63
109 | 64
110 | 65
111 | 66
112 | 67
113 | 68
114 | 69
115 | 70
116 | 71
117 | 72
118 | 73
119 | 74
120 | 75
121 | 76
122 | 77
123 | 78
124 | 79
125 | 80
126 | 81
127 | 82
128 | 83
129 | 84
130 | 85
131 | 86
132 | 87
133 | 88
134 | 89
135 | 90
136 | 91
137 | 92
138 | 93
139 | 94
140 | 95
141 | 96
142 | 97
143 | 98
144 | 99
145 | 100
146 | 101
147 | 102
148 | 103
149 | 104
150 | 105
151 | 106
152 | 107
153 | 108
154 | 109
155 | 110
156 | 111
157 | 112
158 | 113
159 | 114
160 | 115
161 | 116
162 | 117
163 | 118
164 | 119
165 | 120
166 | 121
167 | 122
168 | 123
169 | 124
170 | 125
171 | 126
172 | 127
173 | 128
174 | 129
175 | 130
176 | 131
177 | 132
178 | 133
179 | 134
180 | 135
181 | 136
182 | 137
183 | 138
184 | 139
185 | 140
186 | 141
187 | 142
188 | 143
189 | 144
190 | 145
191 | 146
192 | 147
193 | 148
194 | 149
195 | 150
196 | 151
197 | 152
198 | 153
199 | 154
200 | 155
201 | 156
202 | 157
203 | 158
204 | 159
205 | 160
206 | 161
207 | 162
208 | 163
209 | 164
210 | 165
211 | 166
212 | 167
213 | 168
214 | 169
215 | 170
216 | 171
217 | 172
218 | 173
219 | 174
220 | 175
221 | 176
222 | 177
223 | 178
224 | 179
225 | 180
226 | 181
227 | 182
228 | 183
229 | 184
230 | 185
231 | 186
232 | 187
233 | 188
234 | 189
235 | 190
236 | 191
237 | 192
238 | 193
239 | 194
240 | 195
241 | 196
242 | 197
243 | 198
244 | 199
245 | 200
246 | 201
247 | 202
248 | 203
249 | 204
250 | 205
251 | 206
252 | 207
253 | 208
254 | 209
255 | 210
256 | 211
257 | 212
258 | 213
259 | 214
260 | 215
261 | 216
262 | 217
263 | 218
264 | 219
265 | 220
266 | 221
267 | 222
268 | 223
269 | 224 |
270 |
271 |
272 |
273 | 2×
274 | 2×
275 | 2×
276 |
277 |
278 | 2×
279 |
280 |
281 | 2×
282 |
283 | 2×
284 |
285 |
286 |
287 |
288 |
289 |
290 | 21×
291 |
292 | 1×
293 |
294 |
295 | 20×
296 | 19×
297 | 19×
298 | 19×
299 | 19×
300 | 19×
301 | 19×
302 | 19×
303 |
304 | 1×
305 |
306 |
307 | 20×
308 |
309 |
310 |
311 |
312 |
313 | 20×
314 | 3×
315 | 2×
316 |
317 | 3×
318 |
319 | 17×
320 | 1×
321 | 1×
322 |
323 | 16×
324 | 16×
325 | 16×
326 | 16×
327 |
328 | 16×
329 |
330 | 1×
331 |
332 |
333 |
334 |
335 | 15×
336 | 15×
337 | 15×
338 | 15×
339 |
340 |
341 |
342 | 13×
343 |
344 | 15×
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 | 2×
364 | 3×
365 | 1×
366 | 4×
367 | 4×
368 | 4×
369 | 4×
370 |
371 | 3×
372 | 3×
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 | 2×
382 | 15×
383 | 15×
384 | 15×
385 | 15×
386 | 15×
387 | 15×
388 | 15×
389 | 15×
390 | 15×
391 | 15×
392 | 15×
393 | 15×
394 | 72×
395 | 15×
396 | 65×
397 | 65×
398 | 65×
399 | 65×
400 | 65×
401 | 380×
402 | 380×
403 | 380×
404 | 380×
405 |
406 |
407 |
408 |
409 | 380×
410 |
411 | 65×
412 |
413 | 15×
414 |
415 |
416 |
417 | 2×
418 | 66×
419 |
420 |
421 |
422 | 2×
423 | 15×
424 | 15×
425 | 15×
426 | 15×
427 | 15×
428 | 15×
429 |
430 |
431 | 15×
432 | 60×
433 | 60×
434 | 60×
435 | 60×
436 | 60×
437 | 60×
438 | 60×
439 | 48×
440 | 48×
441 | 48×
442 | 25×
443 |
444 |
445 | 12×
446 | 7×
447 | 7×
448 |
449 |
450 | 5×
451 | 5×
452 |
453 |
454 | 15×
455 | 17×
456 |
457 | 15×
458 | 12×
459 |
460 | 15×
461 |
462 |
463 |
464 | 2×
465 | 15×
466 | 15×
467 | 15×
468 | 15×
469 | 15×
470 | 15×
471 | 51×
472 | 51×
473 | 37×
474 | 37×
475 |
476 | 14×
477 | 14×
478 |
479 |
480 | 14×
481 |
482 | 51×
483 |
484 | 15×
485 |
486 |
487 | 2×
488 |
489 | 2×
490 | 2×
491 | 2×
492 | | 'use strict';
493 | /*! Copyright (c) 2017, Andrea Giammarchi, @WebReflection */
494 |
495 | // grid operations
496 | const DELETE = 'del';
497 | const INSERT = 'ins';
498 | const SUBSTITUTE = 'sub';
499 |
500 | // typed Array
501 | const TypedArray = typeof Int32Array === 'function' ? Int32Array : Array;
502 |
503 | // shortcuts
504 | const { min, sqrt } = Math;
505 |
506 | const majinbuu = function (
507 | from, to,
508 | fromStart, fromEnd, fromLength,
509 | toStart, toEnd, toLength,
510 | SIZE
511 | ) {
512 |
513 | if(from === to) {
514 | //# same arrays. Do nothing
515 | return;
516 | }
517 |
518 | if (arguments.length < 4) {
519 | SIZE = fromStart || Infinity;
520 | fromLength = from.length;
521 | fromStart = 0;
522 | fromEnd = fromLength;
523 | toLength = to.length;
524 | toStart = 0;
525 | toEnd = toLength;
526 | } else {
527 | SIZE = SIZE || Infinity;
528 | }
529 |
530 | const TOO_MANY = SIZE !== Infinity &&
531 | SIZE < sqrt(
532 | ((fromEnd - fromStart) || 1) *
533 | ((toEnd - toStart) || 1)
534 | );
535 |
536 | if (TOO_MANY || fromLength < 1) {
537 | if (TOO_MANY || toLength) {
538 | from.splice.apply(from, [0, fromLength].concat(to));
539 | }
540 | return;
541 | }
542 | if (toLength < 1) {
543 | from.splice(0);
544 | return;
545 | }
546 | const minLength = min(fromLength, toLength);
547 | let beginIndex = fromStart;
548 | while(beginIndex < minLength && from[beginIndex] === to[beginIndex]) {
549 | beginIndex += 1;
550 | }
551 | if(beginIndex == fromLength && fromLength == toLength) {
552 | // content of { from } and { to } are equal. Do nothing
553 | return;
554 | }
555 | else {
556 | // relative from both ends { from } and { to }. { -1 } is last element,
557 | // { -2 } is { to[to.length - 2] } and { from[fromLength - 2] } etc
558 | let endRelIndex = 0;
559 | const fromLengthMinus1 = fromEnd - 1;
560 | const toLengthMinus1 = toEnd - 1;
561 | while(
562 | beginIndex < (minLength + endRelIndex) &&
563 | from[fromLengthMinus1 + endRelIndex] === to[toLengthMinus1 + endRelIndex]
564 | ) {
565 | endRelIndex--;
566 | }
567 | performOperations(
568 | from,
569 | getOperations(
570 | levenstein(
571 | from, beginIndex, fromLength,
572 | to, endRelIndex, toLength
573 | ),
574 | from, beginIndex, fromLength,
575 | to, endRelIndex, toLength
576 | )
577 | );
578 | }
579 | };
580 |
581 | // given an object that would like to intercept
582 | // all splice operations performed through a list,
583 | // wraps the list.splice method to delegate such object
584 | // and it puts back original splice right before every invocation.
585 | // Note: do not use the same list in two different aura
586 | const aura = (splicer, list) => {
587 | const splice = list.splice;
588 | function $splice() {
589 | list.splice = splice;
590 | const result = splicer.splice.apply(splicer, arguments);
591 | list.splice = $splice;
592 | return result;
593 | }
594 | list.splice = $splice;
595 | return list;
596 | };
597 |
598 | // Helpers - - - - - - - - - - - - - - - - - - - - - -
599 |
600 | // originally readapted from:
601 | // http://webreflection.blogspot.co.uk/2009/02/levenshtein-algorithm-revisited-25.html
602 | // then rewritten in C for Emscripten (see levenstein.c)
603 | // then "screw you ASM" due no much gain but very bloated code
604 | const levenstein = (from, beginIndex, fromLength, to, endRelIndex, toLength) => {
605 | const fLength = fromLength + 1 - beginIndex + endRelIndex;
606 | const tLength = toLength + 1 - beginIndex + endRelIndex;
607 | const size = fLength * tLength;
608 | const grid = new TypedArray(size);
609 | let x = 0;
610 | let y = 0;
611 | let X = 0;
612 | let Y = 0;
613 | let crow = 0;
614 | let prow = 0;
615 | let del, ins, sub;
616 | grid[0] = 0;
617 | while (++x < tLength) grid[x] = x;
618 | while (++y < fLength) {
619 | X = x = 0;
620 | prow = crow;
621 | crow = y * tLength;
622 | grid[crow + x] = y;
623 | while (++x < tLength) {
624 | del = grid[prow + x] + 1;
625 | ins = grid[crow + X] + 1;
626 | sub = grid[prow + X] + (from[Y + beginIndex] == to[X + beginIndex] ? 0 : 1);
627 | grid[crow + x] = del < ins ?
628 | (del < sub ?
629 | del : sub) :
630 | (ins < sub ?
631 | ins : sub);
632 | ++X;
633 | };
634 | Y = y;
635 | }
636 | return grid;
637 | };
638 |
639 | // add operations (in reversed order)
640 | const addOperation = (list, type, x, y, count, items) => {
641 | list.unshift({type, x, y, count, items});
642 | };
643 |
644 | // walk the Levenshtein grid bottom -> up
645 | const getOperations = (grid, Y, beginIndex, YLength, X, endRelIndex, XLength) => {
646 | const list = [];
647 | const YL = YLength + 1 - beginIndex + endRelIndex;
648 | const XL = XLength + 1 - beginIndex + endRelIndex;
649 | let y = YL - 1;
650 | let x = XL - 1;
651 | let cell,
652 | top, left, diagonal,
653 | crow, prow;
654 | while (x && y) {
655 | crow = y * XL + x;
656 | prow = crow - XL;
657 | cell = grid[crow];
658 | top = grid[prow];
659 | left = grid[crow - 1];
660 | diagonal = grid[prow - 1];
661 | if (diagonal <= left && diagonal <= top && diagonal <= cell) {
662 | x--;
663 | y--;
664 | if (diagonal < cell) {
665 | addOperation(list, SUBSTITUTE, x + beginIndex, y + beginIndex, 1, [X[x + beginIndex]]);
666 | }
667 | }
668 | else if (left <= top && left <= cell) {
669 | x--;
670 | addOperation(list, INSERT, x + beginIndex, y + beginIndex, 0, [X[x + beginIndex]]);
671 | }
672 | else {
673 | y--;
674 | addOperation(list, DELETE, x + beginIndex, y + beginIndex, 1, []);
675 | }
676 | }
677 | while (x--) {
678 | addOperation(list, INSERT, x + beginIndex, y + beginIndex, 0, [X[x + beginIndex]]);
679 | }
680 | while (y--) {
681 | addOperation(list, DELETE, x + beginIndex, y + beginIndex, 1, []);
682 | }
683 | return list;
684 | };
685 |
686 | /* grouped operations */
687 | const performOperations = (target, operations) => {
688 | const length = operations.length;
689 | let diff = 0;
690 | let i = 1;
691 | let curr, prev, op;
692 | op = (prev = operations[0]);
693 | while (i < length) {
694 | curr = operations[i++];
695 | if (prev.type === curr.type && (curr.x - prev.x) <= 1 && (curr.y - prev.y) <= 1) {
696 | op.count += curr.count;
697 | op.items = op.items.concat(curr.items);
698 | } else {
699 | target.splice.apply(target, [op.y + diff, op.count].concat(op.items));
700 | diff += op.type === INSERT ?
701 | op.items.length : (op.type === DELETE ?
702 | -op.count : 0);
703 | op = curr;
704 | }
705 | prev = curr;
706 | }
707 | target.splice.apply(target, [op.y + diff, op.count].concat(op.items));
708 | };
709 |
710 | majinbuu.aura = aura;
711 |
712 | Object.defineProperty(exports, '__esModule', {value: true}).default = majinbuu;
713 | exports.aura = aura;
714 | exports.majinbuu = majinbuu;
715 | |
716 |
717 |
718 |
719 |
723 |
724 |
725 |
732 |
733 |
734 |
735 |
--------------------------------------------------------------------------------
/coverage/lcov-report/majinbuu/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code coverage report for majinbuu/
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 | all files majinbuu/
20 |
21 |
22 |
23 | 100%
24 | Statements
25 | 56/56
26 |
27 |
28 | 100%
29 | Branches
30 | 11/11
31 |
32 |
33 | 100%
34 | Functions
35 | 4/4
36 |
37 |
38 | 100%
39 | Lines
40 | 55/55
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | File |
50 | |
51 | Statements |
52 | |
53 | Branches |
54 | |
55 | Functions |
56 | |
57 | Lines |
58 | |
59 |
60 |
61 |
62 | test.js |
63 | |
64 | 100% |
65 | 56/56 |
66 | 100% |
67 | 11/11 |
68 | 100% |
69 | 4/4 |
70 | 100% |
71 | 55/55 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
82 |
83 |
84 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/coverage/lcov-report/majinbuu/test.js.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code coverage report for majinbuu/test.js
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 | 100%
24 | Statements
25 | 56/56
26 |
27 |
28 | 100%
29 | Branches
30 | 11/11
31 |
32 |
33 | 100%
34 | Functions
35 | 4/4
36 |
37 |
38 | 100%
39 | Lines
40 | 55/55
41 |
42 |
43 |
44 |
45 |
46 | 1
47 | 2
48 | 3
49 | 4
50 | 5
51 | 6
52 | 7
53 | 8
54 | 9
55 | 10
56 | 11
57 | 12
58 | 13
59 | 14
60 | 15
61 | 16
62 | 17
63 | 18
64 | 19
65 | 20
66 | 21
67 | 22
68 | 23
69 | 24
70 | 25
71 | 26
72 | 27
73 | 28
74 | 29
75 | 30
76 | 31
77 | 32
78 | 33
79 | 34
80 | 35
81 | 36
82 | 37
83 | 38
84 | 39
85 | 40
86 | 41
87 | 42
88 | 43
89 | 44
90 | 45
91 | 46
92 | 47
93 | 48
94 | 49
95 | 50
96 | 51
97 | 52
98 | 53
99 | 54
100 | 55
101 | 56
102 | 57
103 | 58
104 | 59
105 | 60
106 | 61
107 | 62
108 | 63
109 | 64
110 | 65
111 | 66
112 | 67
113 | 68
114 | 69
115 | 70
116 | 71
117 | 72
118 | 73
119 | 74
120 | 75
121 | 76
122 | 77
123 | 78
124 | 79
125 | 80
126 | 81
127 | 82
128 | 83
129 | 84
130 | 85
131 | 86
132 | 87
133 | 88
134 | 89
135 | 90
136 | 91
137 | 92
138 | 93 | 1×
139 | 1×
140 |
141 | 1×
142 |
143 | 1×
144 | 9×
145 | 1×
146 | 26×
147 | 26×
148 |
149 | 9×
150 | 9×
151 | 9×
152 | 9×
153 | 9×
154 | 9×
155 | 9×
156 | 7×
157 | 7×
158 | 7×
159 | 7×
160 | 7×
161 | 7×
162 |
163 |
164 |
165 | 1×
166 |
167 | 1×
168 | 1×
169 | 1×
170 | 1×
171 | 1×
172 | 1×
173 | 1×
174 | 1×
175 | 1×
176 |
177 | 1×
178 | 1×
179 | 1×
180 |
181 | 1×
182 | 1×
183 | 1×
184 |
185 |
186 | 3×
187 | 3×
188 |
189 |
190 |
191 | 1×
192 |
193 | 1×
194 | 1×
195 | 1×
196 | 1×
197 |
198 | 1×
199 | 1×
200 | 1×
201 | 1×
202 |
203 | 1×
204 | 1×
205 | 1×
206 |
207 |
208 | 1×
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 | 1×
221 | 1×
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 | 1×
230 | | var {title, assert, log} = require('tressa');
231 | var majinbuu = require('./cjs').default;
232 |
233 | title('Majin Buu');
234 |
235 | function test(a, b) {
236 | var count;
237 | function splice() {
238 | count++;
239 | return brr.splice.apply(arr, arguments);
240 | }
241 | var arr = a.split('');
242 | var brr = b.split('');
243 | count = 0;
244 | arr.splice = splice;
245 | majinbuu(arr, brr, 10);
246 | assert(arr.join('') === brr.join(''), `\x1b[2m[${count}]\x1b[22m ${a || '<empty>'} => ${b || '<empty>'}`);
247 | if (a !== b) {
248 | arr = b.split('');
249 | brr = a.split('');
250 | count = 0;
251 | arr.splice = splice;
252 | majinbuu(arr, brr);
253 | assert(arr.join('') === brr.join(''), `\x1b[2m[${count}]\x1b[22m ${b || '<empty>'} => ${a}`);
254 | }
255 | }
256 |
257 | let sameArray = []; majinbuu(sameArray, sameArray); //# to cover { if(from === to) return; } trivial case
258 |
259 | test('', '');
260 | test('same', 'same');
261 | test('democrat', 'republican');
262 | test('kitten', 'sitting');
263 | test('abc', '');
264 | test('roar', 'meow');
265 | test('abra', 'cadabra');
266 | test('matrix', 'xxxmatr');
267 | test('matrix', 'matrixhasyou'); //# check that skipping of equal elements at begin works
268 |
269 | delete global.Int32Array;
270 | delete require.cache[require.resolve('./cjs')];
271 | var majinbuu = require('./cjs').default;
272 |
273 | log('## majinbuu.aura');
274 | var list = 'abra'.split('');
275 | var wrap = {
276 | spliced: false,
277 | splice: function () {
278 | this.spliced = true;
279 | this.result = list.splice.apply(list, arguments);
280 | }
281 | };
282 |
283 | var aura = majinbuu.aura(wrap, list);
284 |
285 | majinbuu(aura, 'cadabra'.split(''));
286 | assert(wrap.spliced, 'aura invoked the wrapper instead');
287 | assert(list.join('') === 'cadabra', 'aura modified the list');
288 | assert(aura.join('') === 'cadabra', 'aura inherits list');
289 |
290 | list = ['12'];
291 | aura = majinbuu.aura(wrap, list);
292 | majinbuu(aura, ['a', 'b']);
293 | assert(aura.join('') === 'ab', 'single to double is OK');
294 |
295 | list = '0123456789'.split('');
296 | log('## grid limit');
297 | majinbuu(
298 | majinbuu.aura({
299 | splice: function (index, many) {
300 | assert(
301 | index === 0 &&
302 | many === list.length &&
303 | list.slice.call(arguments, 2).join('') === 'OK',
304 | 'max grid limit respected'
305 | );
306 | }
307 | }, list),
308 | 'OK'.split(''),
309 | 3
310 | );
311 |
312 | const abra = ['a', 'b', 'r', 'a'];
313 | majinbuu(
314 | abra,
315 | ['c', 'a', 'd', 'a', 'b', 'r', 'a'],
316 | 0, 1, 4,
317 | 0, 4, 7,
318 | 0
319 | );
320 |
321 | tressa.assert(abra.join('') === 'cadabra', 'passing extra info works too');
322 | |
323 |
324 |
325 |
326 |
330 |
331 |
332 |
339 |
340 |
341 |
342 |
--------------------------------------------------------------------------------
/coverage/lcov-report/prettify.css:
--------------------------------------------------------------------------------
1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
2 |
--------------------------------------------------------------------------------
/coverage/lcov-report/prettify.js:
--------------------------------------------------------------------------------
1 | window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^