@centralping/ergo 0.1.0-beta.1 → 0.1.0-beta.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 (87) hide show
  1. package/README.md +14 -15
  2. package/http/accepts.js +1 -2
  3. package/http/authorization.js +1 -2
  4. package/http/body.js +1 -2
  5. package/http/cache-control.js +1 -2
  6. package/http/compress.js +1 -2
  7. package/http/cookie.js +1 -2
  8. package/http/cors.js +1 -2
  9. package/http/csrf.js +1 -2
  10. package/http/handler.js +1 -2
  11. package/http/index.js +37 -4
  12. package/http/json-api-query.js +1 -2
  13. package/http/logger.js +1 -2
  14. package/http/main.js +2 -3
  15. package/http/precondition.js +1 -2
  16. package/http/prefer.js +1 -2
  17. package/http/rate-limit.js +1 -2
  18. package/http/security-headers.js +1 -2
  19. package/http/send.js +1 -2
  20. package/http/timeout.js +1 -2
  21. package/http/url.js +1 -2
  22. package/http/validate.js +1 -2
  23. package/lib/accepts.js +1 -2
  24. package/lib/attach-instance.js +0 -1
  25. package/lib/authorization.js +1 -2
  26. package/lib/body/multiparse.js +1 -2
  27. package/lib/body/multipart/headers.js +1 -2
  28. package/lib/body/writer.js +1 -2
  29. package/lib/cookie/cookie.js +1 -2
  30. package/lib/cookie/index.js +0 -1
  31. package/lib/cookie/jar.js +16 -12
  32. package/lib/cookie/parse.js +1 -2
  33. package/lib/cors.js +1 -2
  34. package/lib/csrf.js +1 -2
  35. package/lib/from-connect.js +2 -3
  36. package/lib/json-api-query/index.js +0 -1
  37. package/lib/json-api-query/validate.js +1 -2
  38. package/lib/link.js +1 -2
  39. package/lib/prefer.js +1 -2
  40. package/lib/query.js +1 -2
  41. package/lib/rate-limit.js +1 -2
  42. package/lib/sanitize-quoted-string.js +0 -1
  43. package/lib/security-headers.js +1 -2
  44. package/lib/validate.js +1 -2
  45. package/lib/vary.js +0 -1
  46. package/package.json +2 -2
  47. package/types/http/precondition.d.ts +1 -2
  48. package/types/lib/attach-instance.d.ts +0 -1
  49. package/types/lib/cookie/jar.d.ts +4 -0
  50. package/types/lib/from-connect.d.ts +2 -3
  51. package/types/lib/prefer.d.ts +1 -2
  52. package/types/lib/rate-limit.d.ts +1 -2
  53. package/types/lib/sanitize-quoted-string.d.ts +0 -1
  54. package/types/lib/vary.d.ts +0 -1
  55. package/types/utils/compose.d.ts +1 -2
  56. package/types/utils/iterables/range.d.ts +1 -2
  57. package/utils/attempt.js +1 -2
  58. package/utils/buffers/index.js +0 -1
  59. package/utils/buffers/match.js +1 -2
  60. package/utils/buffers/split.js +1 -2
  61. package/utils/compose-with.js +1 -2
  62. package/utils/compose.js +1 -2
  63. package/utils/flat-array.js +1 -2
  64. package/utils/get.js +1 -2
  65. package/utils/http-errors.js +1 -2
  66. package/utils/iterables/buffer-split.js +1 -2
  67. package/utils/iterables/chain.js +1 -2
  68. package/utils/iterables/exec-all.js +1 -2
  69. package/utils/iterables/filter.js +1 -2
  70. package/utils/iterables/for-each.js +1 -2
  71. package/utils/iterables/from-stream.js +1 -2
  72. package/utils/iterables/index.js +0 -1
  73. package/utils/iterables/map.js +1 -2
  74. package/utils/iterables/range.js +1 -2
  75. package/utils/iterables/reduce.js +1 -2
  76. package/utils/iterables/take.js +1 -2
  77. package/utils/observables/buffer-split.js +0 -1
  78. package/utils/observables/chain.js +0 -1
  79. package/utils/observables/index.js +0 -1
  80. package/utils/observables/map.js +0 -1
  81. package/utils/observables/take.js +0 -1
  82. package/utils/pick.js +1 -2
  83. package/utils/set.js +1 -2
  84. package/utils/streams/index.js +0 -1
  85. package/utils/streams/meter.js +1 -2
  86. package/utils/streams/tee.js +1 -2
  87. package/utils/type.js +1 -2
