step-node-agent 3.24.4 → 3.24.6

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 (52) hide show
  1. package/node_modules/aws4/aws4.js +1 -1
  2. package/node_modules/aws4/package.json +7 -3
  3. package/node_modules/cookie/HISTORY.md +10 -5
  4. package/node_modules/cookie/README.md +63 -48
  5. package/node_modules/cookie/index.js +5 -1
  6. package/node_modules/cookie/package.json +5 -5
  7. package/node_modules/express/History.md +19 -1
  8. package/node_modules/express/lib/response.js +12 -3
  9. package/node_modules/express/package.json +2 -2
  10. package/node_modules/unzip-stream/lib/unzip-stream.js +2 -2
  11. package/node_modules/unzip-stream/package.json +1 -1
  12. package/package.json +1 -1
  13. package/node_modules/abbrev/LICENSE +0 -46
  14. package/node_modules/abbrev/README.md +0 -23
  15. package/node_modules/abbrev/abbrev.js +0 -61
  16. package/node_modules/abbrev/package.json +0 -21
  17. package/node_modules/aws4/.github/FUNDING.yml +0 -3
  18. package/node_modules/aws4/.travis.yml +0 -9
  19. package/node_modules/nopt/.npmignore +0 -0
  20. package/node_modules/nopt/LICENSE +0 -23
  21. package/node_modules/nopt/README.md +0 -208
  22. package/node_modules/nopt/bin/nopt.js +0 -44
  23. package/node_modules/nopt/examples/my-program.js +0 -30
  24. package/node_modules/nopt/lib/nopt.js +0 -552
  25. package/node_modules/nopt/package.json +0 -12
  26. package/node_modules/unzip-stream/.travis.yml +0 -9
  27. package/node_modules/unzip-stream/aa.zip +0 -0
  28. package/node_modules/unzip-stream/test.js +0 -29
  29. package/node_modules/unzip-stream/testData-golang/crc32-not-streamed.zip +0 -0
  30. package/node_modules/unzip-stream/testData-golang/dd.zip +0 -0
  31. package/node_modules/unzip-stream/testData-golang/go-no-datadesc-sig.zip +0 -0
  32. package/node_modules/unzip-stream/testData-golang/go-with-datadesc-sig.zip +0 -0
  33. package/node_modules/unzip-stream/testData-golang/readme.zip +0 -0
  34. package/node_modules/unzip-stream/testData-golang/symlink.zip +0 -0
  35. package/node_modules/unzip-stream/testData-golang/test-trailing-junk.zip +0 -0
  36. package/node_modules/unzip-stream/testData-golang/test.zip +0 -0
  37. package/node_modules/unzip-stream/testData-golang/unix.zip +0 -0
  38. package/node_modules/unzip-stream/testData-golang/winxp.zip +0 -0
  39. package/node_modules/unzip-stream/testData-golang/zip64-2.zip +0 -0
  40. package/node_modules/unzip-stream/testData-golang/zip64.zip +0 -0
  41. package/node_modules/unzip-stream/testData-php/cd-gap.zip +0 -0
  42. package/node_modules/unzip-stream/testData-php/cd-truncated.zip +0 -0
  43. package/node_modules/unzip-stream/testData-php/class-trailing-null.zip +0 -0
  44. package/node_modules/unzip-stream/testData-php/class-trailing-slash.zip +0 -0
  45. package/node_modules/unzip-stream/testData-php/class.zip +0 -0
  46. package/node_modules/unzip-stream/testData-php/empty.zip +0 -0
  47. package/node_modules/unzip-stream/testData-php/looks-like-zip64.zip +0 -0
  48. package/node_modules/unzip-stream/testData-php/nosig.zip +0 -0
  49. package/node_modules/unzip-stream/testData-php/split.zip +0 -0
  50. package/node_modules/unzip-stream/testData-php/trail.zip +0 -0
  51. package/node_modules/unzip-stream/testData-php/wrong-cd-start-disk.zip +0 -0
  52. package/node_modules/unzip-stream/testData-php/wrong-central-entry-sig.zip +0 -0
