protobufjs 6.11.0 → 6.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/bin/pbjs +0 -0
  3. package/bin/pbts +0 -0
  4. package/index.d.ts +3 -0
  5. package/package-lock.json +7870 -0
  6. package/package.json +3 -3
  7. package/scripts/changelog.js +150 -0
  8. package/src/field.js +3 -3
  9. package/src/namespace.js +2 -1
  10. package/src/util.js +3 -0
  11. package/cli/node_modules/.package-lock.json +0 -256
  12. package/cli/node_modules/acorn/CHANGELOG.md +0 -620
  13. package/cli/node_modules/acorn/LICENSE +0 -21
  14. package/cli/node_modules/acorn/README.md +0 -269
  15. package/cli/node_modules/acorn/bin/acorn +0 -4
  16. package/cli/node_modules/acorn/dist/acorn.d.ts +0 -209
  17. package/cli/node_modules/acorn/dist/acorn.js +0 -5186
  18. package/cli/node_modules/acorn/dist/acorn.js.map +0 -1
  19. package/cli/node_modules/acorn/dist/acorn.mjs +0 -5155
  20. package/cli/node_modules/acorn/dist/acorn.mjs.d.ts +0 -2
  21. package/cli/node_modules/acorn/dist/acorn.mjs.map +0 -1
  22. package/cli/node_modules/acorn/dist/bin.js +0 -64
  23. package/cli/node_modules/acorn/package.json +0 -35
  24. package/cli/node_modules/acorn-jsx/LICENSE +0 -19
  25. package/cli/node_modules/acorn-jsx/README.md +0 -40
  26. package/cli/node_modules/acorn-jsx/index.js +0 -488
  27. package/cli/node_modules/acorn-jsx/package.json +0 -27
  28. package/cli/node_modules/acorn-jsx/xhtml.js +0 -255
  29. package/cli/node_modules/balanced-match/.npmignore +0 -5
  30. package/cli/node_modules/balanced-match/LICENSE.md +0 -21
  31. package/cli/node_modules/balanced-match/README.md +0 -91
  32. package/cli/node_modules/balanced-match/index.js +0 -59
  33. package/cli/node_modules/balanced-match/package.json +0 -49
  34. package/cli/node_modules/brace-expansion/LICENSE +0 -21
  35. package/cli/node_modules/brace-expansion/README.md +0 -129
  36. package/cli/node_modules/brace-expansion/index.js +0 -201
  37. package/cli/node_modules/brace-expansion/package.json +0 -47
  38. package/cli/node_modules/concat-map/.travis.yml +0 -4
  39. package/cli/node_modules/concat-map/LICENSE +0 -18
  40. package/cli/node_modules/concat-map/README.markdown +0 -62
  41. package/cli/node_modules/concat-map/example/map.js +0 -6
  42. package/cli/node_modules/concat-map/index.js +0 -13
  43. package/cli/node_modules/concat-map/package.json +0 -43
  44. package/cli/node_modules/concat-map/test/map.js +0 -39
  45. package/cli/node_modules/deep-is/.npmignore +0 -1
  46. package/cli/node_modules/deep-is/.travis.yml +0 -6
  47. package/cli/node_modules/deep-is/LICENSE +0 -22
  48. package/cli/node_modules/deep-is/README.markdown +0 -70
  49. package/cli/node_modules/deep-is/example/cmp.js +0 -11
  50. package/cli/node_modules/deep-is/index.js +0 -102
  51. package/cli/node_modules/deep-is/package.json +0 -61
  52. package/cli/node_modules/deep-is/test/NaN.js +0 -16
  53. package/cli/node_modules/deep-is/test/cmp.js +0 -23
  54. package/cli/node_modules/deep-is/test/neg-vs-pos-0.js +0 -15
  55. package/cli/node_modules/escodegen/LICENSE.BSD +0 -21
  56. package/cli/node_modules/escodegen/README.md +0 -84
  57. package/cli/node_modules/escodegen/bin/escodegen.js +0 -77
  58. package/cli/node_modules/escodegen/bin/esgenerate.js +0 -64
  59. package/cli/node_modules/escodegen/escodegen.js +0 -2647
  60. package/cli/node_modules/escodegen/package.json +0 -62
  61. package/cli/node_modules/eslint-visitor-keys/CHANGELOG.md +0 -25
  62. package/cli/node_modules/eslint-visitor-keys/LICENSE +0 -201
  63. package/cli/node_modules/eslint-visitor-keys/README.md +0 -98
  64. package/cli/node_modules/eslint-visitor-keys/lib/index.js +0 -81
  65. package/cli/node_modules/eslint-visitor-keys/lib/visitor-keys.json +0 -284
  66. package/cli/node_modules/eslint-visitor-keys/package.json +0 -40
  67. package/cli/node_modules/espree/CHANGELOG.md +0 -509
  68. package/cli/node_modules/espree/LICENSE +0 -25
  69. package/cli/node_modules/espree/README.md +0 -233
  70. package/cli/node_modules/espree/espree.js +0 -177
  71. package/cli/node_modules/espree/lib/ast-node-types.js +0 -96
  72. package/cli/node_modules/espree/lib/espree.js +0 -286
  73. package/cli/node_modules/espree/lib/features.js +0 -29
  74. package/cli/node_modules/espree/lib/options.js +0 -106
  75. package/cli/node_modules/espree/lib/token-translator.js +0 -263
  76. package/cli/node_modules/espree/lib/visitor-keys.js +0 -123
  77. package/cli/node_modules/espree/package.json +0 -64
  78. package/cli/node_modules/esprima/ChangeLog +0 -235
  79. package/cli/node_modules/esprima/LICENSE.BSD +0 -21
  80. package/cli/node_modules/esprima/README.md +0 -46
  81. package/cli/node_modules/esprima/bin/esparse.js +0 -139
  82. package/cli/node_modules/esprima/bin/esvalidate.js +0 -236
  83. package/cli/node_modules/esprima/dist/esprima.js +0 -6709
  84. package/cli/node_modules/esprima/package.json +0 -112
  85. package/cli/node_modules/estraverse/.jshintrc +0 -16
  86. package/cli/node_modules/estraverse/LICENSE.BSD +0 -19
  87. package/cli/node_modules/estraverse/README.md +0 -153
  88. package/cli/node_modules/estraverse/estraverse.js +0 -801
  89. package/cli/node_modules/estraverse/gulpfile.js +0 -70
  90. package/cli/node_modules/estraverse/package.json +0 -40
  91. package/cli/node_modules/esutils/LICENSE.BSD +0 -19
  92. package/cli/node_modules/esutils/README.md +0 -174
  93. package/cli/node_modules/esutils/lib/ast.js +0 -144
  94. package/cli/node_modules/esutils/lib/code.js +0 -135
  95. package/cli/node_modules/esutils/lib/keyword.js +0 -165
  96. package/cli/node_modules/esutils/lib/utils.js +0 -33
  97. package/cli/node_modules/esutils/package.json +0 -44
  98. package/cli/node_modules/fast-levenshtein/LICENSE.md +0 -25
  99. package/cli/node_modules/fast-levenshtein/README.md +0 -104
  100. package/cli/node_modules/fast-levenshtein/levenshtein.js +0 -136
  101. package/cli/node_modules/fast-levenshtein/package.json +0 -39
  102. package/cli/node_modules/fs.realpath/LICENSE +0 -43
  103. package/cli/node_modules/fs.realpath/README.md +0 -33
  104. package/cli/node_modules/fs.realpath/index.js +0 -66
  105. package/cli/node_modules/fs.realpath/old.js +0 -303
  106. package/cli/node_modules/fs.realpath/package.json +0 -26
  107. package/cli/node_modules/glob/LICENSE +0 -21
  108. package/cli/node_modules/glob/README.md +0 -375
  109. package/cli/node_modules/glob/changelog.md +0 -67
  110. package/cli/node_modules/glob/common.js +0 -240
  111. package/cli/node_modules/glob/glob.js +0 -790
  112. package/cli/node_modules/glob/package.json +0 -46
  113. package/cli/node_modules/glob/sync.js +0 -486
  114. package/cli/node_modules/inflight/LICENSE +0 -15
  115. package/cli/node_modules/inflight/README.md +0 -37
  116. package/cli/node_modules/inflight/inflight.js +0 -54
  117. package/cli/node_modules/inflight/package.json +0 -29
  118. package/cli/node_modules/inherits/LICENSE +0 -16
  119. package/cli/node_modules/inherits/README.md +0 -42
  120. package/cli/node_modules/inherits/inherits.js +0 -9
  121. package/cli/node_modules/inherits/inherits_browser.js +0 -27
  122. package/cli/node_modules/inherits/package.json +0 -29
  123. package/cli/node_modules/levn/LICENSE +0 -22
  124. package/cli/node_modules/levn/README.md +0 -196
  125. package/cli/node_modules/levn/lib/cast.js +0 -298
  126. package/cli/node_modules/levn/lib/coerce.js +0 -285
  127. package/cli/node_modules/levn/lib/index.js +0 -22
  128. package/cli/node_modules/levn/lib/parse-string.js +0 -113
  129. package/cli/node_modules/levn/lib/parse.js +0 -102
  130. package/cli/node_modules/levn/package.json +0 -47
  131. package/cli/node_modules/minimatch/LICENSE +0 -15
  132. package/cli/node_modules/minimatch/README.md +0 -209
  133. package/cli/node_modules/minimatch/minimatch.js +0 -923
  134. package/cli/node_modules/minimatch/package.json +0 -30
  135. package/cli/node_modules/once/LICENSE +0 -15
  136. package/cli/node_modules/once/README.md +0 -79
  137. package/cli/node_modules/once/once.js +0 -42
  138. package/cli/node_modules/once/package.json +0 -33
  139. package/cli/node_modules/optionator/CHANGELOG.md +0 -56
  140. package/cli/node_modules/optionator/LICENSE +0 -22
  141. package/cli/node_modules/optionator/README.md +0 -238
  142. package/cli/node_modules/optionator/lib/help.js +0 -260
  143. package/cli/node_modules/optionator/lib/index.js +0 -465
  144. package/cli/node_modules/optionator/lib/util.js +0 -54
  145. package/cli/node_modules/optionator/package.json +0 -44
  146. package/cli/node_modules/path-is-absolute/index.js +0 -20
  147. package/cli/node_modules/path-is-absolute/license +0 -21
  148. package/cli/node_modules/path-is-absolute/package.json +0 -43
  149. package/cli/node_modules/path-is-absolute/readme.md +0 -59
  150. package/cli/node_modules/prelude-ls/CHANGELOG.md +0 -99
  151. package/cli/node_modules/prelude-ls/LICENSE +0 -22
  152. package/cli/node_modules/prelude-ls/README.md +0 -15
  153. package/cli/node_modules/prelude-ls/lib/Func.js +0 -65
  154. package/cli/node_modules/prelude-ls/lib/List.js +0 -686
  155. package/cli/node_modules/prelude-ls/lib/Num.js +0 -130
  156. package/cli/node_modules/prelude-ls/lib/Obj.js +0 -154
  157. package/cli/node_modules/prelude-ls/lib/Str.js +0 -92
  158. package/cli/node_modules/prelude-ls/lib/index.js +0 -178
  159. package/cli/node_modules/prelude-ls/package.json +0 -52
  160. package/cli/node_modules/rimraf/CHANGELOG.md +0 -65
  161. package/cli/node_modules/rimraf/LICENSE +0 -15
  162. package/cli/node_modules/rimraf/README.md +0 -101
  163. package/cli/node_modules/rimraf/bin.js +0 -68
  164. package/cli/node_modules/rimraf/package.json +0 -32
  165. package/cli/node_modules/rimraf/rimraf.js +0 -360
  166. package/cli/node_modules/source-map/CHANGELOG.md +0 -301
  167. package/cli/node_modules/source-map/LICENSE +0 -28
  168. package/cli/node_modules/source-map/README.md +0 -742
  169. package/cli/node_modules/source-map/dist/source-map.debug.js +0 -3234
  170. package/cli/node_modules/source-map/dist/source-map.js +0 -3233
  171. package/cli/node_modules/source-map/dist/source-map.min.js +0 -2
  172. package/cli/node_modules/source-map/dist/source-map.min.js.map +0 -1
  173. package/cli/node_modules/source-map/lib/array-set.js +0 -121
  174. package/cli/node_modules/source-map/lib/base64-vlq.js +0 -140
  175. package/cli/node_modules/source-map/lib/base64.js +0 -67
  176. package/cli/node_modules/source-map/lib/binary-search.js +0 -111
  177. package/cli/node_modules/source-map/lib/mapping-list.js +0 -79
  178. package/cli/node_modules/source-map/lib/quick-sort.js +0 -114
  179. package/cli/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  180. package/cli/node_modules/source-map/lib/source-map-generator.js +0 -425
  181. package/cli/node_modules/source-map/lib/source-node.js +0 -413
  182. package/cli/node_modules/source-map/lib/util.js +0 -488
  183. package/cli/node_modules/source-map/package.json +0 -73
  184. package/cli/node_modules/source-map/source-map.d.ts +0 -98
  185. package/cli/node_modules/source-map/source-map.js +0 -8
  186. package/cli/node_modules/tmp/CHANGELOG.md +0 -288
  187. package/cli/node_modules/tmp/LICENSE +0 -21
  188. package/cli/node_modules/tmp/README.md +0 -365
  189. package/cli/node_modules/tmp/lib/tmp.js +0 -780
  190. package/cli/node_modules/tmp/package.json +0 -58
  191. package/cli/node_modules/type-check/LICENSE +0 -22
  192. package/cli/node_modules/type-check/README.md +0 -210
  193. package/cli/node_modules/type-check/lib/check.js +0 -126
  194. package/cli/node_modules/type-check/lib/index.js +0 -16
  195. package/cli/node_modules/type-check/lib/parse-type.js +0 -196
  196. package/cli/node_modules/type-check/package.json +0 -40
  197. package/cli/node_modules/word-wrap/LICENSE +0 -21
  198. package/cli/node_modules/word-wrap/README.md +0 -182
  199. package/cli/node_modules/word-wrap/index.d.ts +0 -50
  200. package/cli/node_modules/word-wrap/index.js +0 -46
  201. package/cli/node_modules/word-wrap/package.json +0 -77
  202. package/cli/node_modules/wrappy/LICENSE +0 -15
  203. package/cli/node_modules/wrappy/README.md +0 -36
  204. package/cli/node_modules/wrappy/package.json +0 -29
  205. package/cli/node_modules/wrappy/wrappy.js +0 -33