@@ -23,12 +23,11 @@
23
23
  * no-mutation convention but is accepted at the interop boundary.
24
24
  *
25
25
  * @module lib/from-connect
26
- * @version 0.1.0
27
26
  * @since 0.1.0
28
27
  *
29
28
  * @example
30
- * import {compose, handler} from 'ergo';
31
- * import fromConnect from 'ergo/lib/from-connect';
29
+ * import {compose, handler} from '@centralping/ergo';
30
+ * import fromConnect from '@centralping/ergo/lib/from-connect';
32
31
  * import helmet from 'helmet';
33
32
  *
34
33
  * const pipeline = compose(
@@ -7,7 +7,6 @@
7
7
  * Original: `@centralping/json-api-query`. Vendored and upgraded to AJV 8 / JSON Schema 2020-12.
8
8
  *
9
9
  * @module lib/json-api-query
10
- * @version 0.1.0
11
10
  * @since 0.1.0
12
11
  * @requires ./schema.json
13
12
  * @requires ./validate.js
@@ -9,13 +9,12 @@
9
9
  * to handle single-value query parameters that may be strings instead of arrays.
10
10
  *
11
11
  * @module lib/json-api-query/validate
12
- * @version 0.1.0
13
12
  * @since 0.1.0
14
13
  * @requires ajv/dist/2020.js
15
14
  * @requires ./schema.json
16
15
  *
17
16
  * @example
18
- * import validate from 'ergo/lib/json-api-query/validate';
17
+ * import validate from '@centralping/ergo/lib/json-api-query/validate';
19
18
  *
20
19
  * const validator = validate();
21
20
  * const valid = validator({include: ['author'], fields: {articles: ['title']}});
package/lib/link.js CHANGED
@@ -10,13 +10,12 @@
10
10
  * formatted header value into the accumulator's `headers` array for `send()`.
11
11
  *
12
12
  * @module lib/link
13
- * @version 0.1.0
14
13
  * @since 0.1.0
15
14
  *
16
15
  * @see {@link https://www.rfc-editor.org/rfc/rfc8288 RFC 8288 - Web Linking}
17
16
  *
18
17
  * @example
19
- * import {formatLinkHeader, paginationLinks} from 'ergo/lib/link';
18
+ * import {formatLinkHeader, paginationLinks} from '@centralping/ergo/lib/link';
20
19
  *
21
20
  * const links = paginationLinks({
22
21
  * baseUrl: '/articles',
package/lib/prefer.js CHANGED
@@ -13,11 +13,10 @@
13
13
  * - `http/prefer.js` (ergo pipeline middleware)
14
14
  *
15
15
  * @module lib/prefer
16
- * @version 0.1.0
17
16
  * @since 0.1.0
18
17
  *
19
18
  * @example
20
- * import parsePrefer from 'ergo/lib/prefer';
19
+ * import parsePrefer from '@centralping/ergo/lib/prefer';
21
20
  *
22
21
  * parsePrefer('return=minimal');
23
22
  * // {return: 'minimal'}
package/lib/query.js CHANGED
@@ -11,12 +11,11 @@
11
11
  * JSON:API query parameter parsing.
12
12
  *
13
13
  * @module lib/query
14
- * @version 0.1.0
15
14
  * @since 0.1.0
16
15
  * @requires ../utils/set.js
17
16
  *
18
17
  * @example
19
- * import parse from 'ergo/lib/query';
18
+ * import parse from '@centralping/ergo/lib/query';
20
19
  *
21
20
  * parse('include=author&fields%5Barticles%5D=title%2Cbody');
22
21
  * // => {include: 'author', fields: {articles: ['title', 'body']}}
package/lib/rate-limit.js CHANGED
@@ -12,11 +12,10 @@
12
12
  * - `ergo-router/lib/transport/rate-limit.js` (transport-level rate limiting)
13
13
  *
14
14
  * @module lib/rate-limit
15
- * @version 0.1.0
16
15
  * @since 0.1.0
17
16
  *
18
17
  * @example
19
- * import {MemoryStore, checkRateLimit, defaultKeyGenerator} from 'ergo/lib/rate-limit';
18
+ * import {MemoryStore, checkRateLimit, defaultKeyGenerator} from '@centralping/ergo/lib/rate-limit';
20
19
  *
21
20
  * const store = new MemoryStore();
22
21
  * const key = defaultKeyGenerator(req);
@@ -7,7 +7,6 @@
7
7
  * `WWW-Authenticate`, `Link`, and `Set-Cookie`.
8
8
  *
9
9
  * @module lib/sanitize-quoted-string
10
- * @version 0.1.0
11
10
  * @since 0.1.0
12
11
  */
13
12
 
@@ -11,11 +11,10 @@
11
11
  * `{maxAge, includeSubDomains, preload}` for programmatic construction.
12
12
  *
13
13
  * @module lib/security-headers
14
- * @version 0.1.0
15
14
  * @since 0.1.0
16
15
  *
17
16
  * @example
18
- * import buildSecurityHeaderTuples from 'ergo/lib/security-headers';
17
+ * import buildSecurityHeaderTuples from '@centralping/ergo/lib/security-headers';
19
18
  *
20
19
  * const tuples = buildSecurityHeaderTuples({
21
20
  * xFrameOptions: 'SAMEORIGIN',
package/lib/validate.js CHANGED
@@ -8,13 +8,12 @@
8
8
  * Used by `http/validate.js` as the pure-logic backing implementation.
9
9
  *
10
10
  * @module lib/validate
11
- * @version 0.1.0
12
11
  * @since 0.1.0
13
12
  * @requires ajv
14
13
  * @requires ../utils/http-errors.js
15
14
  *
16
15
  * @example
17
- * import createValidator from 'ergo/lib/validate';
16
+ * import createValidator from '@centralping/ergo/lib/validate';
18
17
  *
19
18
  * const validate = createValidator({
20
19
  * type: 'object',
package/lib/vary.js CHANGED
@@ -5,7 +5,6 @@
5
5
  * Uses Set-based deduplication with case-insensitive comparison.
6
6
  *
7
7
  * @module lib/vary
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  */
11
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centralping/ergo",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "A Fast Fail REST API toolkit for Node.js -- composable middleware with structured Negotiation, Authorization, Validation, and Execution stages.",
5
5
  "main": "http/index.js",
6
6
  "type": "module",
@@ -109,7 +109,7 @@
109
109
  "publishConfig": {
110
110
  "access": "public"
111
111
  },
112
- "homepage": "https://github.com/CentralPing/ergo",
112
+ "homepage": "https://centralping.github.io/packages/ergo/",
113
113
  "funding": {
114
114
  "type": "github",
115
115
  "url": "https://github.com/sponsors/jasoncust"
@@ -10,11 +10,10 @@
10
10
  * inspection that short-circuits before authorization, body parsing, or execution.
11
11
  *
12
12
  * @module http/precondition
13
- * @version 0.1.0
14
13
  * @since 0.1.0
15
14
  *
16
15
  * @example
17
- * import {compose, precondition} from 'ergo';
16
+ * import {compose, precondition} from '@centralping/ergo';
18
17
  *
19
18
  * // Enforce on all requests (method scoping handled by pipeline builder)
20
19
  * const pipeline = compose(
@@ -5,7 +5,6 @@
5
5
  * `x-request-id` header, formatted as a `urn:uuid:` URI.
6
6
  *
7
7
  * @module lib/attach-instance
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  */
11
10
  /**
@@ -2,6 +2,10 @@ export default jar;
2
2
  /**
3
3
  * Creates a cookie jar pre-populated from a parsed cookie object.
4
4
  *
5
+ * Incoming cookie names that collide with jar prototype methods or own properties
6
+ * (`set`, `get`, `clear`, `toHeader`, `isJar`, `size`, `jar`) are silently dropped
7
+ * to prevent `TypeError` from strict-mode assignment to non-writable properties.
8
+ *
5
9
  * @param {object} [cookies={}] - Initial cookie values (from `parse()`)
6
10
  * @returns {object} - Cookie jar with `get`, `set`, `clear`, `toHeader`, `size` members
7
11
  */
@@ -23,12 +23,11 @@
23
23
  * no-mutation convention but is accepted at the interop boundary.
24
24
  *
25
25
  * @module lib/from-connect
26
- * @version 0.1.0
27
26
  * @since 0.1.0
28
27
  *
29
28
  * @example
30
- * import {compose, handler} from 'ergo';
31
- * import fromConnect from 'ergo/lib/from-connect';
29
+ * import {compose, handler} from '@centralping/ergo';
30
+ * import fromConnect from '@centralping/ergo/lib/from-connect';
32
31
  * import helmet from 'helmet';
33
32
  *
34
33
  * const pipeline = compose(
@@ -13,11 +13,10 @@
13
13
  * - `http/prefer.js` (ergo pipeline middleware)
14
14
  *
15
15
  * @module lib/prefer
16
- * @version 0.1.0
17
16
  * @since 0.1.0
18
17
  *
19
18
  * @example
20
- * import parsePrefer from 'ergo/lib/prefer';
19
+ * import parsePrefer from '@centralping/ergo/lib/prefer';
21
20
  *
22
21
  * parsePrefer('return=minimal');
23
22
  * // {return: 'minimal'}
@@ -39,11 +39,10 @@ export function defaultKeyGenerator(req: object): string;
39
39
  * - `ergo-router/lib/transport/rate-limit.js` (transport-level rate limiting)
40
40
  *
41
41
  * @module lib/rate-limit
42
- * @version 0.1.0
43
42
  * @since 0.1.0
44
43
  *
45
44
  * @example
46
- * import {MemoryStore, checkRateLimit, defaultKeyGenerator} from 'ergo/lib/rate-limit';
45
+ * import {MemoryStore, checkRateLimit, defaultKeyGenerator} from '@centralping/ergo/lib/rate-limit';
47
46
  *
48
47
  * const store = new MemoryStore();
49
48
  * const key = defaultKeyGenerator(req);
@@ -7,7 +7,6 @@
7
7
  * `WWW-Authenticate`, `Link`, and `Set-Cookie`.
8
8
  *
9
9
  * @module lib/sanitize-quoted-string
10
- * @version 0.1.0
11
10
  * @since 0.1.0
12
11
  */
13
12
  /**
@@ -5,7 +5,6 @@
5
5
  * Uses Set-based deduplication with case-insensitive comparison.
6
6
  *
7
7
  * @module lib/vary
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  */
11
10
  /**
@@ -20,11 +20,10 @@ export default compose;
20
20
  * of ergo's built-in middleware).
21
21
  *
22
22
  * @module utils/compose
23
- * @version 0.2.0
24
23
  * @since 0.1.0
25
24
  *
26
25
  * @example
27
- * import compose from 'ergo/utils/compose';
26
+ * import compose from '@centralping/ergo/utils/compose';
28
27
  *
29
28
  * const pipeline = compose(
30
29
  * async (req, res) => ({user: await getUser(req)}),
@@ -5,11 +5,10 @@
5
5
  * stepping by `step`. Mirrors Python's `range()` behaviour.
6
6
  *
7
7
  * @module utils/iterables/range
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  *
11
10
  * @example
12
- * import range from 'ergo/utils/iterables/range';
11
+ * import range from '@centralping/ergo/utils/iterables/range';
13
12
  *
14
13
  * [...range(5)] // => [0, 1, 2, 3, 4]
15
14
  * [...range(1, 5)] // => [1, 2, 3, 4]
package/utils/attempt.js CHANGED
@@ -7,11 +7,10 @@
7
7
  * Used by `http/handler.js` to wrap the try pipeline with an error handler pipeline.
8
8
  *
9
9
  * @module utils/attempt
10
- * @version 0.1.0
11
10
  * @since 0.1.0
12
11
  *
13
12
  * @example
14
- * import attempt from 'ergo/utils/attempt';
13
+ * import attempt from '@centralping/ergo/utils/attempt';
15
14
  *
16
15
  * const safe = attempt(
17
16
  * async (req, res) => { throw new Error('oops'); },
@@ -4,7 +4,6 @@
4
4
  * Provides `match` (KMP substring search in Buffers) and `split` (Buffer split by separator).
5
5
  *
6
6
  * @module utils/buffers
7
- * @version 0.1.0
8
7
  * @since 0.1.0
9
8
  * @requires ./match.js
10
9
  * @requires ./split.js
@@ -9,11 +9,10 @@
9
9
  * match state (`partial`) for the next chunk.
10
10
  *
11
11
  * @module utils/buffers/match
12
- * @version 0.1.0
13
12
  * @since 0.1.0
14
13
  *
15
14
  * @example
16
- * import bufferMatch from 'ergo/utils/buffers/match';
15
+ * import bufferMatch from '@centralping/ergo/utils/buffers/match';
17
16
  *
18
17
  * const {matches} = bufferMatch(Buffer.from('hello world'), Buffer.from('l'));
19
18
  * // matches => [2, 3, 9]
@@ -8,13 +8,12 @@
8
8
  * Returns `{buffers, partial, lookup}` where `buffers` is the array of Buffer slices.
9
9
  *
10
10
  * @module utils/buffers/split
11
- * @version 0.1.0
12
11
  * @since 0.1.0
13
12
  * @requires ./match.js
14
13
  * @requires ../get.js
15
14
  *
16
15
  * @example
17
- * import bufferSplit from 'ergo/utils/buffers/split';
16
+ * import bufferSplit from '@centralping/ergo/utils/buffers/split';
18
17
  *
19
18
  * const {buffers} = bufferSplit(Buffer.from('a--b--c'), Buffer.from('--'));
20
19
  * // buffers => [Buffer<'a'>, Buffer<'b'>, Buffer<'c'>]
@@ -21,13 +21,12 @@
21
21
  * for compatibility with simple middleware that only produce domain data.
22
22
  *
23
23
  * @module utils/compose-with
24
- * @version 0.2.0
25
24
  * @since 0.1.0
26
25
  * @requires ./compose.js
27
26
  * @requires ./set.js
28
27
  *
29
28
  * @example
30
- * import compose, {createResponseAcc} from 'ergo/utils/compose-with';
29
+ * import compose, {createResponseAcc} from '@centralping/ergo/utils/compose-with';
31
30
  *
32
31
  * const responseAcc = createResponseAcc();
33
32
  * const pipeline = compose(
package/utils/compose.js CHANGED
@@ -19,11 +19,10 @@
19
19
  * of ergo's built-in middleware).
20
20
  *
21
21
  * @module utils/compose
22
- * @version 0.2.0
23
22
  * @since 0.1.0
24
23
  *
25
24
  * @example
26
- * import compose from 'ergo/utils/compose';
25
+ * import compose from '@centralping/ergo/utils/compose';
27
26
  *
28
27
  * const pipeline = compose(
29
28
  * async (req, res) => ({user: await getUser(req)}),
@@ -5,11 +5,10 @@
5
5
  * Equivalent to `[...args].flat()` — accepts any mix of scalars and nested arrays.
6
6
  *
7
7
  * @module utils/flat-array
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  *
11
10
  * @example
12
- * import flatArray from 'ergo/utils/flat-array';
11
+ * import flatArray from '@centralping/ergo/utils/flat-array';
13
12
  *
14
13
  * flatArray('a', ['b', 'c'], 'd') // => ['a', 'b', 'c', 'd']
15
14
  * flatArray(1, [2, 3], 4) // => [1, 2, 3, 4]
package/utils/get.js CHANGED
@@ -6,11 +6,10 @@
6
6
  * - Returns `undefined` gracefully when a step is missing (`safe: true`)
7
7
  *
8
8
  * @module utils/get
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  *
12
11
  * @example
13
- * import get from 'ergo/utils/get';
12
+ * import get from '@centralping/ergo/utils/get';
14
13
  *
15
14
  * get({a: {b: {c: 42}}}, 'a.b.c') // => 42
16
15
  * get({a: null}, 'a.b.c', {safe: true}) // => undefined (no throw)
@@ -15,14 +15,13 @@
15
15
  * catches them and forwards to `send()` for serialization.
16
16
  *
17
17
  * @module utils/http-errors
18
- * @version 0.1.0
19
18
  * @since 0.1.0
20
19
  * @requires node:http
21
20
  *
22
21
  * @see {@link https://www.rfc-editor.org/rfc/rfc9457 RFC 9457 - Problem Details for HTTP APIs}
23
22
  *
24
23
  * @example
25
- * import httpErrors from 'ergo/utils/http-errors';
24
+ * import httpErrors from '@centralping/ergo/utils/http-errors';
26
25
  *
27
26
  * throw httpErrors(404);
28
27
  * // Error { name: 'NotFound', status: 404, type: 'https://...', title: 'Not Found', detail: 'Not Found' }
@@ -8,12 +8,11 @@
8
8
  * Used by `lib/body/multiparse.js` for multipart boundary splitting.
9
9
  *
10
10
  * @module utils/iterables/buffer-split
11
- * @version 0.1.0
12
11
  * @since 0.1.0
13
12
  * @requires ../buffers/split.js
14
13
  *
15
14
  * @example
16
- * import {chain, bufferSplit, reduce} from 'ergo/utils/iterables';
15
+ * import {chain, bufferSplit, reduce} from '@centralping/ergo/utils/iterables';
17
16
  *
18
17
  * const chunks = [Buffer.from('a--b--c')];
19
18
  * const result = chain(chunks, bufferSplit('--'), reduce((acc, [, b]) => [...acc, b.toString()], []));
@@ -8,11 +8,10 @@
8
8
  * This is the core primitive for building lazy data pipelines with the iterable utilities.
9
9
  *
10
10
  * @module utils/iterables/chain
11
- * @version 0.1.0
12
11
  * @since 0.1.0
13
12
  *
14
13
  * @example
15
- * import {chain, map, filter, reduce} from 'ergo/utils/iterables';
14
+ * import {chain, map, filter, reduce} from '@centralping/ergo/utils/iterables';
16
15
  *
17
16
  * chain(
18
17
  * [1, 2, 3, 4, 5],
@@ -6,11 +6,10 @@
6
6
  * flag is added to avoid infinite loops with stateful regexes.
7
7
  *
8
8
  * @module utils/iterables/exec-all
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  *
12
11
  * @example
13
- * import execAll from 'ergo/utils/iterables/exec-all';
12
+ * import execAll from '@centralping/ergo/utils/iterables/exec-all';
14
13
  *
15
14
  * const findWords = execAll(/([a-z]+)/ig);
16
15
  * [...findWords('hello world')] // => [['hello'], ['world']]
@@ -6,11 +6,10 @@
6
6
  * to the predicate (same signature as `Array.prototype.filter`).
7
7
  *
8
8
  * @module utils/iterables/filter
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  *
12
11
  * @example
13
- * import {chain, filter} from 'ergo/utils/iterables';
12
+ * import {chain, filter} from '@centralping/ergo/utils/iterables';
14
13
  *
15
14
  * [...chain([1, 2, 3, 4], filter(x => x % 2 === 0))] // => [2, 4]
16
15
  */
@@ -6,12 +6,11 @@
6
6
  * for iterables, but composable in a `chain()` pipeline.
7
7
  *
8
8
  * @module utils/iterables/for-each
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  * @requires ./map.js
12
11
  *
13
12
  * @example
14
- * import {chain, forEach, reduce} from 'ergo/utils/iterables';
13
+ * import {chain, forEach, reduce} from '@centralping/ergo/utils/iterables';
15
14
  *
16
15
  * chain(
17
16
  * [1, 2, 3],
@@ -6,11 +6,10 @@
6
6
  * interface for code that receives streams and needs to iterate them.
7
7
  *
8
8
  * @module utils/iterables/from-stream
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  *
12
11
  * @example
13
- * import fromStream from 'ergo/utils/iterables/from-stream';
12
+ * import fromStream from '@centralping/ergo/utils/iterables/from-stream';
14
13
  * import {Readable} from 'node:stream';
15
14
  *
16
15
  * const readable = Readable.from(['hello', ' ', 'world']);
@@ -6,7 +6,6 @@
6
6
  * `chain(source, bufferSplit(sep), map(fn), reduce(fn, init))`
7
7
  *
8
8
  * @module utils/iterables
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  */
12
11
  export {default as bufferSplit} from './buffer-split.js';
@@ -6,12 +6,11 @@
6
6
  * async generators; sync transforms produce sync generators.
7
7
  *
8
8
  * @module utils/iterables/map
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  * @requires ../type.js
12
11
  *
13
12
  * @example
14
- * import {chain, map} from 'ergo/utils/iterables';
13
+ * import {chain, map} from '@centralping/ergo/utils/iterables';
15
14
  *
16
15
  * [...chain([1, 2, 3], map(x => x * 2))] // => [2, 4, 6]
17
16
  *
@@ -5,11 +5,10 @@
5
5
  * stepping by `step`. Mirrors Python's `range()` behaviour.
6
6
  *
7
7
  * @module utils/iterables/range
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  *
11
10
  * @example
12
- * import range from 'ergo/utils/iterables/range';
11
+ * import range from '@centralping/ergo/utils/iterables/range';
13
12
  *
14
13
  * [...range(5)] // => [0, 1, 2, 3, 4]
15
14
  * [...range(1, 5)] // => [1, 2, 3, 4]
@@ -6,11 +6,10 @@
6
6
  * least one element, the first element is used as the initial accumulator.
7
7
  *
8
8
  * @module utils/iterables/reduce
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  *
12
11
  * @example
13
- * import {chain, reduce} from 'ergo/utils/iterables';
12
+ * import {chain, reduce} from '@centralping/ergo/utils/iterables';
14
13
  *
15
14
  * chain([1, 2, 3, 4], reduce((sum, x) => sum + x, 0)) // => 10
16
15
  */
@@ -5,11 +5,10 @@
5
5
  * then returns (stops iteration).
6
6
  *
7
7
  * @module utils/iterables/take
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  *
11
10
  * @example
12
- * import {chain, take} from 'ergo/utils/iterables';
11
+ * import {chain, take} from '@centralping/ergo/utils/iterables';
13
12
  *
14
13
  * [...chain([1, 2, 3, 4, 5], take(3))] // => [1, 2, 3]
15
14
  */
@@ -6,7 +6,6 @@
6
6
  * integration with observable-style pipelines built with `utils/observables/chain`.
7
7
  *
8
8
  * @module utils/observables/buffer-split
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  * @requires ../buffers/split.js
12
11
  *
@@ -6,7 +6,6 @@
6
6
  * The last generator in the array is the sink.
7
7
  *
8
8
  * @module utils/observables/chain
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  * @requires ../type.js
12
11
  */
@@ -6,7 +6,6 @@
6
6
  * body parsing and other real-time data flows.
7
7
  *
8
8
  * @module utils/observables
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  * @requires ./buffer-split.js
12
11
  * @requires ./chain.js
@@ -5,7 +5,6 @@
5
5
  * transformed and forwarded downstream via the iterator's `.next()`.
6
6
  *
7
7
  * @module utils/observables/map
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  *
11
10
  * @example
@@ -5,7 +5,6 @@
5
5
  * downstream iterator, then calls `.return()` to signal completion.
6
6
  *
7
7
  * @module utils/observables/take
8
- * @version 0.1.0
9
8
  * @since 0.1.0
10
9
  *
11
10
  * @example
package/utils/pick.js CHANGED
@@ -6,13 +6,12 @@
6
6
  * - Rename tuples: `pick(obj, ['a.b', 'c'])` extracts `obj.a.b` as `result.c`
7
7
  *
8
8
  * @module utils/pick
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  * @requires ./get.js
12
11
  * @requires ./set.js
13
12
  *
14
13
  * @example
15
- * import pick from 'ergo/utils/pick';
14
+ * import pick from '@centralping/ergo/utils/pick';
16
15
  *
17
16
  * pick({a: {b: 1}, c: 2}, 'a.b', 'c')
18
17
  * // => {a: {b: 1}, c: 2}
package/utils/set.js CHANGED
@@ -6,11 +6,10 @@
6
6
  * Array nodes are created when the next path segment is a valid integer string.
7
7
  *
8
8
  * @module utils/set
9
- * @version 0.1.0
10
9
  * @since 0.1.0
11
10
  *
12
11
  * @example
13
- * import set from 'ergo/utils/set';
12
+ * import set from '@centralping/ergo/utils/set';
14
13
  *
15
14
  * const obj = {};
16
15
  * set(obj, 'a.b.c', 42); // obj => {a: {b: {c: 42}}}