@@ -46,7 +46,7 @@ function RequestSigner(request, credentials) {
46
46
 
47
47
  if (typeof request === 'string') request = url.parse(request)
48
48
 
49
- var headers = request.headers = (request.headers || {}),
49
+ var headers = request.headers = Object.assign({}, (request.headers || {})),
50
50
  hostParts = (!this.service || !this.region) && this.matchHost(request.hostname || request.host || headers.Host || headers.host)
51
51
 
52
52
  this.request = request
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "aws4",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Signs and prepares requests using AWS Signature Version 4",
5
5
  "author": "Michael Hart <michael.hart.au@gmail.com> (https://github.com/mhart)",
6
6
  "license": "MIT",
7
7
  "repository": "github:mhart/aws4",
8
8
  "main": "aws4.js",
9
+ "files": [
10
+ "aws4.js",
11
+ "lru.js"
12
+ ],
9
13
  "scripts": {
10
14
  "test": "mocha ./test/fast.js -R list",
11
15
  "integration": "node ./test/slow.js"
12
16
  },
13
17
  "devDependencies": {
14
- "mocha": "^2.5.3",
15
- "should": "^8.4.0"
18
+ "mocha": "^10.4.0",
19
+ "should": "^13.2.3"
16
20
  }
17
21
  }
@@ -1,16 +1,21 @@
1
+ 0.6.0 / 2023-11-06
2
+ ==================
3
+
4
+ * Add `partitioned` option
5
+
1
6
  0.5.0 / 2022-04-11
2
7
  ==================
3
8
 
4
9
  * Add `priority` option
5
10
  * Fix `expires` option to reject invalid dates
6
- * pref: improve default decode speed
7
- * pref: remove slow string split in parse
11
+ * perf: improve default decode speed
12
+ * perf: remove slow string split in parse
8
13
 
9
14
  0.4.2 / 2022-02-02
10
15
  ==================
11
16
 
12
- * pref: read value only when assigning in parse
13
- * pref: remove unnecessary regexp in parse
17
+ * perf: read value only when assigning in parse
18
+ * perf: remove unnecessary regexp in parse
14
19
 
15
20
  0.4.1 / 2020-04-21
16
21
  ==================
@@ -41,7 +46,7 @@
41
46
 
42
47
  * perf: enable strict mode
43
48
  * perf: use for loop in parse
44
- * perf: use string concatination for serialization
49
+ * perf: use string concatenation for serialization
45
50
 
46
51
  0.2.3 / 2015-10-25
47
52
  ==================
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![NPM Version][npm-version-image]][npm-url]
4
4
  [![NPM Downloads][npm-downloads-image]][npm-url]
5
- [![Node.js Version][node-version-image]][node-version-url]
6
- [![Build Status][github-actions-ci-image]][github-actions-ci-url]
7
- [![Test Coverage][coveralls-image]][coveralls-url]
5
+ [![Node.js Version][node-image]][node-url]
6
+ [![Build Status][ci-image]][ci-url]
7
+ [![Coverage Status][coveralls-image]][coveralls-url]
8
8
 
9
9
  Basic HTTP cookie parser and serializer for HTTP servers.
10
10
 
@@ -107,6 +107,17 @@ The given number will be converted to an integer by rounding down. By default, n
107
107
  `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
108
108
  so if both are set, they should point to the same date and time.
109
109
 
110
+ ##### partitioned
111
+
112
+ Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies)
113
+ attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
114
+ `Partitioned` attribute is not set.
115
+
116
+ **note** This is an attribute that has not yet been fully standardized, and may change in the future.
117
+ This also means many clients may ignore this attribute until they understand it.
118
+
119
+ More information about can be found in [the proposal](https://github.com/privacycg/CHIPS).
120
+
110
121
  ##### path
111
122
 
112
123
  Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path
@@ -212,49 +223,52 @@ $ npm test
212
223
  ```
213
224
  $ npm run bench
214
225
 
215
- > cookie@0.4.2 bench
226
+ > cookie@0.5.0 bench
216
227
  > node benchmark/index.js
217
228
 
218
- node@16.14.0
219
- v8@9.4.146.24-node.20
220
- uv@1.43.0
221
- zlib@1.2.11
229
+ node@18.18.2
230
+ acorn@8.10.0
231
+ ada@2.6.0
232
+ ares@1.19.1
222
233
  brotli@1.0.9
