protobufjs 6.10.2 → 6.11.2

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 (220) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/bin/pbjs +0 -0
  3. package/bin/pbts +0 -0
  4. package/cli/README.md +163 -0
  5. package/cli/node_modules/.package-lock.json +256 -0
  6. package/cli/node_modules/acorn/CHANGELOG.md +620 -0
  7. package/cli/node_modules/acorn/LICENSE +21 -0
  8. package/cli/node_modules/acorn/README.md +269 -0
  9. package/cli/node_modules/acorn/bin/acorn +4 -0
  10. package/cli/node_modules/acorn/dist/acorn.d.ts +209 -0
  11. package/cli/node_modules/acorn/dist/acorn.js +5186 -0
  12. package/cli/node_modules/acorn/dist/acorn.js.map +1 -0
  13. package/cli/node_modules/acorn/dist/acorn.mjs +5155 -0
  14. package/cli/node_modules/acorn/dist/acorn.mjs.d.ts +2 -0
  15. package/cli/node_modules/acorn/dist/acorn.mjs.map +1 -0
  16. package/cli/node_modules/acorn/dist/bin.js +64 -0
  17. package/cli/node_modules/acorn/package.json +35 -0
  18. package/cli/node_modules/acorn-jsx/LICENSE +19 -0
  19. package/cli/node_modules/acorn-jsx/README.md +40 -0
  20. package/cli/node_modules/acorn-jsx/index.js +488 -0
  21. package/cli/node_modules/acorn-jsx/package.json +27 -0
  22. package/cli/node_modules/acorn-jsx/xhtml.js +255 -0
  23. package/cli/node_modules/balanced-match/.npmignore +5 -0
  24. package/cli/node_modules/balanced-match/LICENSE.md +21 -0
  25. package/cli/node_modules/balanced-match/README.md +91 -0
  26. package/cli/node_modules/balanced-match/index.js +59 -0
  27. package/cli/node_modules/balanced-match/package.json +49 -0
  28. package/cli/node_modules/brace-expansion/LICENSE +21 -0
  29. package/cli/node_modules/brace-expansion/README.md +129 -0
  30. package/cli/node_modules/brace-expansion/index.js +201 -0
  31. package/cli/node_modules/brace-expansion/package.json +47 -0
  32. package/cli/node_modules/concat-map/.travis.yml +4 -0
  33. package/cli/node_modules/concat-map/LICENSE +18 -0
  34. package/cli/node_modules/concat-map/README.markdown +62 -0
  35. package/cli/node_modules/concat-map/example/map.js +6 -0
  36. package/cli/node_modules/concat-map/index.js +13 -0
  37. package/cli/node_modules/concat-map/package.json +43 -0
  38. package/cli/node_modules/concat-map/test/map.js +39 -0
  39. package/cli/node_modules/deep-is/.npmignore +1 -0
  40. package/cli/node_modules/deep-is/.travis.yml +6 -0
  41. package/cli/node_modules/deep-is/LICENSE +22 -0
  42. package/cli/node_modules/deep-is/README.markdown +70 -0
  43. package/cli/node_modules/deep-is/example/cmp.js +11 -0
  44. package/cli/node_modules/deep-is/index.js +102 -0
  45. package/cli/node_modules/deep-is/package.json +61 -0
  46. package/cli/node_modules/deep-is/test/NaN.js +16 -0
  47. package/cli/node_modules/deep-is/test/cmp.js +23 -0
  48. package/cli/node_modules/deep-is/test/neg-vs-pos-0.js +15 -0
  49. package/cli/node_modules/escodegen/LICENSE.BSD +21 -0
  50. package/cli/node_modules/escodegen/README.md +84 -0
  51. package/cli/node_modules/escodegen/bin/escodegen.js +77 -0
  52. package/cli/node_modules/escodegen/bin/esgenerate.js +64 -0
  53. package/cli/node_modules/escodegen/escodegen.js +2647 -0
  54. package/cli/node_modules/escodegen/package.json +62 -0
  55. package/cli/node_modules/eslint-visitor-keys/CHANGELOG.md +25 -0
  56. package/cli/node_modules/eslint-visitor-keys/LICENSE +201 -0
  57. package/cli/node_modules/eslint-visitor-keys/README.md +98 -0
  58. package/cli/node_modules/eslint-visitor-keys/lib/index.js +81 -0
  59. package/cli/node_modules/eslint-visitor-keys/lib/visitor-keys.json +284 -0
  60. package/cli/node_modules/eslint-visitor-keys/package.json +40 -0
  61. package/cli/node_modules/espree/CHANGELOG.md +509 -0
  62. package/cli/node_modules/espree/LICENSE +25 -0
  63. package/cli/node_modules/espree/README.md +233 -0
  64. package/cli/node_modules/espree/espree.js +177 -0
  65. package/cli/node_modules/espree/lib/ast-node-types.js +96 -0
  66. package/cli/node_modules/espree/lib/espree.js +286 -0
  67. package/cli/node_modules/espree/lib/features.js +29 -0
  68. package/cli/node_modules/espree/lib/options.js +106 -0
  69. package/cli/node_modules/espree/lib/token-translator.js +263 -0
  70. package/cli/node_modules/espree/lib/visitor-keys.js +123 -0
  71. package/cli/node_modules/espree/package.json +64 -0
  72. package/cli/node_modules/esprima/ChangeLog +235 -0
  73. package/cli/node_modules/esprima/LICENSE.BSD +21 -0
  74. package/cli/node_modules/esprima/README.md +46 -0
  75. package/cli/node_modules/esprima/bin/esparse.js +139 -0
  76. package/cli/node_modules/esprima/bin/esvalidate.js +236 -0
  77. package/cli/node_modules/esprima/dist/esprima.js +6709 -0
  78. package/cli/node_modules/esprima/package.json +112 -0
  79. package/cli/node_modules/estraverse/.jshintrc +16 -0
  80. package/cli/node_modules/estraverse/LICENSE.BSD +19 -0
  81. package/cli/node_modules/estraverse/README.md +153 -0
  82. package/cli/node_modules/estraverse/estraverse.js +801 -0
  83. package/cli/node_modules/estraverse/gulpfile.js +70 -0
  84. package/cli/node_modules/estraverse/package.json +40 -0
  85. package/cli/node_modules/esutils/LICENSE.BSD +19 -0
  86. package/cli/node_modules/esutils/README.md +174 -0
  87. package/cli/node_modules/esutils/lib/ast.js +144 -0
  88. package/cli/node_modules/esutils/lib/code.js +135 -0
  89. package/cli/node_modules/esutils/lib/keyword.js +165 -0
  90. package/cli/node_modules/esutils/lib/utils.js +33 -0
  91. package/cli/node_modules/esutils/package.json +44 -0
  92. package/cli/node_modules/fast-levenshtein/LICENSE.md +25 -0
  93. package/cli/node_modules/fast-levenshtein/README.md +104 -0
  94. package/cli/node_modules/fast-levenshtein/levenshtein.js +136 -0
  95. package/cli/node_modules/fast-levenshtein/package.json +39 -0
  96. package/cli/node_modules/fs.realpath/LICENSE +43 -0
  97. package/cli/node_modules/fs.realpath/README.md +33 -0
  98. package/cli/node_modules/fs.realpath/index.js +66 -0
  99. package/cli/node_modules/fs.realpath/old.js +303 -0
  100. package/cli/node_modules/fs.realpath/package.json +26 -0
  101. package/cli/node_modules/glob/LICENSE +21 -0
  102. package/cli/node_modules/glob/README.md +375 -0
  103. package/cli/node_modules/glob/changelog.md +67 -0
  104. package/cli/node_modules/glob/common.js +240 -0
  105. package/cli/node_modules/glob/glob.js +790 -0
  106. package/cli/node_modules/glob/package.json +46 -0
  107. package/cli/node_modules/glob/sync.js +486 -0
  108. package/cli/node_modules/inflight/LICENSE +15 -0
  109. package/cli/node_modules/inflight/README.md +37 -0
  110. package/cli/node_modules/inflight/inflight.js +54 -0
  111. package/cli/node_modules/inflight/package.json +29 -0
  112. package/cli/node_modules/inherits/LICENSE +16 -0
  113. package/cli/node_modules/inherits/README.md +42 -0
  114. package/cli/node_modules/inherits/inherits.js +9 -0
  115. package/cli/node_modules/inherits/inherits_browser.js +27 -0
  116. package/cli/node_modules/inherits/package.json +29 -0
  117. package/cli/node_modules/levn/LICENSE +22 -0
  118. package/cli/node_modules/levn/README.md +196 -0
  119. package/cli/node_modules/levn/lib/cast.js +298 -0
  120. package/cli/node_modules/levn/lib/coerce.js +285 -0
  121. package/cli/node_modules/levn/lib/index.js +22 -0
  122. package/cli/node_modules/levn/lib/parse-string.js +113 -0
  123. package/cli/node_modules/levn/lib/parse.js +102 -0
  124. package/cli/node_modules/levn/package.json +47 -0
  125. package/cli/node_modules/minimatch/LICENSE +15 -0
  126. package/cli/node_modules/minimatch/README.md +209 -0
  127. package/cli/node_modules/minimatch/minimatch.js +923 -0
  128. package/cli/node_modules/minimatch/package.json +30 -0
  129. package/cli/node_modules/once/LICENSE +15 -0
  130. package/cli/node_modules/once/README.md +79 -0
  131. package/cli/node_modules/once/once.js +42 -0
  132. package/cli/node_modules/once/package.json +33 -0
  133. package/cli/node_modules/optionator/CHANGELOG.md +56 -0
  134. package/cli/node_modules/optionator/LICENSE +22 -0
  135. package/cli/node_modules/optionator/README.md +238 -0
  136. package/cli/node_modules/optionator/lib/help.js +260 -0
  137. package/cli/node_modules/optionator/lib/index.js +465 -0
  138. package/cli/node_modules/optionator/lib/util.js +54 -0
  139. package/cli/node_modules/optionator/package.json +44 -0
  140. package/cli/node_modules/path-is-absolute/index.js +20 -0
  141. package/cli/node_modules/path-is-absolute/license +21 -0
  142. package/cli/node_modules/path-is-absolute/package.json +43 -0
  143. package/cli/node_modules/path-is-absolute/readme.md +59 -0
  144. package/cli/node_modules/prelude-ls/CHANGELOG.md +99 -0
  145. package/cli/node_modules/prelude-ls/LICENSE +22 -0
  146. package/cli/node_modules/prelude-ls/README.md +15 -0
  147. package/cli/node_modules/prelude-ls/lib/Func.js +65 -0
  148. package/cli/node_modules/prelude-ls/lib/List.js +686 -0
  149. package/cli/node_modules/prelude-ls/lib/Num.js +130 -0
  150. package/cli/node_modules/prelude-ls/lib/Obj.js +154 -0
  151. package/cli/node_modules/prelude-ls/lib/Str.js +92 -0
  152. package/cli/node_modules/prelude-ls/lib/index.js +178 -0
  153. package/cli/node_modules/prelude-ls/package.json +52 -0
  154. package/cli/node_modules/rimraf/CHANGELOG.md +65 -0
  155. package/cli/node_modules/rimraf/LICENSE +15 -0
  156. package/cli/node_modules/rimraf/README.md +101 -0
  157. package/cli/node_modules/rimraf/bin.js +68 -0
  158. package/cli/node_modules/rimraf/package.json +32 -0
  159. package/cli/node_modules/rimraf/rimraf.js +360 -0
  160. package/cli/node_modules/source-map/CHANGELOG.md +301 -0
  161. package/cli/node_modules/source-map/LICENSE +28 -0
  162. package/cli/node_modules/source-map/README.md +742 -0
  163. package/cli/node_modules/source-map/dist/source-map.debug.js +3234 -0
  164. package/cli/node_modules/source-map/dist/source-map.js +3233 -0
  165. package/cli/node_modules/source-map/dist/source-map.min.js +2 -0
  166. package/cli/node_modules/source-map/dist/source-map.min.js.map +1 -0
  167. package/cli/node_modules/source-map/lib/array-set.js +121 -0
  168. package/cli/node_modules/source-map/lib/base64-vlq.js +140 -0
  169. package/cli/node_modules/source-map/lib/base64.js +67 -0
  170. package/cli/node_modules/source-map/lib/binary-search.js +111 -0
  171. package/cli/node_modules/source-map/lib/mapping-list.js +79 -0
  172. package/cli/node_modules/source-map/lib/quick-sort.js +114 -0
  173. package/cli/node_modules/source-map/lib/source-map-consumer.js +1145 -0
  174. package/cli/node_modules/source-map/lib/source-map-generator.js +425 -0
  175. package/cli/node_modules/source-map/lib/source-node.js +413 -0
  176. package/cli/node_modules/source-map/lib/util.js +488 -0
  177. package/cli/node_modules/source-map/package.json +73 -0
  178. package/cli/node_modules/source-map/source-map.d.ts +98 -0
  179. package/cli/node_modules/source-map/source-map.js +8 -0
  180. package/cli/node_modules/tmp/CHANGELOG.md +288 -0
  181. package/cli/node_modules/tmp/LICENSE +21 -0
  182. package/cli/node_modules/tmp/README.md +365 -0
  183. package/cli/node_modules/tmp/lib/tmp.js +780 -0
  184. package/cli/node_modules/tmp/package.json +58 -0
  185. package/cli/node_modules/type-check/LICENSE +22 -0
  186. package/cli/node_modules/type-check/README.md +210 -0
  187. package/cli/node_modules/type-check/lib/check.js +126 -0
  188. package/cli/node_modules/type-check/lib/index.js +16 -0
  189. package/cli/node_modules/type-check/lib/parse-type.js +196 -0
  190. package/cli/node_modules/type-check/package.json +40 -0
  191. package/cli/node_modules/word-wrap/LICENSE +21 -0
  192. package/cli/node_modules/word-wrap/README.md +182 -0
  193. package/cli/node_modules/word-wrap/index.d.ts +50 -0
  194. package/cli/node_modules/word-wrap/index.js +46 -0
  195. package/cli/node_modules/word-wrap/package.json +77 -0
  196. package/cli/node_modules/wrappy/LICENSE +15 -0
  197. package/cli/node_modules/wrappy/README.md +36 -0
  198. package/cli/node_modules/wrappy/package.json +29 -0
  199. package/cli/node_modules/wrappy/wrappy.js +33 -0
  200. package/cli/package.json +1 -0
  201. package/cli/pbjs.js +3 -1
  202. package/cli/targets/static.js +7 -1
  203. package/dist/light/protobuf.js +17 -5
  204. package/dist/light/protobuf.js.map +1 -1
  205. package/dist/light/protobuf.min.js +3 -3
  206. package/dist/light/protobuf.min.js.map +1 -1
  207. package/dist/minimal/protobuf.js +2 -2
  208. package/dist/minimal/protobuf.min.js +3 -3
  209. package/dist/minimal/protobuf.min.js.map +1 -1
  210. package/dist/protobuf.js +54 -9
  211. package/dist/protobuf.js.map +1 -1
  212. package/dist/protobuf.min.js +3 -3
  213. package/dist/protobuf.min.js.map +1 -1
  214. package/index.d.ts +11 -1
  215. package/package.json +2 -2
  216. package/src/field.js +3 -0
  217. package/src/namespace.js +2 -1
  218. package/src/parse.js +37 -4
  219. package/package-lock.json +0 -8922
  220. package/scripts/changelog.js +0 -150
