was.js – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
2 | office | 1 | /*************************************************************************/ |
2 | /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ |
||
3 | /*************************************************************************/ |
||
4 | if (!Array.prototype.product) { |
||
5 | Array.prototype.product = function(b) { |
||
6 | var a = this; |
||
7 | return $.map( |
||
8 | new Array(Math.max(this.length, a.length)), |
||
9 | function(e, i) { |
||
10 | var o = {}; |
||
11 | o[a[i]] = b[i]; |
||
12 | return o; |
||
13 | }); |
||
14 | }; |
||
15 | } |
||
16 | $.extend({ |
||
17 | product: function(a, b) { |
||
18 | return $.map( |
||
19 | new Array(Math.max(this.length, a.length)), |
||
20 | function(e, i) { |
||
21 | var o = {}; |
||
22 | o[a[i]] = b[i]; |
||
23 | return o; |
||
24 | }); |
||
25 | } |
||
26 | }); |
||
27 | |||
28 | /*************************************************************************/ |
||
29 | /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ |
||
30 | /*************************************************************************/ |
||
31 | if (!Array.prototype.stride) { |
||
32 | Array.prototype.stride = function(s) { |
||
33 | return this.filter(function(e, i) { |
||
34 | return i % s === 0; |
||
35 | }); |
||
36 | }; |
||
37 | } |
||
38 | $.extend({ |
||
39 | stride: function(a, s) { |
||
40 | return a.filter(function(e, i) { |
||
41 | return i % s === 0; |
||
42 | }); |
||
43 | } |
||
44 | }); |
||
45 | |||
46 | /*************************************************************************/ |
||
47 | /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ |
||
48 | /*************************************************************************/ |
||
49 | if (!Array.prototype.chunk) { |
||
50 | Array.prototype.chunk = function(n) { |
||
51 | if (!this.length) { |
||
52 | return []; |
||
53 | } |
||
54 | return [this.slice(0, n)] |
||
55 | .concat(this.slice(n).chunk(n)); |
||
56 | }; |
||
57 | } |
||
58 | $.extend({ |
||
59 | chunk: function(a, n) { |
||
60 | if (!a.length) { |
||
61 | return []; |
||
62 | } |
||
63 | return [a.slice(0, n)] |
||
64 | .concat(a.slice(n).chunk(n)); |
||
65 | } |
||
66 | }); |