223
- ares@1.18.1
224
- modules@93
225
- nghttp2@1.45.1
226
- napi@8
227
- llhttp@6.0.4
228
- openssl@1.1.1m+quic
229
- cldr@40.0
230
- icu@70.1
231
- tz@2021a3
232
- unicode@14.0
233
- ngtcp2@0.1.0-DEV
234
- nghttp3@0.1.0-DEV
234
+ cldr@43.1
235
+ icu@73.2
236
+ llhttp@6.0.11
237
+ modules@108
238
+ napi@9
239
+ nghttp2@1.57.0
240
+ nghttp3@0.7.0
241
+ ngtcp2@0.8.1
242
+ openssl@3.0.10+quic
243
+ simdutf@3.2.14
244
+ tz@2023c
245
+ undici@5.26.3
246
+ unicode@15.0
247
+ uv@1.44.2
248
+ uvwasi@0.0.18
249
+ v8@10.2.154.26-node.26
250
+ zlib@1.2.13.1-motley
235
251
 
236
252
  > node benchmark/parse-top.js
237
253
 
238
254
  cookie.parse - top sites
239
255
 
240
- 15 tests completed.
241
-
242
- parse accounts.google.com x 2,421,245 ops/sec ±0.80% (188 runs sampled)
243
- parse apple.com x 2,684,710 ops/sec ±0.59% (189 runs sampled)
244
- parse cloudflare.com x 2,231,418 ops/sec ±0.76% (186 runs sampled)
245
- parse docs.google.com x 2,316,357 ops/sec ±1.28% (187 runs sampled)
246
- parse drive.google.com x 2,363,543 ops/sec ±0.49% (189 runs sampled)
247
- parse en.wikipedia.org x 839,414 ops/sec ±0.53% (189 runs sampled)
248
- parse linkedin.com x 553,797 ops/sec ±0.63% (190 runs sampled)
249
- parse maps.google.com x 1,314,779 ops/sec ±0.72% (189 runs sampled)
250
- parse microsoft.com x 153,783 ops/sec ±0.53% (190 runs sampled)
251
- parse play.google.com x 2,249,574 ops/sec ±0.59% (187 runs sampled)
252
- parse plus.google.com x 2,258,682 ops/sec ±0.60% (188 runs sampled)
253
- parse sites.google.com x 2,247,069 ops/sec ±0.68% (189 runs sampled)
254
- parse support.google.com x 1,456,840 ops/sec ±0.70% (187 runs sampled)
255
- parse www.google.com x 1,046,028 ops/sec ±0.58% (188 runs sampled)
256
- parse youtu.be x 937,428 ops/sec ±1.47% (190 runs sampled)
257
- parse youtube.com x 963,878 ops/sec ±0.59% (190 runs sampled)
256
+ 14 tests completed.
257
+
258
+ parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled)
259
+ parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled)
260
+ parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled)
261
+ parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled)
262
+ parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled)
263
+ parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled)
264
+ parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled)
265
+ parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled)
266
+ parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled)
267
+ parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled)
268
+ parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled)
269
+ parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled)
270
+ parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled)
271
+ parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled)
258
272
 
259
273
  > node benchmark/parse.js
260
274
 
@@ -262,12 +276,12 @@ $ npm run bench
262
276
 
263
277
  6 tests completed.
264
278
 