@@ -0,0 +1,165 @@
1
+ /*
2
+ Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
17
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+ */
24
+
25
+ (function () {
26
+ 'use strict';
27
+
28
+ var code = require('./code');
29
+
30
+ function isStrictModeReservedWordES6(id) {
31
+ switch (id) {
32
+ case 'implements':
33
+ case 'interface':
34
+ case 'package':
35
+ case 'private':
36
+ case 'protected':
37
+ case 'public':
38
+ case 'static':
39
+ case 'let':
40
+ return true;
41
+ default:
42
+ return false;
43
+ }
44
+ }
45
+
46
+ function isKeywordES5(id, strict) {
47
+ // yield should not be treated as keyword under non-strict mode.
48
+ if (!strict && id === 'yield') {
49
+ return false;
50
+ }
51
+ return isKeywordES6(id, strict);
52
+ }
53
+
54
+ function isKeywordES6(id, strict) {
55
+ if (strict && isStrictModeReservedWordES6(id)) {
56
+ return true;
57
+ }
58
+
59
+ switch (id.length) {
60
+ case 2:
61
+ return (id === 'if') || (id === 'in') || (id === 'do');
62
+ case 3:
63
+ return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
64
+ case 4:
65
+ return (id === 'this') || (id === 'else') || (id === 'case') ||
66
+ (id === 'void') || (id === 'with') || (id === 'enum');
67
+ case 5:
68
+ return (id === 'while') || (id === 'break') || (id === 'catch') ||
69
+ (id === 'throw') || (id === 'const') || (id === 'yield') ||
70
+ (id === 'class') || (id === 'super');
71
+ case 6:
72
+ return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
73
+ (id === 'switch') || (id === 'export') || (id === 'import');
74
+ case 7:
75
+ return (id === 'default') || (id === 'finally') || (id === 'extends');
76
+ case 8:
77
+ return (id === 'function') || (id === 'continue') || (id === 'debugger');
78
+ case 10:
79
+ return (id === 'instanceof');
80
+ default:
81
+ return false;
82
+ }
83
+ }
84
+
85
+ function isReservedWordES5(id, strict) {
86
+ return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
87
+ }
88
+
89
+ function isReservedWordES6(id, strict) {
90
+ return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
91
+ }
92
+
93
+ function isRestrictedWord(id) {
94
+ return id === 'eval' || id === 'arguments';
95
+ }
96
+
97
+ function isIdentifierNameES5(id) {
98
+ var i, iz, ch;
99
+
100
+ if (id.length === 0) { return false; }
101
+
102
+ ch = id.charCodeAt(0);
103
+ if (!code.isIdentifierStartES5(ch)) {
104
+ return false;
105
+ }
106
+
107
+ for (i = 1, iz = id.length; i < iz; ++i) {
108
+ ch = id.charCodeAt(i);
109
+ if (!code.isIdentifierPartES5(ch)) {
110
+ return false;
111
+ }
112
+ }
113
+ return true;
114
+ }
115
+
116
+ function decodeUtf16(lead, trail) {
117
+ return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
118
+ }
119
+
120
+ function isIdentifierNameES6(id) {
121
+ var i, iz, ch, lowCh, check;
122
+
123
+ if (id.length === 0) { return false; }
124
+
125
+ check = code.isIdentifierStartES6;
126
+ for (i = 0, iz = id.length; i < iz; ++i) {
127
+ ch = id.charCodeAt(i);
128
+ if (0xD800 <= ch && ch <= 0xDBFF) {
129
+ ++i;
130
+ if (i >= iz) { return false; }
131
+ lowCh = id.charCodeAt(i);
132
+ if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
133
+ return false;
134
+ }
135
+ ch = decodeUtf16(ch, lowCh);
136
+ }
137
+ if (!check(ch)) {
138
+ return false;
139
+ }
140
+ check = code.isIdentifierPartES6;
141
+ }
142
+ return true;
143
+ }
144
+
145
+ function isIdentifierES5(id, strict) {
146
+ return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
147
+ }
148
+
149
+ function isIdentifierES6(id, strict) {
150
+ return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
151
+ }
152
+
153
+ module.exports = {
154
+ isKeywordES5: isKeywordES5,
155
+ isKeywordES6: isKeywordES6,
156
+ isReservedWordES5: isReservedWordES5,
157
+ isReservedWordES6: isReservedWordES6,
158
+ isRestrictedWord: isRestrictedWord,
159
+ isIdentifierNameES5: isIdentifierNameES5,
160
+ isIdentifierNameES6: isIdentifierNameES6,
161
+ isIdentifierES5: isIdentifierES5,
162
+ isIdentifierES6: isIdentifierES6
163
+ };
164
+ }());
165
+ /* vim: set sw=4 ts=4 et tw=80 : */
@@ -0,0 +1,33 @@
1
+ /*
2
+ Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
17
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+ */
24
+
25
+
26
+ (function () {
27
+ 'use strict';
28
+
29
+ exports.ast = require('./ast');
30
+ exports.code = require('./code');
31
+ exports.keyword = require('./keyword');
32
+ }());
33
+ /* vim: set sw=4 ts=4 et tw=80 : */
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "esutils",
3
+ "description": "utility box for ECMAScript language tools",
4
+ "homepage": "https://github.com/estools/esutils",
5
+ "main": "lib/utils.js",
6
+ "version": "2.0.3",
7
+ "engines": {
8
+ "node": ">=0.10.0"
9
+ },
10
+ "directories": {
11
+ "lib": "./lib"
12
+ },
13
+ "files": [
14
+ "LICENSE.BSD",
15
+ "README.md",
16
+ "lib"
17
+ ],
18
+ "maintainers": [
19
+ {
20
+ "name": "Yusuke Suzuki",
21
+ "email": "utatane.tea@gmail.com",
22
+ "web": "http://github.com/Constellation"
23
+ }
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "http://github.com/estools/esutils.git"
28
+ },
29
+ "devDependencies": {
30
+ "chai": "~1.7.2",
31
+ "coffee-script": "~1.6.3",
32
+ "jshint": "2.6.3",
33
+ "mocha": "~2.2.1",
34
+ "regenerate": "~1.3.1",
35
+ "unicode-9.0.0": "~0.7.0"
36
+ },
37
+ "license": "BSD-2-Clause",
38
+ "scripts": {
39
+ "test": "npm run-script lint && npm run-script unit-test",
40
+ "lint": "jshint lib/*.js",
41
+ "unit-test": "mocha --compilers coffee:coffee-script -R spec",
42
+ "generate-regex": "node tools/generate-identifier-regex.js"
43
+ }
44
+ }
@@ -0,0 +1,25 @@
1
+ (MIT License)
2
+
3
+ Copyright (c) 2013 [Ramesh Nair](http://www.hiddentao.com/)
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
25
+
@@ -0,0 +1,104 @@
1
+ # fast-levenshtein - Levenshtein algorithm in Javascript
2
+
3
+ [![Build Status](https://secure.travis-ci.org/hiddentao/fast-levenshtein.png)](http://travis-ci.org/hiddentao/fast-levenshtein)
4
+ [![NPM module](https://badge.fury.io/js/fast-levenshtein.png)](https://badge.fury.io/js/fast-levenshtein)
5
+ [![NPM downloads](https://img.shields.io/npm/dm/fast-levenshtein.svg?maxAge=2592000)](https://www.npmjs.com/package/fast-levenshtein)
6
+ [![Follow on Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/hiddentao)
7
+
8
+ An efficient Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with locale-specific collator support.
9
+
10
+ ## Features
11
+
12
+ * Works in node.js and in the browser.
13
+ * Better performance than other implementations by not needing to store the whole matrix ([more info](http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm)).
14
+ * Locale-sensitive string comparisions if needed.
15
+ * Comprehensive test suite and performance benchmark.
16
+ * Small: <1 KB minified and gzipped
17
+
18
+ ## Installation
19
+
20
+ ### node.js
21
+
22
+ Install using [npm](http://npmjs.org/):
23
+
24
+ ```bash
25
+ $ npm install fast-levenshtein
26
+ ```
27
+
28
+ ### Browser
29
+
30
+ Using bower:
31
+
32
+ ```bash
33
+ $ bower install fast-levenshtein
34
+ ```
35
+
36
+ If you are not using any module loader system then the API will then be accessible via the `window.Levenshtein` object.
37
+
38
+ ## Examples
39
+
40
+ **Default usage**
41
+
42
+ ```javascript
43
+ var levenshtein = require('fast-levenshtein');
44
+
45
+ var distance = levenshtein.get('back', 'book'); // 2
46
+ var distance = levenshtein.get('我愛你', '我叫你'); // 1
47
+ ```
48
+
49
+ **Locale-sensitive string comparisons**
50
+
51
+ It supports using [Intl.Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) for locale-sensitive string comparisons:
52
+
53
+ ```javascript
54
+ var levenshtein = require('fast-levenshtein');
55
+
56
+ levenshtein.get('mikailovitch', 'Mikhaïlovitch', { useCollator: true});
57
+ // 1
58
+ ```
59
+
60
+ ## Building and Testing
61
+
62
+ To build the code and run the tests:
63
+
64
+ ```bash
65
+ $ npm install -g grunt-cli
66
+ $ npm install
67
+ $ npm run build
68
+ ```
69
+
70
+ ## Performance
71
+
72
+ _Thanks to [Titus Wormer](https://github.com/wooorm) for [encouraging me](https://github.com/hiddentao/fast-levenshtein/issues/1) to do this._
73
+
74
+ Benchmarked against other node.js levenshtein distance modules (on Macbook Air 2012, Core i7, 8GB RAM):
75
+
76
+ ```bash
77
+ Running suite Implementation comparison [benchmark/speed.js]...
78
+ >> levenshtein-edit-distance x 234 ops/sec ±3.02% (73 runs sampled)
79
+ >> levenshtein-component x 422 ops/sec ±4.38% (83 runs sampled)
80
+ >> levenshtein-deltas x 283 ops/sec ±3.83% (78 runs sampled)
81
+ >> natural x 255 ops/sec ±0.76% (88 runs sampled)
82
+ >> levenshtein x 180 ops/sec ±3.55% (86 runs sampled)
83
+ >> fast-levenshtein x 1,792 ops/sec ±2.72% (95 runs sampled)
84
+ Benchmark done.
85
+ Fastest test is fast-levenshtein at 4.2x faster than levenshtein-component
86
+ ```
87
+
88
+ You can run this benchmark yourself by doing:
89
+
90
+ ```bash
91
+ $ npm install
92
+ $ npm run build
93
+ $ npm run benchmark
94
+ ```
95
+
96
+ ## Contributing
97
+
98
+ If you wish to submit a pull request please update and/or create new tests for any changes you make and ensure the grunt build passes.
99
+
100
+ See [CONTRIBUTING.md](https://github.com/hiddentao/fast-levenshtein/blob/master/CONTRIBUTING.md) for details.
101
+
102
+ ## License
103
+
104
+ MIT - see [LICENSE.md](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md)
@@ -0,0 +1,136 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ var collator;
5
+ try {
6
+ collator = (typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined") ? Intl.Collator("generic", { sensitivity: "base" }) : null;
7
+ } catch (err){
8
+ console.log("Collator could not be initialized and wouldn't be used");
9
+ }
10
+ // arrays to re-use
11
+ var prevRow = [],
12
+ str2Char = [];
13
+
14
+ /**
15
+ * Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance.
16
+ */
17
+ var Levenshtein = {
18
+ /**
19
+ * Calculate levenshtein distance of the two strings.
20
+ *
21
+ * @param str1 String the first string.
22
+ * @param str2 String the second string.
23
+ * @param [options] Additional options.
24
+ * @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
25
+ * @return Integer the levenshtein distance (0 and above).
26
+ */
27
+ get: function(str1, str2, options) {
28
+ var useCollator = (options && collator && options.useCollator);
29
+
30
+ var str1Len = str1.length,
31
+ str2Len = str2.length;
32
+
33
+ // base cases
34
+ if (str1Len === 0) return str2Len;
35
+ if (str2Len === 0) return str1Len;
36
+
37
+ // two rows
38
+ var curCol, nextCol, i, j, tmp;
39
+
40
+ // initialise previous row
41
+ for (i=0; i<str2Len; ++i) {
42
+ prevRow[i] = i;
43
+ str2Char[i] = str2.charCodeAt(i);
44
+ }
45
+ prevRow[str2Len] = str2Len;
46
+
47
+ var strCmp;
48
+ if (useCollator) {
49
+ // calculate current row distance from previous row using collator
50
+ for (i = 0; i < str1Len; ++i) {
51
+ nextCol = i + 1;
52
+
53
+ for (j = 0; j < str2Len; ++j) {
54
+ curCol = nextCol;
55
+
56
+ // substution
57
+ strCmp = 0 === collator.compare(str1.charAt(i), String.fromCharCode(str2Char[j]));
58
+
59
+ nextCol = prevRow[j] + (strCmp ? 0 : 1);
60
+
61
+ // insertion
62
+ tmp = curCol + 1;
63
+ if (nextCol > tmp) {
64
+ nextCol = tmp;
65
+ }
66
+ // deletion
67
+ tmp = prevRow[j + 1] + 1;
68
+ if (nextCol > tmp) {
69
+ nextCol = tmp;
70
+ }
71
+
72
+ // copy current col value into previous (in preparation for next iteration)
73
+ prevRow[j] = curCol;
74
+ }
75
+
76
+ // copy last col value into previous (in preparation for next iteration)
77
+ prevRow[j] = nextCol;
78
+ }
79
+ }
80
+ else {
81
+ // calculate current row distance from previous row without collator
82
+ for (i = 0; i < str1Len; ++i) {
83
+ nextCol = i + 1;
84
+
85
+ for (j = 0; j < str2Len; ++j) {
86
+ curCol = nextCol;
87
+
88
+ // substution
89
+ strCmp = str1.charCodeAt(i) === str2Char[j];
90
+
91
+ nextCol = prevRow[j] + (strCmp ? 0 : 1);
92
+
93
+ // insertion
94
+ tmp = curCol + 1;
95
+ if (nextCol > tmp) {
96
+ nextCol = tmp;
97
+ }
98
+ // deletion
99
+ tmp = prevRow[j + 1] + 1;
100
+ if (nextCol > tmp) {
101
+ nextCol = tmp;
102
+ }
103
+
104
+ // copy current col value into previous (in preparation for next iteration)
105
+ prevRow[j] = curCol;
106
+ }
107
+
108
+ // copy last col value into previous (in preparation for next iteration)
109
+ prevRow[j] = nextCol;
110
+ }
111
+ }
112
+ return nextCol;
113
+ }
114
+
115
+ };
116
+
117
+ // amd
118
+ if (typeof define !== "undefined" && define !== null && define.amd) {
119
+ define(function() {
120
+ return Levenshtein;
121
+ });
122
+ }
123
+ // commonjs
124
+ else if (typeof module !== "undefined" && module !== null && typeof exports !== "undefined" && module.exports === exports) {
125
+ module.exports = Levenshtein;
126
+ }
127
+ // web worker
128
+ else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') {
129
+ self.Levenshtein = Levenshtein;
130
+ }
131
+ // browser main thread
132
+ else if (typeof window !== "undefined" && window !== null) {
133
+ window.Levenshtein = Levenshtein;
134
+ }
135
+ }());
136
+
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "fast-levenshtein",
3
+ "version": "2.0.6",
4
+ "description": "Efficient implementation of Levenshtein algorithm with locale-specific collator support.",
5
+ "main": "levenshtein.js",
6
+ "files": [
7
+ "levenshtein.js"
8
+ ],
9
+ "scripts": {
10
+ "build": "grunt build",
11
+ "prepublish": "npm run build",
12
+ "benchmark": "grunt benchmark",
13
+ "test": "mocha"
14
+ },
15
+ "devDependencies": {
16
+ "chai": "~1.5.0",
17
+ "grunt": "~0.4.1",
18
+ "grunt-benchmark": "~0.2.0",
19
+ "grunt-cli": "^1.2.0",
20
+ "grunt-contrib-jshint": "~0.4.3",
21
+ "grunt-contrib-uglify": "~0.2.0",
22
+ "grunt-mocha-test": "~0.2.2",
23
+ "grunt-npm-install": "~0.1.0",
24
+ "load-grunt-tasks": "~0.6.0",
25
+ "lodash": "^4.0.1",
26
+ "mocha": "~1.9.0"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/hiddentao/fast-levenshtein.git"
31
+ },
32
+ "keywords": [
33
+ "levenshtein",
34
+ "distance",
35
+ "string"
36
+ ],
37
+ "author": "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)",
38
+ "license": "MIT"
39
+ }
@@ -0,0 +1,43 @@
1
+ The ISC License
2
+
3
+ Copyright (c) Isaac Z. Schlueter and Contributors
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
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ ----
18
+
19
+ This library bundles a version of the `fs.realpath` and `fs.realpathSync`
20
+ methods from Node.js v0.10 under the terms of the Node.js MIT license.
21
+
22
+ Node's license follows, also included at the header of `old.js` which contains
23
+ the licensed code:
24
+
25
+ Copyright Joyent, Inc. and other Node contributors.
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a
28
+ copy of this software and associated documentation files (the "Software"),
29
+ to deal in the Software without restriction, including without limitation
30
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
31
+ and/or sell copies of the Software, and to permit persons to whom the
32
+ Software is furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in
35
+ all copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
43
+ DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # fs.realpath
2
+
3
+ A backwards-compatible fs.realpath for Node v6 and above
4
+
5
+ In Node v6, the JavaScript implementation of fs.realpath was replaced
6
+ with a faster (but less resilient) native implementation. That raises
7
+ new and platform-specific errors and cannot handle long or excessively
8
+ symlink-looping paths.
9
+
10
+ This module handles those cases by detecting the new errors and
11
+ falling back to the JavaScript implementation. On versions of Node
12
+ prior to v6, it has no effect.
13
+
14
+ ## USAGE
15
+
16
+ ```js
17
+ var rp = require('fs.realpath')
18
+
19
+ // async version
20
+ rp.realpath(someLongAndLoopingPath, function (er, real) {
21
+ // the ELOOP was handled, but it was a bit slower
22
+ })
23
+
24
+ // sync version
25
+ var real = rp.realpathSync(someLongAndLoopingPath)
26
+
27
+ // monkeypatch at your own risk!
28
+ // This replaces the fs.realpath/fs.realpathSync builtins
29
+ rp.monkeypatch()
30
+
31
+ // un-do the monkeypatching
32
+ rp.unmonkeypatch()
33
+ ```
@@ -0,0 +1,66 @@
1
+ module.exports = realpath
2
+ realpath.realpath = realpath
3
+ realpath.sync = realpathSync
4
+ realpath.realpathSync = realpathSync
5
+ realpath.monkeypatch = monkeypatch
6
+ realpath.unmonkeypatch = unmonkeypatch
7
+
8
+ var fs = require('fs')
9
+ var origRealpath = fs.realpath
10
+ var origRealpathSync = fs.realpathSync
11
+
12
+ var version = process.version
13
+ var ok = /^v[0-5]\./.test(version)
14
+ var old = require('./old.js')
15
+
16
+ function newError (er) {
17
+ return er && er.syscall === 'realpath' && (
18
+ er.code === 'ELOOP' ||
19
+ er.code === 'ENOMEM' ||
20
+ er.code === 'ENAMETOOLONG'
21
+ )
22
+ }
23
+
24
+ function realpath (p, cache, cb) {
25
+ if (ok) {
26
+ return origRealpath(p, cache, cb)
27
+ }
28
+
29
+ if (typeof cache === 'function') {
30
+ cb = cache
31
+ cache = null
32
+ }
33
+ origRealpath(p, cache, function (er, result) {
34
+ if (newError(er)) {
35
+ old.realpath(p, cache, cb)
36
+ } else {
37
+ cb(er, result)
38
+ }
39
+ })
40
+ }
41
+
42
+ function realpathSync (p, cache) {
43
+ if (ok) {
44
+ return origRealpathSync(p, cache)
45
+ }
46
+
47
+ try {
48
+ return origRealpathSync(p, cache)
49
+ } catch (er) {
50
+ if (newError(er)) {
51
+ return old.realpathSync(p, cache)
52
+ } else {
53
+ throw er
54
+ }
55
+ }
56
+ }
57
+
58
+ function monkeypatch () {
59
+ fs.realpath = realpath
60
+ fs.realpathSync = realpathSync
61
+ }
62
+
63
+ function unmonkeypatch () {
64
+ fs.realpath = origRealpath
65
+ fs.realpathSync = origRealpathSync
66
+ }