@@ -1,201 +0,0 @@
1
- var concatMap = require('concat-map');
2
- var balanced = require('balanced-match');
3
-
4
- module.exports = expandTop;
5
-
6
- var escSlash = '\0SLASH'+Math.random()+'\0';
7
- var escOpen = '\0OPEN'+Math.random()+'\0';
8
- var escClose = '\0CLOSE'+Math.random()+'\0';
9
- var escComma = '\0COMMA'+Math.random()+'\0';
10
- var escPeriod = '\0PERIOD'+Math.random()+'\0';
11
-
12
- function numeric(str) {
13
- return parseInt(str, 10) == str
14
- ? parseInt(str, 10)
15
- : str.charCodeAt(0);
16
- }
17
-
18
- function escapeBraces(str) {
19
- return str.split('\\\\').join(escSlash)
20
- .split('\\{').join(escOpen)
21
- .split('\\}').join(escClose)
22
- .split('\\,').join(escComma)
23
- .split('\\.').join(escPeriod);
24
- }
25
-
26
- function unescapeBraces(str) {
27
- return str.split(escSlash).join('\\')
28
- .split(escOpen).join('{')
29
- .split(escClose).join('}')
30
- .split(escComma).join(',')
31
- .split(escPeriod).join('.');
32
- }
33
-
34
-
35
- // Basically just str.split(","), but handling cases
36
- // where we have nested braced sections, which should be
37
- // treated as individual members, like {a,{b,c},d}
38
- function parseCommaParts(str) {
39
- if (!str)
40
- return [''];
41
-
42
- var parts = [];
43
- var m = balanced('{', '}', str);
44
-
45
- if (!m)
46
- return str.split(',');
47
-
48
- var pre = m.pre;
49
- var body = m.body;
50
- var post = m.post;
51
- var p = pre.split(',');
52
-
53
- p[p.length-1] += '{' + body + '}';
54
- var postParts = parseCommaParts(post);
55
- if (post.length) {
56
- p[p.length-1] += postParts.shift();
57
- p.push.apply(p, postParts);
58
- }
59
-
60
- parts.push.apply(parts, p);
61
-
62
- return parts;
63
- }
64
-
65
- function expandTop(str) {
66
- if (!str)
67
- return [];
68
-
69
- // I don't know why Bash 4.3 does this, but it does.
70
- // Anything starting with {} will have the first two bytes preserved
71
- // but *only* at the top level, so {},a}b will not expand to anything,
72
- // but a{},b}c will be expanded to [a}c,abc].
73
- // One could argue that this is a bug in Bash, but since the goal of
74
- // this module is to match Bash's rules, we escape a leading {}
75
- if (str.substr(0, 2) === '{}') {
76
- str = '\\{\\}' + str.substr(2);
77
- }
78
-
79
- return expand(escapeBraces(str), true).map(unescapeBraces);
80
- }
81
-
82
- function identity(e) {
83
- return e;
84
- }
85
-
86
- function embrace(str) {
87
- return '{' + str + '}';
88
- }
89
- function isPadded(el) {
90
- return /^-?0\d/.test(el);
91
- }
92
-
93
- function lte(i, y) {
94
- return i <= y;
95
- }
96
- function gte(i, y) {
97
- return i >= y;
98
- }
99
-
100
- function expand(str, isTop) {
101
- var expansions = [];
102
-
103
- var m = balanced('{', '}', str);
104
- if (!m || /\$$/.test(m.pre)) return [str];
105
-
106
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
107
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
108
- var isSequence = isNumericSequence || isAlphaSequence;
109
- var isOptions = m.body.indexOf(',') >= 0;
110
- if (!isSequence && !isOptions) {
111
- // {a},b}
112
- if (m.post.match(/,.*\}/)) {
113
- str = m.pre + '{' + m.body + escClose + m.post;
114
- return expand(str);
115
- }
116
- return [str];
117
- }
118
-
119
- var n;
120
- if (isSequence) {
121
- n = m.body.split(/\.\./);
122
- } else {
123
- n = parseCommaParts(m.body);
124
- if (n.length === 1) {
125
- // x{{a,b}}y ==> x{a}y x{b}y
126
- n = expand(n[0], false).map(embrace);
127
- if (n.length === 1) {
128
- var post = m.post.length
129
- ? expand(m.post, false)
130
- : [''];
131
- return post.map(function(p) {
132
- return m.pre + n[0] + p;
133
- });
134
- }
135
- }
136
- }
137
-
138
- // at this point, n is the parts, and we know it's not a comma set
139
- // with a single entry.
140
-
141
- // no need to expand pre, since it is guaranteed to be free of brace-sets
142
- var pre = m.pre;
143
- var post = m.post.length
144
- ? expand(m.post, false)
145
- : [''];
146
-
147
- var N;
148
-
149
- if (isSequence) {
150
- var x = numeric(n[0]);
151
- var y = numeric(n[1]);
152
- var width = Math.max(n[0].length, n[1].length)
153
- var incr = n.length == 3
154
- ? Math.abs(numeric(n[2]))
155
- : 1;
156
- var test = lte;
157
- var reverse = y < x;
158
- if (reverse) {
159
- incr *= -1;
160
- test = gte;
161
- }
162
- var pad = n.some(isPadded);
163
-
164
- N = [];
165
-
166
- for (var i = x; test(i, y); i += incr) {
167
- var c;
168
- if (isAlphaSequence) {
169
- c = String.fromCharCode(i);
170
- if (c === '\\')
171
- c = '';
172
- } else {
173
- c = String(i);
174
- if (pad) {
175
- var need = width - c.length;
176
- if (need > 0) {
177
- var z = new Array(need + 1).join('0');
178
- if (i < 0)
179
- c = '-' + z + c.slice(1);
180
- else
181
- c = z + c;
182
- }
183
- }
184
- }
185
- N.push(c);
186
- }
187
- } else {
188
- N = concatMap(n, function(el) { return expand(el, false) });
189
- }
190
-
191
- for (var j = 0; j < N.length; j++) {
192
- for (var k = 0; k < post.length; k++) {
193
- var expansion = pre + N[j] + post[k];
194
- if (!isTop || isSequence || expansion)
195
- expansions.push(expansion);
196
- }
197
- }
198
-
199
- return expansions;
200
- }
201
-
@@ -1,47 +0,0 @@
1
- {
2
- "name": "brace-expansion",
3
- "description": "Brace expansion as known from sh/bash",
4
- "version": "1.1.11",
5
- "repository": {
6
- "type": "git",
7
- "url": "git://github.com/juliangruber/brace-expansion.git"
8
- },
9
- "homepage": "https://github.com/juliangruber/brace-expansion",
10
- "main": "index.js",
11
- "scripts": {
12
- "test": "tape test/*.js",
13
- "gentest": "bash test/generate.sh",
14
- "bench": "matcha test/perf/bench.js"
15
- },
16
- "dependencies": {
17
- "balanced-match": "^1.0.0",
18
- "concat-map": "0.0.1"
19
- },
20
- "devDependencies": {
21
- "matcha": "^0.7.0",
22
- "tape": "^4.6.0"
23
- },
24
- "keywords": [],
25
- "author": {
26
- "name": "Julian Gruber",
27
- "email": "mail@juliangruber.com",
28
- "url": "http://juliangruber.com"
29
- },
30
- "license": "MIT",
31
- "testling": {
32
- "files": "test/*.js",
33
- "browsers": [
34
- "ie/8..latest",
35
- "firefox/20..latest",
36
- "firefox/nightly",
37
- "chrome/25..latest",
38
- "chrome/canary",
39
- "opera/12..latest",
40
- "opera/next",
41
- "safari/5.1..latest",
42
- "ipad/6.0..latest",
43
- "iphone/6.0..latest",
44
- "android-browser/4.2..latest"
45
- ]
46
- }
47
- }
@@ -1,4 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 0.4
4
- - 0.6
@@ -1,18 +0,0 @@
1
- This software is released under the MIT license:
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
- the Software, and to permit persons to whom the Software is furnished to do so,
8
- subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,62 +0,0 @@
1
- concat-map
2
- ==========
3
-
4
- Concatenative mapdashery.
5
-
6
- [![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map)
7
-
8
- [![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map)
9
-
10
- example
11
- =======
12
-
13
- ``` js
14
- var concatMap = require('concat-map');
15
- var xs = [ 1, 2, 3, 4, 5, 6 ];
16
- var ys = concatMap(xs, function (x) {
17
- return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
18
- });
19
- console.dir(ys);
20
- ```
21
-
22
- ***
23
-
24
- ```
25
- [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]
26
- ```
27
-
28
- methods
29
- =======
30
-
31
- ``` js
32
- var concatMap = require('concat-map')
33
- ```
34
-
35
- concatMap(xs, fn)
36
- -----------------
37
-
38
- Return an array of concatenated elements by calling `fn(x, i)` for each element
39
- `x` and each index `i` in the array `xs`.
40
-
41
- When `fn(x, i)` returns an array, its result will be concatenated with the
42
- result array. If `fn(x, i)` returns anything else, that value will be pushed
43
- onto the end of the result array.
44
-
45
- install
46
- =======
47
-
48
- With [npm](http://npmjs.org) do:
49
-
50
- ```
51
- npm install concat-map
52
- ```
53
-
54
- license
55
- =======
56
-
57
- MIT
58
-
59
- notes
60
- =====
61
-
62
- This module was written while sitting high above the ground in a tree.
@@ -1,6 +0,0 @@
1
- var concatMap = require('../');
2
- var xs = [ 1, 2, 3, 4, 5, 6 ];
3
- var ys = concatMap(xs, function (x) {
4
- return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
5
- });
6
- console.dir(ys);
@@ -1,13 +0,0 @@
1
- module.exports = function (xs, fn) {
2
- var res = [];
3
- for (var i = 0; i < xs.length; i++) {
4
- var x = fn(xs[i], i);
5
- if (isArray(x)) res.push.apply(res, x);
6
- else res.push(x);
7
- }
8
- return res;
9
- };
10
-
11
- var isArray = Array.isArray || function (xs) {
12
- return Object.prototype.toString.call(xs) === '[object Array]';
13
- };
@@ -1,43 +0,0 @@
1
- {
2
- "name" : "concat-map",
3
- "description" : "concatenative mapdashery",
4
- "version" : "0.0.1",
5
- "repository" : {
6
- "type" : "git",
7
- "url" : "git://github.com/substack/node-concat-map.git"
8
- },
9
- "main" : "index.js",
10
- "keywords" : [
11
- "concat",
12
- "concatMap",
13
- "map",
14
- "functional",
15
- "higher-order"
16
- ],
17
- "directories" : {
18
- "example" : "example",
19
- "test" : "test"
20
- },
21
- "scripts" : {
22
- "test" : "tape test/*.js"
23
- },
24
- "devDependencies" : {
25
- "tape" : "~2.4.0"
26
- },
27
- "license" : "MIT",
28
- "author" : {
29
- "name" : "James Halliday",
30
- "email" : "mail@substack.net",
31
- "url" : "http://substack.net"
32
- },
33
- "testling" : {
34
- "files" : "test/*.js",
35
- "browsers" : {
36
- "ie" : [ 6, 7, 8, 9 ],
37
- "ff" : [ 3.5, 10, 15.0 ],
38
- "chrome" : [ 10, 22 ],
39
- "safari" : [ 5.1 ],
40
- "opera" : [ 12 ]
41
- }
42
- }
43
- }
@@ -1,39 +0,0 @@
1
- var concatMap = require('../');
2
- var test = require('tape');
3
-
4
- test('empty or not', function (t) {
5
- var xs = [ 1, 2, 3, 4, 5, 6 ];
6
- var ixes = [];
7
- var ys = concatMap(xs, function (x, ix) {
8
- ixes.push(ix);
9
- return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
10
- });
11
- t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
12
- t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
13
- t.end();
14
- });
15
-
16
- test('always something', function (t) {
17
- var xs = [ 'a', 'b', 'c', 'd' ];
18
- var ys = concatMap(xs, function (x) {
19
- return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
20
- });
21
- t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
22
- t.end();
23
- });
24
-
25
- test('scalars', function (t) {
26
- var xs = [ 'a', 'b', 'c', 'd' ];
27
- var ys = concatMap(xs, function (x) {
28
- return x === 'b' ? [ 'B', 'B', 'B' ] : x;
29
- });
30
- t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
31
- t.end();
32
- });
33
-
34
- test('undefs', function (t) {
35
- var xs = [ 'a', 'b', 'c', 'd' ];
36
- var ys = concatMap(xs, function () {});
37
- t.same(ys, [ undefined, undefined, undefined, undefined ]);
38
- t.end();
39
- });
@@ -1 +0,0 @@
1
- node_modules
@@ -1,6 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 0.4
4
- - 0.6
5
- - 0.8
6
- - 0.10
@@ -1,22 +0,0 @@
1
- Copyright (c) 2012, 2013 Thorsten Lorenz <thlorenz@gmx.de>
2
- Copyright (c) 2012 James Halliday <mail@substack.net>
3
- Copyright (c) 2009 Thomas Robinson <280north.com>
4
-
5
- This software is released under the MIT license:
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy of
8
- this software and associated documentation files (the "Software"), to deal in
9
- the Software without restriction, including without limitation the rights to
10
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11
- the Software, and to permit persons to whom the Software is furnished to do so,
12
- subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,70 +0,0 @@
1
- deep-is
2
- ==========
3
-
4
- Node's `assert.deepEqual() algorithm` as a standalone module. Exactly like
5
- [deep-equal](https://github.com/substack/node-deep-equal) except for the fact that `deepEqual(NaN, NaN) === true`.
6
-
7
- This module is around [5 times faster](https://gist.github.com/2790507)
8
- than wrapping `assert.deepEqual()` in a `try/catch`.
9
-
10
- [![browser support](http://ci.testling.com/thlorenz/deep-is.png)](http://ci.testling.com/thlorenz/deep-is)
11
-
12
- [![build status](https://secure.travis-ci.org/thlorenz/deep-is.png)](http://travis-ci.org/thlorenz/deep-is)
13
-
14
- example
15
- =======
16
-
17
- ``` js
18
- var equal = require('deep-is');
19
- console.dir([
20
- equal(
21
- { a : [ 2, 3 ], b : [ 4 ] },
22
- { a : [ 2, 3 ], b : [ 4 ] }
23
- ),
24
- equal(
25
- { x : 5, y : [6] },
26
- { x : 5, y : 6 }
27
- )
28
- ]);
29
- ```
30
-
31
- methods
32
- =======
33
-
34
- var deepIs = require('deep-is')
35
-
36
- deepIs(a, b)
37
- ---------------
38
-
39
- Compare objects `a` and `b`, returning whether they are equal according to a
40
- recursive equality algorithm.
41
-
42
- install
43
- =======
44
-
45
- With [npm](http://npmjs.org) do:
46
-
47
- ```
48
- npm install deep-is
49
- ```
50
-
51
- test
52
- ====
53
-
54
- With [npm](http://npmjs.org) do:
55
-
56
- ```
57
- npm test
58
- ```
59
-
60
- license
61
- =======
62
-
63
- Copyright (c) 2012, 2013 Thorsten Lorenz <thlorenz@gmx.de>
64
- Copyright (c) 2012 James Halliday <mail@substack.net>
65
-
66
- Derived largely from node's assert module, which has the copyright statement:
67
-
68
- Copyright (c) 2009 Thomas Robinson <280north.com>
69
-
70
- Released under the MIT license, see LICENSE for details.
@@ -1,11 +0,0 @@
1
- var equal = require('../');
2
- console.dir([
3
- equal(
4
- { a : [ 2, 3 ], b : [ 4 ] },
5
- { a : [ 2, 3 ], b : [ 4 ] }
6
- ),
7
- equal(
8
- { x : 5, y : [6] },
9
- { x : 5, y : 6 }
10
- )
11
- ]);
@@ -1,102 +0,0 @@
1
- var pSlice = Array.prototype.slice;
2
- var Object_keys = typeof Object.keys === 'function'
3
- ? Object.keys
4
- : function (obj) {
5
- var keys = [];
6
- for (var key in obj) keys.push(key);
7
- return keys;
8
- }
9
- ;
10
-
11
- var deepEqual = module.exports = function (actual, expected) {
12
- // enforce Object.is +0 !== -0
13
- if (actual === 0 && expected === 0) {
14
- return areZerosEqual(actual, expected);
15
-
16
- // 7.1. All identical values are equivalent, as determined by ===.
17
- } else if (actual === expected) {
18
- return true;
19
-
20
- } else if (actual instanceof Date && expected instanceof Date) {
21
- return actual.getTime() === expected.getTime();
22
-
23
- } else if (isNumberNaN(actual)) {
24
- return isNumberNaN(expected);
25
-
26
- // 7.3. Other pairs that do not both pass typeof value == 'object',
27
- // equivalence is determined by ==.
28
- } else if (typeof actual != 'object' && typeof expected != 'object') {
29
- return actual == expected;
30
-
31
- // 7.4. For all other Object pairs, including Array objects, equivalence is
32
- // determined by having the same number of owned properties (as verified
33
- // with Object.prototype.hasOwnProperty.call), the same set of keys
34
- // (although not necessarily the same order), equivalent values for every
35
- // corresponding key, and an identical 'prototype' property. Note: this
36
- // accounts for both named and indexed properties on Arrays.
37
- } else {
38
- return objEquiv(actual, expected);
39
- }
40
- };
41
-
42
- function isUndefinedOrNull(value) {
43
- return value === null || value === undefined;
44
- }
45
-
46
- function isArguments(object) {
47
- return Object.prototype.toString.call(object) == '[object Arguments]';
48
- }
49
-
50
- function isNumberNaN(value) {
51
- // NaN === NaN -> false
52
- return typeof value == 'number' && value !== value;
53
- }
54
-
55
- function areZerosEqual(zeroA, zeroB) {
56
- // (1 / +0|0) -> Infinity, but (1 / -0) -> -Infinity and (Infinity !== -Infinity)
57
- return (1 / zeroA) === (1 / zeroB);
58
- }
59
-
60
- function objEquiv(a, b) {
61
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
62
- return false;
63
-
64
- // an identical 'prototype' property.
65
- if (a.prototype !== b.prototype) return false;
66
- //~~~I've managed to break Object.keys through screwy arguments passing.
67
- // Converting to array solves the problem.
68
- if (isArguments(a)) {
69
- if (!isArguments(b)) {
70
- return false;
71
- }
72
- a = pSlice.call(a);
73
- b = pSlice.call(b);
74
- return deepEqual(a, b);
75
- }
76
- try {
77
- var ka = Object_keys(a),
78
- kb = Object_keys(b),
79
- key, i;
80
- } catch (e) {//happens when one is a string literal and the other isn't
81
- return false;
82
- }
83
- // having the same number of owned properties (keys incorporates
84
- // hasOwnProperty)
85
- if (ka.length != kb.length)
86
- return false;
87
- //the same set of keys (although not necessarily the same order),
88
- ka.sort();
89
- kb.sort();
90
- //~~~cheap key test
91
- for (i = ka.length - 1; i >= 0; i--) {
92
- if (ka[i] != kb[i])
93
- return false;
94
- }
95
- //equivalent values for every corresponding key, and
96
- //~~~possibly expensive deep test
97
- for (i = ka.length - 1; i >= 0; i--) {
98
- key = ka[i];
99
- if (!deepEqual(a[key], b[key])) return false;
100
- }
101
- return true;
102
- }