265
- simple x 2,745,604 ops/sec ±0.77% (185 runs sampled)
266
- decode x 557,287 ops/sec ±0.60% (188 runs sampled)
267
- unquote x 2,498,475 ops/sec ±0.55% (189 runs sampled)
268
- duplicates x 868,591 ops/sec ±0.89% (187 runs sampled)
269
- 10 cookies x 306,745 ops/sec ±0.49% (190 runs sampled)
270
- 100 cookies x 22,414 ops/sec ±2.38% (182 runs sampled)
279
+ simple x 3,214,032 ops/sec ±1.61% (183 runs sampled)
280
+ decode x 587,237 ops/sec ±1.16% (187 runs sampled)
281
+ unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled)
282
+ duplicates x 857,008 ops/sec ±0.89% (187 runs sampled)
283
+ 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled)
284
+ 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled)
271
285
  ```
272
286
 
273
287
  ## References
@@ -275,6 +289,7 @@ $ npm run bench
275
289
  - [RFC 6265: HTTP State Management Mechanism][rfc-6265]
276
290
  - [Same-site Cookies][rfc-6265bis-09-5.4.7]
277
291
 
292
+ [rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/
278
293
  [rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1
279
294
  [rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7
280
295
  [rfc-6265]: https://tools.ietf.org/html/rfc6265
@@ -291,12 +306,12 @@ $ npm run bench
291
306
 
292
307
  [MIT](LICENSE)
293
308
 
309
+ [ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci
310
+ [ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml
294
311
  [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master
295
312
  [coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
296
- [github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/cookie/ci/master?label=ci
297
- [github-actions-ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml
298
- [node-version-image]: https://badgen.net/npm/node/cookie
299
- [node-version-url]: https://nodejs.org/en/download
313
+ [node-image]: https://badgen.net/npm/node/cookie
314
+ [node-url]: https://nodejs.org/en/download
300
315
  [npm-downloads-image]: https://badgen.net/npm/dm/cookie
301
316
  [npm-url]: https://npmjs.org/package/cookie
302
317
  [npm-version-image]: https://badgen.net/npm/v/cookie
@@ -172,6 +172,10 @@ function serialize(name, val, options) {
172
172
  str += '; Secure';
173
173
  }
174
174
 
175
+ if (opt.partitioned) {
176
+ str += '; Partitioned'
177
+ }
178
+
175
179
  if (opt.priority) {
176
180
  var priority = typeof opt.priority === 'string'
177
181
  ? opt.priority.toLowerCase()
@@ -233,7 +237,7 @@ function decode (str) {
233
237
  /**
234
238
  * URL-encode value.
235
239
  *
236
- * @param {string} str
240
+ * @param {string} val
237
241
  * @returns {string}
238
242
  */
239
243
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cookie",
3
3
  "description": "HTTP server cookie parsing and serialization",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "author": "Roman Shtylman <shtylman@gmail.com>",
6
6
  "contributors": [
7
7
  "Douglas Christopher Wilson <doug@somethingdoug.com>"
@@ -15,12 +15,12 @@
15
15
  "devDependencies": {
16
16
  "beautify-benchmark": "0.2.4",
17
17
  "benchmark": "2.1.4",
18
- "eslint": "7.32.0",
19
- "eslint-plugin-markdown": "2.2.1",
20
- "mocha": "9.2.2",
18
+ "eslint": "8.53.0",
19
+ "eslint-plugin-markdown": "3.0.1",
20
+ "mocha": "10.2.0",
21
21
  "nyc": "15.1.0",
22
22
  "safe-buffer": "5.2.1",
23
- "top-sites": "1.1.97"
23
+ "top-sites": "1.1.194"
24
24
  },
25
25
  "files": [
26
26
  "HISTORY.md",
@@ -1,4 +1,20 @@
1
- 4.18.3 / 2024-02-26
1
+ 4.19.2 / 2024-03-25
2
+ ==========
3
+
4
+ * Improved fix for open redirect allow list bypass
5
+
6
+ 4.19.1 / 2024-03-20
7
+ ==========
8
+
9
+ * Allow passing non-strings to res.location with new encoding handling checks
10
+
11
+ 4.19.0 / 2024-03-20
12
+ ==========
13
+
14
+ * Prevent open redirect allow list bypass due to encodeurl
15
+ * deps: cookie@0.6.0
16
+
17
+ 4.18.3 / 2024-02-29
2
18
  ==========
3
19
 
4
20
  * Fix routing requests without method
@@ -6,6 +22,8 @@
6
22
  - Fix strict json error message on Node.js 19+
7
23
  - deps: content-type@~1.0.5
8
24
  - deps: raw-body@2.5.2
25
+ * deps: cookie@0.6.0
26
+ - Add `partitioned` option
9
27
 
10
28
  4.18.2 / 2022-10-08
11
29
  ===================
@@ -55,6 +55,7 @@ module.exports = res
55
55
  */
56
56
 
57
57
  var charsetRegExp = /;\s*charset\s*=/;
58
+ var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/;
58
59
 
59
60
  /**
60
61
  * Set status `code`.
@@ -904,15 +905,23 @@ res.cookie = function (name, value, options) {
904
905
  */
905
906
 
906
907
  res.location = function location(url) {
907
- var loc = url;
908
+ var loc;
908
909
 
909
910
  // "back" is an alias for the referrer
910
911
  if (url === 'back') {
911
912
  loc = this.req.get('Referrer') || '/';
913
+ } else {
914
+ loc = String(url);
912
915
  }
913
916
 
914
- // set location
915
- return this.set('Location', encodeUrl(loc));
917
+ var m = schemaAndHostRegExp.exec(loc);
918
+ var pos = m ? m[0].length + 1 : 0;
919
+
920
+ // Only encode after host to avoid invalid encoding which can introduce
921
+ // vulnerabilities (e.g. `\\` to `%5C`).
922
+ loc = loc.slice(0, pos) + encodeUrl(loc.slice(pos));
923
+
924
+ return this.set('Location', loc);
916
925
  };
917
926
 
918
927
  /**
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "express",
3
3
  "description": "Fast, unopinionated, minimalist web framework",
4
- "version": "4.18.3",
4
+ "version": "4.19.2",
5
5
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
6
6
  "contributors": [
7
7
  "Aaron Heckmann <aaron.heckmann+github@gmail.com>",
@@ -33,7 +33,7 @@
33
33
  "body-parser": "1.20.2",
34
34
  "content-disposition": "0.5.4",
35
35
  "content-type": "~1.0.4",
36
- "cookie": "0.5.0",
36
+ "cookie": "0.6.0",
37
37
  "cookie-signature": "1.0.6",
38
38
  "debug": "2.6.9",
39
39
  "depd": "2.0.0",
@@ -288,7 +288,7 @@ UnzipStream.prototype._prepareOutStream = function (vars, entry) {
288
288
 
289
289
  var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path);
290
290
  // protect against malicious zip files which want to extract to parent dirs
291
- entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, "");
291
+ entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, ".");
292
292
  entry.type = isDirectory ? 'Directory' : 'File';
293
293
  entry.isDirectory = isDirectory;
294
294
 
@@ -352,7 +352,7 @@ UnzipStream.prototype._prepareOutStream = function (vars, entry) {
352
352
 
353
353
  entry.skip = true;
354
354
  setImmediate(() => {
355
- entry.emit("error", new Error(message));
355
+ self.emit('error', new Error(message));
356
356
  });
357
357
 
358
358
  // try to skip over this entry
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unzip-stream",
3
- "version": "0.3.1",
3
+ "version": "0.3.4",
4
4
  "description": "Process zip files using streaming API",
5
5
  "author": "Michal Hruby <michal.mhr@gmail.com>",
6
6
  "maintainers": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "step-node-agent",
3
- "version": "3.24.4",
3
+ "version": "3.24.6",
4
4
  "description": "The official STEP Agent implementation for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,46 +0,0 @@
1
- This software is dual-licensed under the ISC and MIT licenses.
2
- You may use this software under EITHER of the following licenses.
3
-
4
- ----------
5
-
6
- The ISC License
7
-
8
- Copyright (c) Isaac Z. Schlueter and Contributors
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted, provided that the above
12
- copyright notice and this permission notice appear in all copies.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
20
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
-
22
- ----------
23
-
24
- Copyright Isaac Z. Schlueter and Contributors
25
- All rights reserved.
26
-
27
- Permission is hereby granted, free of charge, to any person
28
- obtaining a copy of this software and associated documentation
29
- files (the "Software"), to deal in the Software without
30
- restriction, including without limitation the rights to use,
31
- copy, modify, merge, publish, distribute, sublicense, and/or sell
32
- copies of the Software, and to permit persons to whom the
33
- Software is furnished to do so, subject to the following
34
- conditions:
35
-
36
- The above copyright notice and this permission notice shall be
37
- included in all copies or substantial portions of the Software.
38
-
39
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46
- OTHER DEALINGS IN THE SOFTWARE.
@@ -1,23 +0,0 @@
1
- # abbrev-js
2
-
3
- Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
4
-
5
- Usage:
6
-
7
- var abbrev = require("abbrev");
8
- abbrev("foo", "fool", "folding", "flop");
9
-
10
- // returns:
11
- { fl: 'flop'
12
- , flo: 'flop'
13
- , flop: 'flop'
14
- , fol: 'folding'
15
- , fold: 'folding'
16
- , foldi: 'folding'
17
- , foldin: 'folding'
18
- , folding: 'folding'
19
- , foo: 'foo'
20
- , fool: 'fool'
21
- }
22
-
23
- This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
@@ -1,61 +0,0 @@
1
- module.exports = exports = abbrev.abbrev = abbrev
2
-
3
- abbrev.monkeyPatch = monkeyPatch
4
-
5
- function monkeyPatch () {
6
- Object.defineProperty(Array.prototype, 'abbrev', {
7
- value: function () { return abbrev(this) },
8
- enumerable: false, configurable: true, writable: true
9
- })
10
-
11
- Object.defineProperty(Object.prototype, 'abbrev', {
12
- value: function () { return abbrev(Object.keys(this)) },
13
- enumerable: false, configurable: true, writable: true
14
- })
15
- }
16
-
17
- function abbrev (list) {
18
- if (arguments.length !== 1 || !Array.isArray(list)) {
19
- list = Array.prototype.slice.call(arguments, 0)
20
- }
21
- for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
22
- args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
23
- }
24
-
25
- // sort them lexicographically, so that they're next to their nearest kin
26
- args = args.sort(lexSort)
27
-
28
- // walk through each, seeing how much it has in common with the next and previous
29
- var abbrevs = {}
30
- , prev = ""
31
- for (var i = 0, l = args.length ; i < l ; i ++) {
32
- var current = args[i]
33
- , next = args[i + 1] || ""
34
- , nextMatches = true
35
- , prevMatches = true
36
- if (current === next) continue
37
- for (var j = 0, cl = current.length ; j < cl ; j ++) {
38
- var curChar = current.charAt(j)
39
- nextMatches = nextMatches && curChar === next.charAt(j)
40
- prevMatches = prevMatches && curChar === prev.charAt(j)
41
- if (!nextMatches && !prevMatches) {
42
- j ++
43
- break
44
- }
45
- }
46
- prev = current
47
- if (j === cl) {
48
- abbrevs[current] = current
49
- continue
50
- }
51
- for (var a = current.substr(0, j) ; j <= cl ; j ++) {
52
- abbrevs[a] = current
53
- a += current.charAt(j)
54
- }
55
- }
56
- return abbrevs
57
- }
58
-
59
- function lexSort (a, b) {
60
- return a === b ? 0 : a > b ? 1 : -1
61
- }
@@ -1,21 +0,0 @@
1
- {
2
- "name": "abbrev",
3
- "version": "1.1.1",
4
- "description": "Like ruby's abbrev module, but in js",
5
- "author": "Isaac Z. Schlueter <i@izs.me>",
6
- "main": "abbrev.js",
7
- "scripts": {
8
- "test": "tap test.js --100",
9
- "preversion": "npm test",
10
- "postversion": "npm publish",
11
- "postpublish": "git push origin --all; git push origin --tags"
12
- },
13
- "repository": "http://github.com/isaacs/abbrev-js",
14
- "license": "ISC",
15
- "devDependencies": {
16
- "tap": "^10.1"
17
- },
18
- "files": [
19
- "abbrev.js"
20
- ]
21
- }
@@ -1,3 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: mhart
@@ -1,9 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "0.10"
4
- - "0.12"
5
- - "4"
6
- - "6"
7
- - "8"
8
- - "10"
9
- - "12"
File without changes
@@ -1,23 +0,0 @@
1
- Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
2
- All rights reserved.
3
-
4
- Permission is hereby granted, free of charge, to any person
5
- obtaining a copy of this software and associated documentation
6
- files (the "Software"), to deal in the Software without
7
- restriction, including without limitation the rights to use,
8
- copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the
10
- Software is furnished to do so, subject to the following
11
- conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
- OTHER DEALINGS IN THE SOFTWARE.