From 53a64e44eee070b8ee20f3b95e2d8729a5a130fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Wed, 21 Jul 2021 11:27:39 +0200 Subject: [PATCH 01/13] docs(core): Fix JSDoc Bad JSON, see links, ... --- docs/plugin-core.md | 395 ++++++++++++----------- packages/core/README.md | 395 ++++++++++++----------- packages/core/src/statements/assign.js | 33 +- packages/core/src/statements/concat.js | 12 +- packages/core/src/statements/debug.js | 2 +- packages/core/src/statements/delegate.js | 5 +- packages/core/src/statements/dispatch.js | 2 +- packages/core/src/statements/dump.js | 41 ++- packages/core/src/statements/env.js | 5 +- packages/core/src/statements/exchange.js | 25 +- packages/core/src/statements/extract.js | 24 +- packages/core/src/statements/group.js | 27 +- packages/core/src/statements/ignore.js | 18 +- packages/core/src/statements/keep.js | 24 +- packages/core/src/statements/remove.js | 15 +- packages/core/src/statements/replace.js | 26 +- packages/core/src/statements/shift.js | 16 +- packages/core/src/statements/shuffle.js | 18 +- packages/core/src/statements/spawn.js | 9 +- packages/core/src/statements/swing.js | 15 +- packages/core/src/statements/time.js | 2 +- packages/core/src/statements/transit.js | 12 +- packages/core/src/statements/truncate.js | 20 +- packages/core/src/statements/ungroup.js | 30 +- packages/core/src/statements/unpack.js | 2 +- packages/core/src/statements/validate.js | 29 +- 26 files changed, 621 insertions(+), 581 deletions(-) diff --git a/docs/plugin-core.md b/docs/plugin-core.md index 034b5949..0a0310fc 100644 --- a/docs/plugin-core.md +++ b/docs/plugin-core.md @@ -45,24 +45,25 @@ npm install @ezs/core ### assign -Take `Object` and add new field +Add a new field to an `Object`. + Input file: ```json [{ - a: 1, + "a": 1, }, { - a: 2, + "a": 2, }, { - a: 3, + "a": 3, }, { - a: 4, + "a": 4, }, { - a: 5, + "a": 5, }] ``` @@ -78,24 +79,24 @@ Output: ```json [{ - a: 1, - b: { c: "X" }, + "a": 1, + "b": { "c": "X" }, }, { - a: 2, - b: { c: "X" }, + "a": 2, + "b": { "c": "X" }, }, { - a: 3, - b: { c: "X" }, + "a": 3, + "b": { "c": "X" }, }, { - a: 4, - b: { c: "X" }, + "a": 4, + "b": { "c": "X" }, }, { - a: 5, - b: { c: "X" }, + "a": 5, + "b": { "c": "X" }, }] ``` @@ -108,13 +109,13 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### concat -Take all `String`, concat them and thow just one +Take all `String`, concat them and throw just one. ```json [ - 'a', - 'b', - 'c', + "a", + "b", + "c" ] ``` @@ -131,7 +132,7 @@ Output: ```json [ - '', + "" ] ``` @@ -145,7 +146,7 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### debug -Take `Object` , print it and throw the same object +Take `Object`, print it (with its number), and throw the same object. #### Parameters @@ -157,8 +158,9 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### delegate -Takes an `Object` delegate processing to an external pipeline -Note : works like [spawn], but each chunk share the same external pipeline +Delegate processing to an external pipeline. + +> **Note**: works like [spawn](#spawn), but each chunk share the same external pipeline. #### Parameters @@ -171,7 +173,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### dispatch -Takes an `Object` dispatch processing to an external pipeline on one or more servers +Dispatch processing to an external pipeline on one or more servers. #### Parameters @@ -184,15 +186,15 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### dump -Take all `Object` and generete a JSON array +Take all `Object`s and generate a JSON array ```json [ - { a: 1 }, - { a: 2 }, - { a: 3 }, - { a: 4 }, - { a: 5 } + { "a": 1 }, + { "a": 2 }, + { "a": 3 }, + { "a": 4 }, + { "a": 5 } ] ``` @@ -207,20 +209,20 @@ Output: ```json [{ - "a": 1 - }, - { - "a": 2 - }, - { - "a": 3 - }, - { - "a": 4 - }, - { - "a": 5 - } + "a": 1 + }, + { + "a": 2 + }, + { + "a": 3 + }, + { + "a": 4 + }, + { + "a": 5 + } ] ``` @@ -232,9 +234,8 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### env -Take `Object` and send the same object but in the meantime, -it is possible to add new environment field with the first -Object of the feed +Send the input object again, while adding new environment field(s) with the +first `Object` of the feed. #### Parameters @@ -245,19 +246,21 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### exchange -Take `Object` and throw un new item computed by the value= parameter +Take `Object` and throw a new item computed by the `value=` parameter (which +replace the input one). + Input file: ```json [{ - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }, { - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }] ``` @@ -272,12 +275,12 @@ Output: ```json [{ - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }, { - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }] ``` @@ -290,18 +293,19 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### extract Take `Object` and throw each value of fields -Note: extract cannot throw undefined or null values + +> **Note**: extract cannot throw `undefined` or `null` values ```json [{ - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }, { - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }] ``` @@ -317,10 +321,10 @@ Output: ```json [ - 'abcdefg', - '1234567', - 'abcdefg', - '1234567', + "abcdefg", + "1234567", + "abcdefg", + "1234567" }] ``` @@ -332,18 +336,20 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### group -Take all `chunk`s, and throw one array of chunks +Take all `chunk`s, and throw them grouped by `length`. + +See also [ungroup](#ungroup). ```json [ - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - 'h', + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h" ] ``` @@ -358,9 +364,9 @@ Output: ```json [ - [ 'a', 'b', 'c' ], - [ 'd', 'e', 'f' ], - [ 'g', 'h' ], + [ "a", "b", "c" ], + [ "d", "e", "f" ], + [ "g", "h" ] ] ``` @@ -373,23 +379,24 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### ignore Takes all the chunks, and ignore the firtst N chunk + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -404,34 +411,35 @@ Output: ```json [{ - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` #### Parameters -- `length` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Length of the feed +- `length` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Length of the feed to ignore Returns **any** ### keep -Take `Object` and throw the same object but keep only specific fields +Throw input `Object` but keep only specific fields. + Input file: ```json [{ - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }, { - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }] ``` @@ -447,12 +455,12 @@ Output: ```json [{ - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }, { - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }] ``` @@ -501,19 +509,19 @@ Input file: ```json [{ - a: 'a', + a: "a" }, { - a: 2, + a: 2 }, { - a: 'b', + a: "b" }, { - a: 4, + a: 4 }, { - a: 'c', + a: "c" }] ``` @@ -529,10 +537,10 @@ Output: ```json [ { - a: 2, + a: 2 }, { - a: 4, + a: 4 } ] ``` @@ -546,24 +554,27 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### replace -Take `Object` and replace it with a new object with some fields +Take `Object` and replace it with a new object with some fields. + +See also [exchange](#exchange) and [assign](#assign). + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -579,19 +590,19 @@ Output: ```json [{ - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }] ``` @@ -605,23 +616,24 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### shift Return the first `Object` and close the feed + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -635,7 +647,7 @@ Output: ```json [{ - a: 1, + "a": 1 }] ``` @@ -644,16 +656,17 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### shuffle Take `Object`, shuffle data of the whole object or only some fields specified by path + Input file: ```json [{ - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }, { - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }] ``` @@ -668,12 +681,12 @@ Output: ```json [{ - a: 'cadbefg', - b: '1234567', + "a": "cadbefg", + "b": "1234567" }, { - a: 'dcaegbf', - b: '1234567', + "a": "dcaegbf", + "b": "1234567" }] ``` @@ -685,39 +698,43 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### spawn -Take `Object` and delegate processing to an external pipeline, throw each chunk from the result -Note : works like [delegate], but each chunk use its own external pipeline +Delegate processing to an external pipeline, throw each chunk from the result. + +> **Note**: works like [delegate](#delegate), but each chunk use its own external pipeline #### Parameters - `file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a file - `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of characters -- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a object -- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a URL-like command +- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an object +- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an URL-like command - `cache` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Use a specific ezs statement to run commands (advanced) Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### swing -Takes an `Object` delegate processing to an external pipeline -under specifics conditions -Note : works like [spawn], but each chunk share the same external pipeline +Delegate processing to an external pipeline under specifics conditions + +> **Note**: works like [spawn](#spawn), but each chunk shares the same external +> pipeline. #### Parameters - `test` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** if test is true - `reverse` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** reverse the test (optional, default `false`) - `file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a file -- `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of characters -- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a object -- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a URL-like command +- `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of + characters +- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an object +- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an URL-like + command Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### time -Measure the execution time of a script, on each chunk on input. +Measure the execution time of a script, on each chunk of input. #### Parameters @@ -770,15 +787,16 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### transit -Take `Object` and throw the same object +Take `Object` and throw the same object again. + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }] ``` @@ -792,10 +810,10 @@ Output: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }] ``` @@ -803,24 +821,25 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### truncate -Takes all the chunks, and closes the feed when the total length is equal to the parameter +Takes all the chunks, and closes the feed when the total length is equal to the parameter. + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -835,13 +854,13 @@ Output: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }] ``` @@ -853,16 +872,15 @@ Returns **any** ### ungroup -- **See: group - ** +Take all `chunk`s, and throw one item for every chunk. -Take all `chunk`s, and throw one item for every chunk +See also [group](#group). ```json [ - [ 'a', 'b', 'c' ], - [ 'd', 'e', 'f' ], - [ 'g', 'h' ], + [ "a", "b", "c" ], + [ "d", "e", "f" ], + [ "g", "h" ] ] ``` @@ -876,47 +894,47 @@ Output: ```json [ - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - 'h', + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h" ] ``` -Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** +Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<any>** ### unpack -Take `String` and throw `Object` builded by JSON.parse on each line +Take `String`s or `Buffer`s and throw `Object` builded by JSON.parse on each line. Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### validate -- **See: laravel validator rules - ** -- **See: - ** +From an `Object`, throw the same object if all rules pass + +See -From a `Object`, throw the same object if all rules pass +- [Laravel validator rules](https://laravel.com/docs/8.x/validation) +- Input file: ```json [{ - a: 1, - b: 'titi', + "a": 1, + "b": "titi" }, { - a: 2, - b: 'toto', + "a": 2, + "b": "toto" }, { - a: false, + "a": false }, ] ``` @@ -936,13 +954,12 @@ Output: ```json [{ - a: 1, - b: 'titi', + "a": 1, + "b": "titi" }, { - a: 2, - b: 'toto', -}, + "a": 2, + "b": "toto" }] ``` diff --git a/packages/core/README.md b/packages/core/README.md index 034b5949..0a0310fc 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -45,24 +45,25 @@ npm install @ezs/core ### assign -Take `Object` and add new field +Add a new field to an `Object`. + Input file: ```json [{ - a: 1, + "a": 1, }, { - a: 2, + "a": 2, }, { - a: 3, + "a": 3, }, { - a: 4, + "a": 4, }, { - a: 5, + "a": 5, }] ``` @@ -78,24 +79,24 @@ Output: ```json [{ - a: 1, - b: { c: "X" }, + "a": 1, + "b": { "c": "X" }, }, { - a: 2, - b: { c: "X" }, + "a": 2, + "b": { "c": "X" }, }, { - a: 3, - b: { c: "X" }, + "a": 3, + "b": { "c": "X" }, }, { - a: 4, - b: { c: "X" }, + "a": 4, + "b": { "c": "X" }, }, { - a: 5, - b: { c: "X" }, + "a": 5, + "b": { "c": "X" }, }] ``` @@ -108,13 +109,13 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### concat -Take all `String`, concat them and thow just one +Take all `String`, concat them and throw just one. ```json [ - 'a', - 'b', - 'c', + "a", + "b", + "c" ] ``` @@ -131,7 +132,7 @@ Output: ```json [ - '', + "" ] ``` @@ -145,7 +146,7 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### debug -Take `Object` , print it and throw the same object +Take `Object`, print it (with its number), and throw the same object. #### Parameters @@ -157,8 +158,9 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### delegate -Takes an `Object` delegate processing to an external pipeline -Note : works like [spawn], but each chunk share the same external pipeline +Delegate processing to an external pipeline. + +> **Note**: works like [spawn](#spawn), but each chunk share the same external pipeline. #### Parameters @@ -171,7 +173,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### dispatch -Takes an `Object` dispatch processing to an external pipeline on one or more servers +Dispatch processing to an external pipeline on one or more servers. #### Parameters @@ -184,15 +186,15 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### dump -Take all `Object` and generete a JSON array +Take all `Object`s and generate a JSON array ```json [ - { a: 1 }, - { a: 2 }, - { a: 3 }, - { a: 4 }, - { a: 5 } + { "a": 1 }, + { "a": 2 }, + { "a": 3 }, + { "a": 4 }, + { "a": 5 } ] ``` @@ -207,20 +209,20 @@ Output: ```json [{ - "a": 1 - }, - { - "a": 2 - }, - { - "a": 3 - }, - { - "a": 4 - }, - { - "a": 5 - } + "a": 1 + }, + { + "a": 2 + }, + { + "a": 3 + }, + { + "a": 4 + }, + { + "a": 5 + } ] ``` @@ -232,9 +234,8 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### env -Take `Object` and send the same object but in the meantime, -it is possible to add new environment field with the first -Object of the feed +Send the input object again, while adding new environment field(s) with the +first `Object` of the feed. #### Parameters @@ -245,19 +246,21 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### exchange -Take `Object` and throw un new item computed by the value= parameter +Take `Object` and throw a new item computed by the `value=` parameter (which +replace the input one). + Input file: ```json [{ - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }, { - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }] ``` @@ -272,12 +275,12 @@ Output: ```json [{ - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }, { - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }] ``` @@ -290,18 +293,19 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### extract Take `Object` and throw each value of fields -Note: extract cannot throw undefined or null values + +> **Note**: extract cannot throw `undefined` or `null` values ```json [{ - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }, { - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }] ``` @@ -317,10 +321,10 @@ Output: ```json [ - 'abcdefg', - '1234567', - 'abcdefg', - '1234567', + "abcdefg", + "1234567", + "abcdefg", + "1234567" }] ``` @@ -332,18 +336,20 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### group -Take all `chunk`s, and throw one array of chunks +Take all `chunk`s, and throw them grouped by `length`. + +See also [ungroup](#ungroup). ```json [ - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - 'h', + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h" ] ``` @@ -358,9 +364,9 @@ Output: ```json [ - [ 'a', 'b', 'c' ], - [ 'd', 'e', 'f' ], - [ 'g', 'h' ], + [ "a", "b", "c" ], + [ "d", "e", "f" ], + [ "g", "h" ] ] ``` @@ -373,23 +379,24 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### ignore Takes all the chunks, and ignore the firtst N chunk + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -404,34 +411,35 @@ Output: ```json [{ - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` #### Parameters -- `length` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Length of the feed +- `length` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Length of the feed to ignore Returns **any** ### keep -Take `Object` and throw the same object but keep only specific fields +Throw input `Object` but keep only specific fields. + Input file: ```json [{ - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }, { - a: 'abcdefg', - b: '1234567', - c: 'XXXXXXX', + "a": "abcdefg", + "b": "1234567", + "c": "XXXXXXX" }] ``` @@ -447,12 +455,12 @@ Output: ```json [{ - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }, { - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }] ``` @@ -501,19 +509,19 @@ Input file: ```json [{ - a: 'a', + a: "a" }, { - a: 2, + a: 2 }, { - a: 'b', + a: "b" }, { - a: 4, + a: 4 }, { - a: 'c', + a: "c" }] ``` @@ -529,10 +537,10 @@ Output: ```json [ { - a: 2, + a: 2 }, { - a: 4, + a: 4 } ] ``` @@ -546,24 +554,27 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### replace -Take `Object` and replace it with a new object with some fields +Take `Object` and replace it with a new object with some fields. + +See also [exchange](#exchange) and [assign](#assign). + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -579,19 +590,19 @@ Output: ```json [{ - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }, { - b: { c: "X" }, + "b": { "c": "X" } }] ``` @@ -605,23 +616,24 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### shift Return the first `Object` and close the feed + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -635,7 +647,7 @@ Output: ```json [{ - a: 1, + "a": 1 }] ``` @@ -644,16 +656,17 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### shuffle Take `Object`, shuffle data of the whole object or only some fields specified by path + Input file: ```json [{ - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }, { - a: 'abcdefg', - b: '1234567', + "a": "abcdefg", + "b": "1234567" }] ``` @@ -668,12 +681,12 @@ Output: ```json [{ - a: 'cadbefg', - b: '1234567', + "a": "cadbefg", + "b": "1234567" }, { - a: 'dcaegbf', - b: '1234567', + "a": "dcaegbf", + "b": "1234567" }] ``` @@ -685,39 +698,43 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### spawn -Take `Object` and delegate processing to an external pipeline, throw each chunk from the result -Note : works like [delegate], but each chunk use its own external pipeline +Delegate processing to an external pipeline, throw each chunk from the result. + +> **Note**: works like [delegate](#delegate), but each chunk use its own external pipeline #### Parameters - `file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a file - `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of characters -- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a object -- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a URL-like command +- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an object +- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an URL-like command - `cache` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Use a specific ezs statement to run commands (advanced) Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### swing -Takes an `Object` delegate processing to an external pipeline -under specifics conditions -Note : works like [spawn], but each chunk share the same external pipeline +Delegate processing to an external pipeline under specifics conditions + +> **Note**: works like [spawn](#spawn), but each chunk shares the same external +> pipeline. #### Parameters - `test` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** if test is true - `reverse` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** reverse the test (optional, default `false`) - `file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a file -- `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of characters -- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a object -- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a URL-like command +- `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of + characters +- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an object +- `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an URL-like + command Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### time -Measure the execution time of a script, on each chunk on input. +Measure the execution time of a script, on each chunk of input. #### Parameters @@ -770,15 +787,16 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### transit -Take `Object` and throw the same object +Take `Object` and throw the same object again. + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }] ``` @@ -792,10 +810,10 @@ Output: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }] ``` @@ -803,24 +821,25 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### truncate -Takes all the chunks, and closes the feed when the total length is equal to the parameter +Takes all the chunks, and closes the feed when the total length is equal to the parameter. + Input file: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }, { - a: 4, + "a": 4 }, { - a: 5, + "a": 5 }] ``` @@ -835,13 +854,13 @@ Output: ```json [{ - a: 1, + "a": 1 }, { - a: 2, + "a": 2 }, { - a: 3, + "a": 3 }] ``` @@ -853,16 +872,15 @@ Returns **any** ### ungroup -- **See: group - ** +Take all `chunk`s, and throw one item for every chunk. -Take all `chunk`s, and throw one item for every chunk +See also [group](#group). ```json [ - [ 'a', 'b', 'c' ], - [ 'd', 'e', 'f' ], - [ 'g', 'h' ], + [ "a", "b", "c" ], + [ "d", "e", "f" ], + [ "g", "h" ] ] ``` @@ -876,47 +894,47 @@ Output: ```json [ - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - 'h', + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h" ] ``` -Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** +Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<any>** ### unpack -Take `String` and throw `Object` builded by JSON.parse on each line +Take `String`s or `Buffer`s and throw `Object` builded by JSON.parse on each line. Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### validate -- **See: laravel validator rules - ** -- **See: - ** +From an `Object`, throw the same object if all rules pass + +See -From a `Object`, throw the same object if all rules pass +- [Laravel validator rules](https://laravel.com/docs/8.x/validation) +- Input file: ```json [{ - a: 1, - b: 'titi', + "a": 1, + "b": "titi" }, { - a: 2, - b: 'toto', + "a": 2, + "b": "toto" }, { - a: false, + "a": false }, ] ``` @@ -936,13 +954,12 @@ Output: ```json [{ - a: 1, - b: 'titi', + "a": 1, + "b": "titi" }, { - a: 2, - b: 'toto', -}, + "a": 2, + "b": "toto" }] ``` diff --git a/packages/core/src/statements/assign.js b/packages/core/src/statements/assign.js index 33b5c7fe..965ecc91 100644 --- a/packages/core/src/statements/assign.js +++ b/packages/core/src/statements/assign.js @@ -1,24 +1,25 @@ import _ from 'lodash'; /** - * Take `Object` and add new field + * Add a new field to an `Object`. + * * Input file: * * ```json * [{ - * a: 1, + * "a": 1, * }, * { - * a: 2, + * "a": 2, * }, * { - * a: 3, + * "a": 3, * }, * { - * a: 4, + * "a": 4, * }, * { - * a: 5, + * "a": 5, * }] * ``` * @@ -35,24 +36,24 @@ import _ from 'lodash'; * * ```json * [{ - * a: 1, - * b: { c: "X" }, + * "a": 1, + * "b": { "c": "X" }, * }, * { - * a: 2, - * b: { c: "X" }, + * "a": 2, + * "b": { "c": "X" }, * }, * { - * a: 3, - * b: { c: "X" }, + * "a": 3, + * "b": { "c": "X" }, * }, * { - * a: 4, - * b: { c: "X" }, + * "a": 4, + * "b": { "c": "X" }, * }, * { - * a: 5, - * b: { c: "X" }, + * "a": 5, + * "b": { "c": "X" }, * }] * ``` * diff --git a/packages/core/src/statements/concat.js b/packages/core/src/statements/concat.js index ea9dfbbf..8639c9c2 100644 --- a/packages/core/src/statements/concat.js +++ b/packages/core/src/statements/concat.js @@ -1,11 +1,11 @@ /** - * Take all `String`, concat them and thow just one + * Take all `String`, concat them and throw just one. * * ```json * [ - * 'a', - * 'b', - * 'c', + * "a", + * "b", + * "c" * ] * ``` * @@ -16,17 +16,15 @@ * beginWith = < * joinWith = | * endWith = > - * * ``` * * Output: * * ```json * [ - * '', + * "" * ] * ``` - * * @name concat * @param {String} [beginWith] Add value at the begin diff --git a/packages/core/src/statements/debug.js b/packages/core/src/statements/debug.js index 8aaa8b52..d470e7fd 100644 --- a/packages/core/src/statements/debug.js +++ b/packages/core/src/statements/debug.js @@ -2,7 +2,7 @@ import util from 'util'; import _ from 'lodash'; /** - * Take `Object` , print it and throw the same object + * Take `Object`, print it (with its number), and throw the same object. * * @name debug * @param {String} [level=log] console level : log or error diff --git a/packages/core/src/statements/delegate.js b/packages/core/src/statements/delegate.js index 53fd5ff4..cc4bc12a 100644 --- a/packages/core/src/statements/delegate.js +++ b/packages/core/src/statements/delegate.js @@ -1,8 +1,9 @@ import debug from 'debug'; /** - * Takes an `Object` delegate processing to an external pipeline - * Note : works like [spawn], but each chunk share the same external pipeline + * Delegate processing to an external pipeline. + * + * > **Note**: works like {@link spawn}, but each chunk share the same external pipeline. * * @name delegate * @param {String} [file] the external pipeline is described in a file diff --git a/packages/core/src/statements/dispatch.js b/packages/core/src/statements/dispatch.js index 2ceb6510..25aa6eb8 100644 --- a/packages/core/src/statements/dispatch.js +++ b/packages/core/src/statements/dispatch.js @@ -3,7 +3,7 @@ import debug from 'debug'; import { inspectServers, connectServer } from '../client'; /** - * Takes an `Object` dispatch processing to an external pipeline on one or more servers + * Dispatch processing to an external pipeline on one or more servers. * * @name dispatch * @param {String} [file] the external pipeline is described in a file diff --git a/packages/core/src/statements/dump.js b/packages/core/src/statements/dump.js index d96b0c49..c6e391be 100644 --- a/packages/core/src/statements/dump.js +++ b/packages/core/src/statements/dump.js @@ -1,13 +1,13 @@ /** - * Take all `Object` and generete a JSON array + * Take all `Object`s and generate a JSON array * * ```json * [ - * { a: 1 }, - * { a: 2 }, - * { a: 3 }, - * { a: 4 }, - * { a: 5 } + * { "a": 1 }, + * { "a": 2 }, + * { "a": 3 }, + * { "a": 4 }, + * { "a": 5 } * ] * ``` * @@ -16,27 +16,26 @@ * ```ini * [dump] * indent = true - * * ``` * * Output: * * ```json * [{ - * "a": 1 - * }, - * { - * "a": 2 - * }, - * { - * "a": 3 - * }, - * { - * "a": 4 - * }, - * { - * "a": 5 - * } + * "a": 1 + * }, + * { + * "a": 2 + * }, + * { + * "a": 3 + * }, + * { + * "a": 4 + * }, + * { + * "a": 5 + * } * ] * ``` * @name dump diff --git a/packages/core/src/statements/env.js b/packages/core/src/statements/env.js index 06e7a244..4601e6cb 100644 --- a/packages/core/src/statements/env.js +++ b/packages/core/src/statements/env.js @@ -1,9 +1,8 @@ import _ from 'lodash'; /** - * Take `Object` and send the same object but in the meantime, - * it is possible to add new environment field with the first - * Object of the feed + * Send the input object again, while adding new environment field(s) with the + * first `Object` of the feed. * * @name env * @param {String} [path] path of the new field diff --git a/packages/core/src/statements/exchange.js b/packages/core/src/statements/exchange.js index 95619649..96bd0afd 100644 --- a/packages/core/src/statements/exchange.js +++ b/packages/core/src/statements/exchange.js @@ -1,17 +1,19 @@ /** - * Take `Object` and throw un new item computed by the value= parameter + * Take `Object` and throw a new item computed by the `value=` parameter (which + * replace the input one). + * * Input file: * * ```json * [{ - * a: 'abcdefg', - * b: '1234567', - * c: 'XXXXXXX', + * "a": "abcdefg", + * "b": "1234567", + * "c": "XXXXXXX" * }, * { - * a: 'abcdefg', - * b: '1234567', - * c: 'XXXXXXX', + * "a": "abcdefg", + * "b": "1234567", + * "c": "XXXXXXX" * }] * ``` * @@ -20,19 +22,18 @@ * ```ini * [exchange] * value = omit('c') - * * ``` * * Output: * * ```json * [{ - * a: 'abcdefg', - * b: '1234567', + * "a": "abcdefg", + * "b": "1234567" * }, * { - * a: 'abcdefg', - * b: '1234567', + * "a": "abcdefg", + * "b": "1234567" * }] * ``` * diff --git a/packages/core/src/statements/extract.js b/packages/core/src/statements/extract.js index b373c73c..021fcd7a 100644 --- a/packages/core/src/statements/extract.js +++ b/packages/core/src/statements/extract.js @@ -2,18 +2,19 @@ import _ from 'lodash'; /** * Take `Object` and throw each value of fields - * Note: extract cannot throw undefined or null values + * + * > **Note**: extract cannot throw `undefined` or `null` values * * ```json * [{ - * a: 'abcdefg', - * b: '1234567', - * c: 'XXXXXXX', + * "a": "abcdefg", + * "b": "1234567", + * "c": "XXXXXXX" * }, * { - * a: 'abcdefg', - * b: '1234567', - * c: 'XXXXXXX', + * "a": "abcdefg", + * "b": "1234567", + * "c": "XXXXXXX" * }] * ``` * @@ -23,17 +24,16 @@ import _ from 'lodash'; * [extract] * path = a * path = b - * * ``` * * Output: * * ```json * [ - * 'abcdefg', - * '1234567', - * 'abcdefg', - * '1234567', + * "abcdefg", + * "1234567", + * "abcdefg", + * "1234567" * }] * ``` * diff --git a/packages/core/src/statements/group.js b/packages/core/src/statements/group.js index 82698009..c7ab1323 100644 --- a/packages/core/src/statements/group.js +++ b/packages/core/src/statements/group.js @@ -1,18 +1,20 @@ import settings from '../settings'; /** - * Take all `chunk`s, and throw one array of chunks + * Take all `chunk`s, and throw them grouped by `length`. + * + * See also {@link ungroup}. * * ```json * [ - * 'a', - * 'b', - * 'c', - * 'd', - * 'e', - * 'f', - * 'g', - * 'h', + * "a", + * "b", + * "c", + * "d", + * "e", + * "f", + * "g", + * "h" * ] * ``` * @@ -21,16 +23,15 @@ import settings from '../settings'; * ```ini * [group] * length = 3 - * * ``` * * Output: * * ```json * [ - * [ 'a', 'b', 'c' ], - * [ 'd', 'e', 'f' ], - * [ 'g', 'h' ], + * [ "a", "b", "c" ], + * [ "d", "e", "f" ], + * [ "g", "h" ] * ] * ``` * diff --git a/packages/core/src/statements/ignore.js b/packages/core/src/statements/ignore.js index a80c1df9..04ae5657 100644 --- a/packages/core/src/statements/ignore.js +++ b/packages/core/src/statements/ignore.js @@ -1,22 +1,23 @@ /** * Takes all the chunks, and ignore the firtst N chunk + * * Input file: * * ```json * [{ - * a: 1, + * "a": 1 * }, * { - * a: 2, + * "a": 2 * }, * { - * a: 3, + * "a": 3 * }, * { - * a: 4, + * "a": 4 * }, * { - * a: 5, + * "a": 5 * }] * ``` * @@ -25,22 +26,21 @@ * ```ini * [ignore] * length = 3 - * * ``` * * Output: * * ```json * [{ - * a: 4, + * "a": 4 * }, * { - * a: 5, + * "a": 5 * }] * ``` * * @name ignore - * @param {Number} [length] Length of the feed + * @param {Number} [length] Length of the feed to ignore * @returns {any} */ export default function ignore(data, feed) { diff --git a/packages/core/src/statements/keep.js b/packages/core/src/statements/keep.js index b4e33cc0..9d86e5c0 100644 --- a/packages/core/src/statements/keep.js +++ b/packages/core/src/statements/keep.js @@ -1,18 +1,19 @@ import _ from 'lodash'; /** - * Take `Object` and throw the same object but keep only specific fields + * Throw input `Object` but keep only specific fields. + * * Input file: * * ```json * [{ - * a: 'abcdefg', - * b: '1234567', - * c: 'XXXXXXX', + * "a": "abcdefg", + * "b": "1234567", + * "c": "XXXXXXX" * }, * { - * a: 'abcdefg', - * b: '1234567', - * c: 'XXXXXXX', + * "a": "abcdefg", + * "b": "1234567", + * "c": "XXXXXXX" * }] * ``` * @@ -22,19 +23,18 @@ import _ from 'lodash'; * [keep] * path = a * path = b - * * ``` * * Output: * * ```json * [{ - * a: 'abcdefg', - * b: '1234567', + * "a": "abcdefg", + * "b": "1234567" * }, * { - * a: 'abcdefg', - * b: '1234567', + * "a": "abcdefg", + * "b": "1234567" * }] * ``` * diff --git a/packages/core/src/statements/remove.js b/packages/core/src/statements/remove.js index afe0429c..9e845993 100644 --- a/packages/core/src/statements/remove.js +++ b/packages/core/src/statements/remove.js @@ -4,19 +4,19 @@ * * ```json * [{ - * a: 'a', + * a: "a" * }, * { - * a: 2, + * a: 2 * }, * { - * a: 'b', + * a: "b" * }, * { - * a: 4, + * a: 4 * }, * { - * a: 'c', + * a: "c" * }] * ``` * @@ -25,7 +25,6 @@ * ```ini * [remove] * test = get('a).isInteger() - * * ``` * * Output: @@ -33,10 +32,10 @@ * ```json * [ * { - * a: 2, + * a: 2 * }, * { - * a: 4, + * a: 4 * } * ] * ``` diff --git a/packages/core/src/statements/replace.js b/packages/core/src/statements/replace.js index d6073fb2..e482269a 100644 --- a/packages/core/src/statements/replace.js +++ b/packages/core/src/statements/replace.js @@ -1,24 +1,27 @@ import _ from 'lodash'; /** - * Take `Object` and replace it with a new object with some fields + * Take `Object` and replace it with a new object with some fields. + * + * See also {@link exchange} and {@link assign}. + * * Input file: * * ```json * [{ - * a: 1, + * "a": 1 * }, * { - * a: 2, + * "a": 2 * }, * { - * a: 3, + * "a": 3 * }, * { - * a: 4, + * "a": 4 * }, * { - * a: 5, + * "a": 5 * }] * ``` * @@ -28,26 +31,25 @@ import _ from 'lodash'; * [replace] * path = b.c * value = 'X' - * * ``` * * Output: * * ```json * [{ - * b: { c: "X" }, + * "b": { "c": "X" } * }, * { - * b: { c: "X" }, + * "b": { "c": "X" } * }, * { - * b: { c: "X" }, + * "b": { "c": "X" } * }, * { - * b: { c: "X" }, + * "b": { "c": "X" } * }, * { - * b: { c: "X" }, + * "b": { "c": "X" } * }] * ``` * diff --git a/packages/core/src/statements/shift.js b/packages/core/src/statements/shift.js index 56f275e5..d73ea22e 100644 --- a/packages/core/src/statements/shift.js +++ b/packages/core/src/statements/shift.js @@ -1,22 +1,23 @@ /** * Return the first `Object` and close the feed -* Input file: + * + * Input file: * * ```json * [{ - * a: 1, + * "a": 1 * }, * { - * a: 2, + * "a": 2 * }, * { - * a: 3, + * "a": 3 * }, * { - * a: 4, + * "a": 4 * }, * { - * a: 5, + * "a": 5 * }] * ``` * @@ -24,14 +25,13 @@ * * ```ini * [shift] - * * ``` * * Output: * * ```json * [{ - * a: 1, + * "a": 1 * }] * ``` * diff --git a/packages/core/src/statements/shuffle.js b/packages/core/src/statements/shuffle.js index 09b58051..5acc6e79 100644 --- a/packages/core/src/statements/shuffle.js +++ b/packages/core/src/statements/shuffle.js @@ -13,16 +13,17 @@ function shuf(input) { /** * Take `Object`, shuffle data of the whole object or only some fields specified by path + * * Input file: * * ```json * [{ - * a: 'abcdefg', - * b: '1234567', + * "a": "abcdefg", + * "b": "1234567" * }, * { - * a: 'abcdefg', - * b: '1234567', + * "a": "abcdefg", + * "b": "1234567" * }] * ``` * @@ -31,19 +32,18 @@ function shuf(input) { * ```ini * [shuffle] * path = a - * * ``` * * Output: * * ```json * [{ - * a: 'cadbefg', - * b: '1234567', + * "a": "cadbefg", + * "b": "1234567" * }, * { - * a: 'dcaegbf', - * b: '1234567', + * "a": "dcaegbf", + * "b": "1234567" * }] * ``` * diff --git a/packages/core/src/statements/spawn.js b/packages/core/src/statements/spawn.js index 6be35094..43905117 100644 --- a/packages/core/src/statements/spawn.js +++ b/packages/core/src/statements/spawn.js @@ -1,12 +1,13 @@ /** - * Take `Object` and delegate processing to an external pipeline, throw each chunk from the result - * Note : works like [delegate], but each chunk use its own external pipeline + * Delegate processing to an external pipeline, throw each chunk from the result. + * + * > **Note**: works like {@link delegate}, but each chunk use its own external pipeline * * @name spawn * @param {String} [file] the external pipeline is described in a file * @param {String} [script] the external pipeline is described in a string of characters - * @param {String} [commands] the external pipeline is described in a object - * @param {String} [command] the external pipeline is described in a URL-like command + * @param {String} [commands] the external pipeline is described in an object + * @param {String} [command] the external pipeline is described in an URL-like command * @param {String} [cache] Use a specific ezs statement to run commands (advanced) * @returns {Object} */ diff --git a/packages/core/src/statements/swing.js b/packages/core/src/statements/swing.js index fa6ab922..6ca80238 100644 --- a/packages/core/src/statements/swing.js +++ b/packages/core/src/statements/swing.js @@ -3,17 +3,20 @@ import _ from 'lodash'; import debug from 'debug'; /** - * Takes an `Object` delegate processing to an external pipeline - * under specifics conditions - * Note : works like [spawn], but each chunk share the same external pipeline + * Delegate processing to an external pipeline under specifics conditions + * + * > **Note**: works like {@link spawn}, but each chunk shares the same external + * > pipeline. * * @name swing * @param {String} [test] if test is true * @param {String} [reverse=false] reverse the test * @param {String} [file] the external pipeline is described in a file - * @param {String} [script] the external pipeline is described in a string of characters - * @param {String} [commands] the external pipeline is described in a object - * @param {String} [command] the external pipeline is described in a URL-like command + * @param {String} [script] the external pipeline is described in a string of + * characters + * @param {String} [commands] the external pipeline is described in an object + * @param {String} [command] the external pipeline is described in an URL-like + * command * @returns {Object} */ export default function swing(data, feed) { diff --git a/packages/core/src/statements/time.js b/packages/core/src/statements/time.js index 234c719f..411d9069 100644 --- a/packages/core/src/statements/time.js +++ b/packages/core/src/statements/time.js @@ -1,7 +1,7 @@ import { PassThrough } from 'stream'; /** - * Measure the execution time of a script, on each chunk on input. + * Measure the execution time of a script, on each chunk of input. * * @example Input * [1] diff --git a/packages/core/src/statements/transit.js b/packages/core/src/statements/transit.js index 000124a2..1dac7c8e 100644 --- a/packages/core/src/statements/transit.js +++ b/packages/core/src/statements/transit.js @@ -1,13 +1,14 @@ /** - * Take `Object` and throw the same object + * Take `Object` and throw the same object again. + * * Input file: * * ```json * [{ - * a: 1, + * "a": 1 * }, * { - * a: 2, + * "a": 2 * }] * ``` * @@ -15,17 +16,16 @@ * * ```ini * [transit] - * * ``` * * Output: * * ```json * [{ - * a: 1, + * "a": 1 * }, * { - * a: 2, + * "a": 2 * }] * ``` * diff --git a/packages/core/src/statements/truncate.js b/packages/core/src/statements/truncate.js index 310d20d8..6f7a4a91 100644 --- a/packages/core/src/statements/truncate.js +++ b/packages/core/src/statements/truncate.js @@ -1,22 +1,23 @@ /** - * Takes all the chunks, and closes the feed when the total length is equal to the parameter + * Takes all the chunks, and closes the feed when the total length is equal to the parameter. + * * Input file: * * ```json * [{ - * a: 1, + * "a": 1 * }, * { - * a: 2, + * "a": 2 * }, * { - * a: 3, + * "a": 3 * }, * { - * a: 4, + * "a": 4 * }, * { - * a: 5, + * "a": 5 * }] * ``` * @@ -25,20 +26,19 @@ * ```ini * [truncate] * length = 3 - * * ``` * * Output: * * ```json * [{ - * a: 1, + * "a": 1 * }, * { - * a: 2, + * "a": 2 * }, * { - * a: 3, + * "a": 3 * }] * ``` * diff --git a/packages/core/src/statements/ungroup.js b/packages/core/src/statements/ungroup.js index d4e8ab65..5ed2e0fd 100644 --- a/packages/core/src/statements/ungroup.js +++ b/packages/core/src/statements/ungroup.js @@ -1,11 +1,13 @@ /** - * Take all `chunk`s, and throw one item for every chunk + * Take all `chunk`s, and throw one item for every chunk. + * + * See also {@link group}. * * ```json * [ - * [ 'a', 'b', 'c' ], - * [ 'd', 'e', 'f' ], - * [ 'g', 'h' ], + * [ "a", "b", "c" ], + * [ "d", "e", "f" ], + * [ "g", "h" ] * ] * ``` * @@ -13,27 +15,25 @@ * * ```ini * [ungroup] - * * ``` * * Output: * * ```json * [ - * 'a', - * 'b', - * 'c', - * 'd', - * 'e', - * 'f', - * 'g', - * 'h', + * "a", + * "b", + * "c", + * "d", + * "e", + * "f", + * "g", + * "h" * ] * ``` * * @name ungroup - * @returns {String} - * @see group + * @returns {Array} */ export default function ungroup(data, feed) { if (this.isLast()) { diff --git a/packages/core/src/statements/unpack.js b/packages/core/src/statements/unpack.js index 186fc48e..6f561b0a 100644 --- a/packages/core/src/statements/unpack.js +++ b/packages/core/src/statements/unpack.js @@ -1,7 +1,7 @@ const eol = '\n'; /** - * Take `String` and throw `Object` builded by JSON.parse on each line + * Take `String`s or `Buffer`s and throw `Object` builded by JSON.parse on each line. * * @name unpack * @returns {object} diff --git a/packages/core/src/statements/validate.js b/packages/core/src/statements/validate.js index fc10b246..a1234756 100644 --- a/packages/core/src/statements/validate.js +++ b/packages/core/src/statements/validate.js @@ -3,21 +3,26 @@ import _ from 'lodash'; import Validator from 'validatorjs'; /** - * From a `Object`, throw the same object if all rules pass + * From an `Object`, throw the same object if all rules pass + * + * See + * + * - {@link https://laravel.com/docs/8.x/validation Laravel validator rules} + * - {@link https://github.com/skaterdav85/validatorjs#readme} * * Input file: * * ```json * [{ - * a: 1, - * b: 'titi', + * "a": 1, + * "b": "titi" * }, * { - * a: 2, - * b: 'toto', + * "a": 2, + * "b": "toto" * }, * { - * a: false, + * "a": false * }, * ] * ``` @@ -31,28 +36,24 @@ import Validator from 'validatorjs'; * * path = a * rule = required|string - * * ``` * * Output: * * ```json * [{ - * a: 1, - * b: 'titi', + * "a": 1, + * "b": "titi" * }, * { - * a: 2, - * b: 'toto', - * }, + * "a": 2, + * "b": "toto" * }] * ``` * * @name validate * @param {String} [path] path of the field * @param {String} [rule] rule to validate the field - * @see laravel validator rules - * @see https://github.com/skaterdav85/validatorjs#readme * @returns {Object} */ export default function validate(data, feed) { From e596a67454968fe12fe9bbf395a9a8ebad099404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Wed, 21 Jul 2021 11:46:24 +0200 Subject: [PATCH 02/13] docs(basics): Fix bad JSDoc --- docs/plugin-basics.md | 64 +++++++++++++----------------- packages/basics/README.md | 64 +++++++++++++----------------- packages/basics/src/csv-object.js | 7 ++-- packages/basics/src/csv-parse.js | 9 +++-- packages/basics/src/csv-string.js | 3 +- packages/basics/src/json-parse.js | 3 +- packages/basics/src/obj-flatten.js | 3 +- packages/basics/src/url-parse.js | 7 +++- packages/basics/src/url-string.js | 3 +- packages/basics/src/xml-convert.js | 4 +- packages/basics/src/xml-parse.js | 2 +- packages/basics/src/xml-string.js | 2 +- 12 files changed, 84 insertions(+), 87 deletions(-) diff --git a/docs/plugin-basics.md b/docs/plugin-basics.md index b68436d4..58b30b1e 100644 --- a/docs/plugin-basics.md +++ b/docs/plugin-basics.md @@ -52,14 +52,13 @@ Returns **[Buffer](https://nodejs.org/api/buffer.html)** ### CSVObject -- **See: CSVParse - ** - Take an `Array` of arrays and transform rows into objects. Each row (Array) is tranformed into an object where keys are the values of the first row. +See [CSVParse](#csvparse). + Input: ```json @@ -95,7 +94,7 @@ Input: ```json [ ["a", "a", "b", "b", "b"], - [1, 2, 3, 4, 5], + [1, 2, 3, 4, 5] ] ``` @@ -107,7 +106,7 @@ Output: "a2": 2, "b1": 3, "b2": 4, - "b3": 5, + "b3": 5 }] ``` @@ -119,12 +118,12 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/ ### CSVParse -- **See: - ** -- **See: CSVObject - ** +Take `String` and parse it as CSV to generate arrays. + +See: -Take `String` and parse it as CSV to generate arrays +- [CSVObject](#csvobject) +- Input: @@ -152,14 +151,13 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### CSVString -- **See: CSVObject - ** - Take an array of objects and transform row into a string where each field is separated with a character. The resulting string is CSV-compliant. +See [CSVObject](#csvobject) + Input: ```json @@ -244,11 +242,10 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### JSONParse -- **See: - ** - Parse a `String` to JSON and generate objects. +See + ##### Example 1: with separator Input: @@ -337,11 +334,10 @@ Returns **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### OBJFlatten -- **See: - ** - Flatten an `Object` with a path delimiting character. +See + Input: ```json @@ -574,11 +570,6 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### URLParse -- **See: URLString - ** -- **See: - ** - Take an URL `String`, parse it and return `Object`. Fields of the returned object: @@ -597,6 +588,11 @@ Fields of the returned object: URLString statement convert such an object to a string. +See: + +- [URLString](#urlstring) +- + Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### URLStream @@ -668,18 +664,14 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### URLString -- **See: URLParse - ** - Take an `Object` representing an URL and stringify it. +See [URLParse](#urlparse) + Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### XMLConvert -- **See: - ** - Convert each chunk as XML String to JSON Object ##### Example 1: XML to JSON (default parameters) @@ -742,6 +734,8 @@ Output: ] ``` +See + #### Parameters - `invert` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** change conversion (JSON to XML) (optional, default `false`) @@ -751,9 +745,6 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### XMLParse -- **See: - ** - Take `String` as XML input, parse it and split it in multi document at each path found Input: @@ -775,6 +766,8 @@ Output: ["x", "y"] ``` +See + #### Parameters - `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** choose a character for flatten keys (optional, default `"/"`) @@ -783,9 +776,6 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### XMLString -- **See: XMLParse - ** - Transform an `Object` into an XML string. Input: @@ -802,6 +792,8 @@ Output: ] ``` +See [XMLParse](#xmlparse) + #### Parameters - `rootElement` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Root element name for the tag which starts and close the feed (optional, default `"items"`) diff --git a/packages/basics/README.md b/packages/basics/README.md index b68436d4..58b30b1e 100644 --- a/packages/basics/README.md +++ b/packages/basics/README.md @@ -52,14 +52,13 @@ Returns **[Buffer](https://nodejs.org/api/buffer.html)** ### CSVObject -- **See: CSVParse - ** - Take an `Array` of arrays and transform rows into objects. Each row (Array) is tranformed into an object where keys are the values of the first row. +See [CSVParse](#csvparse). + Input: ```json @@ -95,7 +94,7 @@ Input: ```json [ ["a", "a", "b", "b", "b"], - [1, 2, 3, 4, 5], + [1, 2, 3, 4, 5] ] ``` @@ -107,7 +106,7 @@ Output: "a2": 2, "b1": 3, "b2": 4, - "b3": 5, + "b3": 5 }] ``` @@ -119,12 +118,12 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/ ### CSVParse -- **See: - ** -- **See: CSVObject - ** +Take `String` and parse it as CSV to generate arrays. + +See: -Take `String` and parse it as CSV to generate arrays +- [CSVObject](#csvobject) +- Input: @@ -152,14 +151,13 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### CSVString -- **See: CSVObject - ** - Take an array of objects and transform row into a string where each field is separated with a character. The resulting string is CSV-compliant. +See [CSVObject](#csvobject) + Input: ```json @@ -244,11 +242,10 @@ Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### JSONParse -- **See: - ** - Parse a `String` to JSON and generate objects. +See + ##### Example 1: with separator Input: @@ -337,11 +334,10 @@ Returns **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### OBJFlatten -- **See: - ** - Flatten an `Object` with a path delimiting character. +See + Input: ```json @@ -574,11 +570,6 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### URLParse -- **See: URLString - ** -- **See: - ** - Take an URL `String`, parse it and return `Object`. Fields of the returned object: @@ -597,6 +588,11 @@ Fields of the returned object: URLString statement convert such an object to a string. +See: + +- [URLString](#urlstring) +- + Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### URLStream @@ -668,18 +664,14 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### URLString -- **See: URLParse - ** - Take an `Object` representing an URL and stringify it. +See [URLParse](#urlparse) + Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### XMLConvert -- **See: - ** - Convert each chunk as XML String to JSON Object ##### Example 1: XML to JSON (default parameters) @@ -742,6 +734,8 @@ Output: ] ``` +See + #### Parameters - `invert` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** change conversion (JSON to XML) (optional, default `false`) @@ -751,9 +745,6 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### XMLParse -- **See: - ** - Take `String` as XML input, parse it and split it in multi document at each path found Input: @@ -775,6 +766,8 @@ Output: ["x", "y"] ``` +See + #### Parameters - `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** choose a character for flatten keys (optional, default `"/"`) @@ -783,9 +776,6 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### XMLString -- **See: XMLParse - ** - Transform an `Object` into an XML string. Input: @@ -802,6 +792,8 @@ Output: ] ``` +See [XMLParse](#xmlparse) + #### Parameters - `rootElement` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Root element name for the tag which starts and close the feed (optional, default `"items"`) diff --git a/packages/basics/src/csv-object.js b/packages/basics/src/csv-object.js index 2b6c802c..7850e3f9 100644 --- a/packages/basics/src/csv-object.js +++ b/packages/basics/src/csv-object.js @@ -45,6 +45,8 @@ function CSVObject(data, feed) { * Each row (Array) is tranformed into an object where keys are the values of * the first row. * + * See {@link CSVParse}. + * * Input: * * ```json @@ -79,7 +81,7 @@ function CSVObject(data, feed) { * ```json * [ * ["a", "a", "b", "b", "b"], - * [1, 2, 3, 4, 5], + * [1, 2, 3, 4, 5] * ] * ``` * @@ -91,12 +93,11 @@ function CSVObject(data, feed) { * "a2": 2, * "b1": 3, * "b2": 4, - * "b3": 5, + * "b3": 5 * }] * ``` * * @name CSVObject - * @see CSVParse * @param {undefined} none * @returns {Object|Object[]} */ diff --git a/packages/basics/src/csv-parse.js b/packages/basics/src/csv-parse.js index e83b6386..1d52edbb 100644 --- a/packages/basics/src/csv-parse.js +++ b/packages/basics/src/csv-parse.js @@ -16,7 +16,12 @@ function CSVParse(data, feed) { } /** - * Take `String` and parse it as CSV to generate arrays + * Take `String` and parse it as CSV to generate arrays. + * + * See: + * + * - {@link CSVObject} + * - {@link https://github.com/Inist-CNRS/node-csv-string} * * Input: * @@ -39,8 +44,6 @@ function CSVParse(data, feed) { * @param {String} [separator=auto] to indicate the CSV separator * @param {String} [quote=auto] to indicate the CSV quote. * @returns {Array} - * @see https://github.com/Inist-CNRS/node-csv-string - * @see CSVObject */ export default { CSVParse, diff --git a/packages/basics/src/csv-string.js b/packages/basics/src/csv-string.js index c5b5ac87..a56fa5d8 100644 --- a/packages/basics/src/csv-string.js +++ b/packages/basics/src/csv-string.js @@ -42,6 +42,8 @@ function CSVString(data, feed) { * * The resulting string is CSV-compliant. * + * See {@link CSVObject} + * * Input: * * ```json @@ -70,7 +72,6 @@ function CSVString(data, feed) { * @param {String} [separator=";"] to indicate the CSV separator * @param {Boolean} [header=true] first line contains key name * @returns {String} - * @see CSVObject */ export default { CSVString, diff --git a/packages/basics/src/json-parse.js b/packages/basics/src/json-parse.js index 1be25523..3f3190da 100644 --- a/packages/basics/src/json-parse.js +++ b/packages/basics/src/json-parse.js @@ -20,6 +20,8 @@ function JSONParse(data, feed) { /** * Parse a `String` to JSON and generate objects. * + * See {@link https://github.com/dominictarr/JSONStream} + * * #### Example 1: with separator * * Input: @@ -58,7 +60,6 @@ function JSONParse(data, feed) { * @name JSONParse * @param {String} [separator="*"] to split at every JSONPath found * @returns {Object} - * @see https://github.com/dominictarr/JSONStream */ export default { JSONParse, diff --git a/packages/basics/src/obj-flatten.js b/packages/basics/src/obj-flatten.js index 7522d9fc..29d1db1d 100644 --- a/packages/basics/src/obj-flatten.js +++ b/packages/basics/src/obj-flatten.js @@ -3,6 +3,8 @@ import flatten, { unflatten } from 'flat'; /** * Flatten an `Object` with a path delimiting character. * + * See {@link https://www.npmjs.com/package/flat} + * * Input: * * ```json @@ -25,7 +27,6 @@ import flatten, { unflatten } from 'flat'; * @param {String} [separator="/"] choose a character to flatten keys * @param {Boolean} [safe=false] preserve arrays and their contents, * @returns {Object} - * @see https://www.npmjs.com/package/flat */ export default function OBJFlatten(data, feed) { if (this.isLast()) { diff --git a/packages/basics/src/url-parse.js b/packages/basics/src/url-parse.js index 10dca22d..c19e304b 100644 --- a/packages/basics/src/url-parse.js +++ b/packages/basics/src/url-parse.js @@ -39,10 +39,13 @@ function URLParse(data, feed) { * * URLString statement convert such an object to a string. * + * See: + * + * - {@link URLString} + * - {@link https://nodejs.org/api/url.html} + * * @name URLParse * @returns {Object} - * @see URLString - * @see https://nodejs.org/api/url.html */ export default { URLParse, diff --git a/packages/basics/src/url-string.js b/packages/basics/src/url-string.js index 4340203e..753a4662 100644 --- a/packages/basics/src/url-string.js +++ b/packages/basics/src/url-string.js @@ -10,9 +10,10 @@ function URLString(data, feed) { /** * Take an `Object` representing an URL and stringify it. * + * See {@link URLParse} + * * @name URLString * @returns {String} - * @see URLParse */ export default { URLString, diff --git a/packages/basics/src/xml-convert.js b/packages/basics/src/xml-convert.js index 8c70c291..4d6bb667 100644 --- a/packages/basics/src/xml-convert.js +++ b/packages/basics/src/xml-convert.js @@ -72,12 +72,14 @@ function XMLConvert(data, feed) { * "\n", * "\n", * ] + * ``` + * + * See {@link https://www.npmjs.com/package/xml-mapping} * * @name XMLConvert * @param {String} [invert=false] change conversion (JSON to XML) * @param {String} [prologue=false] add XML prologue * @returns {Object} - * @see https://www.npmjs.com/package/xml-mapping */ export default { XMLConvert, diff --git a/packages/basics/src/xml-parse.js b/packages/basics/src/xml-parse.js index 4ca02d53..c9bd4225 100644 --- a/packages/basics/src/xml-parse.js +++ b/packages/basics/src/xml-parse.js @@ -45,10 +45,10 @@ function XMLParse(data, feed) { * ["x", "y"] * ``` * + * See {@link https://www.npmjs.com/package/xml-splitter} * @name XMLParse * @param {String} [separator="/"] choose a character for flatten keys * @returns {Object} - * @see https://www.npmjs.com/package/xml-splitter */ export default { XMLParse, diff --git a/packages/basics/src/xml-string.js b/packages/basics/src/xml-string.js index f50e6ab9..f782b93d 100644 --- a/packages/basics/src/xml-string.js +++ b/packages/basics/src/xml-string.js @@ -51,13 +51,13 @@ function XMLString(data, feed) { * ] * ``` * + * See {@link XMLParse} * @name XMLString * @param {String} [rootElement="items"] Root element name for the tag which starts and close the feed * @param {String} [contentElement="item"] Content element name for the tag which starts and closes each item * @param {String} [rootNamespace] Namespace for the root tag (xmlns=) * @param {Boolean} [prologue=false] Add XML prologue ` Date: Wed, 21 Jul 2021 12:06:06 +0200 Subject: [PATCH 03/13] docs(istex): Fix bad JSDoc --- docs/plugin-istex.md | 93 ++++++++------------ packages/istex/README.md | 93 ++++++++------------ packages/istex/src/files-content.js | 2 +- packages/istex/src/files-wrap.js | 2 +- packages/istex/src/files.js | 2 +- packages/istex/src/istex-parse-dot-corpus.js | 10 ++- packages/istex/src/istex-result.js | 2 +- packages/istex/src/istex-save.js | 6 +- packages/istex/src/istex-triplify.js | 23 +++-- packages/istex/src/uniq.js | 17 +++- 10 files changed, 121 insertions(+), 129 deletions(-) diff --git a/docs/plugin-istex.md b/docs/plugin-istex.md index 73a7c109..0087d97e 100644 --- a/docs/plugin-istex.md +++ b/docs/plugin-istex.md @@ -109,11 +109,10 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXFiles -- **See: ISTEXScroll - ** - Take an Object with ISTEX `id` and generate an object for each file +See [ISTEXScroll](#istexscroll) + #### Parameters - `fulltext` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** typology of the document to save (optional, default `pdf`) @@ -125,13 +124,12 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXFilesContent -- **See: ISTEXFiles - ** - Take an Object with ISTEX `source` and check the document's file. Warning: to access fulltext, you have to give a `token` parameter. ISTEXFetch produces the stream you need to save the file. +See [ISTEXFiles](#istexfiles) + #### Parameters - `sid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User-agent identifier (optional, default `"ezs-istex"`) @@ -141,11 +139,10 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### ISTEXFilesWrap -- **See: ISTEXFiles - ** - Take and Object with ISTEX `stream` and wrap into a single zip +See [ISTEXFiles](#istexfiles) + Returns **[Buffer](https://nodejs.org/api/buffer.html)** ### ISTEXParseDotCorpus @@ -153,12 +150,9 @@ Returns **[Buffer](https://nodejs.org/api/buffer.html)** Parse a `.corpus` file content, and execute the action contained in the `.corpus` file. -#### Examples - -1query.corpus - +1query.corpus -```javascript +```ini [ISTEX] query = language.raw:rum field = doi @@ -171,10 +165,9 @@ field = host field = fulltext ``` -1notice.corpus - +1notice.corpus -```javascript +```ini [ISTEX] id 2FF3F5B1477986B9C617BB75CA3333DBEE99EB05 ``` @@ -183,14 +176,13 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### ISTEXResult -- **See: ISTEXScroll - ** - Take `Object` containing results of ISTEX API, and returns `hits` value (documents). This should be placed after ISTEXScroll. +See [ISTEXScroll](#istexscroll) + #### Parameters - `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `data`) @@ -200,12 +192,13 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXSave -- **See: ISTEXFetch - ** - Take and Object with ISTEX `id` and save the document's file. + Warning: to access fulltext, you have to give a `token` parameter. -ISTEXFetch produces the stream you need to save the file. + +[ISTEXFetch](#istexfetch) produces the stream you need to save the file. + +See [ISTEXFetch](#istexfetch) #### Parameters @@ -246,26 +239,18 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXTriplify -- **See: ISTEXResult - ** -- **See: OBJFlatten (from ezs-basics) - ** - Take `Object` containing flatten hits from ISTEXResult. If the environment variable DEBUG is set, some errors could appear on stderr. -#### Parameters - -- `property` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** path to uri for the properties to output (property and uri separated by `->`) (optional, default `[]`) -- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the root of the keys (ex: `istex/`) (optional, default `""`) - -#### Examples +See -data: +- [ISTEXResult](#istexresult) +- [OBJFlatten](https://inist-cnrs.github.io/ezs/#/plugin-basics?id=objflatten) (from `@ezs/basics`) +data: -```javascript +```js { 'author/0/name': 'Geoffrey Strickland', 'author/0/affiliations/0': 'University of Reading', @@ -279,10 +264,9 @@ data: } ``` -javascript: - +javascript: -```javascript +```js .pipe(ezs('ISTEXTriplify', { property: [ 'doi/0 -> http://purl.org/ontology/bibo/doi', @@ -293,11 +277,10 @@ javascript: )); ``` -output: - + output: -```javascript - +```turtle + a ; "10.1002/zaac.19936190205" ; "F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483" ; @@ -305,6 +288,11 @@ output: "University of Reading" ; ``` +#### Parameters + +- `property` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** path to uri for the properties to output (property and uri separated by `->`) (optional, default `[]`) +- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the root of the keys (ex: `istex/`) (optional, default `""`) + Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### ISTEXUniq @@ -315,29 +303,24 @@ subject). Assume that every triple of a document (except the first one) follows another triple of the same document. -#### Examples - -Input: - +Input: -```javascript +```turtle "S Corbett" . "Department of Public Health, University of Sydney, Australia." . "Department of Public Health, University of Sydney, Australia." . "Department of Public Health, University of Sydney, Australia." . ``` -Action in a `.ezs` script - +Action in a `.ezs` script -```javascript +```ini [ISTEXUniq] ``` -Output +Output - -```javascript +```n3 "S Corbett" . "Department of Public Health, University of Sydney, Australia." . ``` diff --git a/packages/istex/README.md b/packages/istex/README.md index 73a7c109..0087d97e 100644 --- a/packages/istex/README.md +++ b/packages/istex/README.md @@ -109,11 +109,10 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXFiles -- **See: ISTEXScroll - ** - Take an Object with ISTEX `id` and generate an object for each file +See [ISTEXScroll](#istexscroll) + #### Parameters - `fulltext` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** typology of the document to save (optional, default `pdf`) @@ -125,13 +124,12 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXFilesContent -- **See: ISTEXFiles - ** - Take an Object with ISTEX `source` and check the document's file. Warning: to access fulltext, you have to give a `token` parameter. ISTEXFetch produces the stream you need to save the file. +See [ISTEXFiles](#istexfiles) + #### Parameters - `sid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User-agent identifier (optional, default `"ezs-istex"`) @@ -141,11 +139,10 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### ISTEXFilesWrap -- **See: ISTEXFiles - ** - Take and Object with ISTEX `stream` and wrap into a single zip +See [ISTEXFiles](#istexfiles) + Returns **[Buffer](https://nodejs.org/api/buffer.html)** ### ISTEXParseDotCorpus @@ -153,12 +150,9 @@ Returns **[Buffer](https://nodejs.org/api/buffer.html)** Parse a `.corpus` file content, and execute the action contained in the `.corpus` file. -#### Examples - -1query.corpus - +1query.corpus -```javascript +```ini [ISTEX] query = language.raw:rum field = doi @@ -171,10 +165,9 @@ field = host field = fulltext ``` -1notice.corpus - +1notice.corpus -```javascript +```ini [ISTEX] id 2FF3F5B1477986B9C617BB75CA3333DBEE99EB05 ``` @@ -183,14 +176,13 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### ISTEXResult -- **See: ISTEXScroll - ** - Take `Object` containing results of ISTEX API, and returns `hits` value (documents). This should be placed after ISTEXScroll. +See [ISTEXScroll](#istexscroll) + #### Parameters - `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `data`) @@ -200,12 +192,13 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXSave -- **See: ISTEXFetch - ** - Take and Object with ISTEX `id` and save the document's file. + Warning: to access fulltext, you have to give a `token` parameter. -ISTEXFetch produces the stream you need to save the file. + +[ISTEXFetch](#istexfetch) produces the stream you need to save the file. + +See [ISTEXFetch](#istexfetch) #### Parameters @@ -246,26 +239,18 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl ### ISTEXTriplify -- **See: ISTEXResult - ** -- **See: OBJFlatten (from ezs-basics) - ** - Take `Object` containing flatten hits from ISTEXResult. If the environment variable DEBUG is set, some errors could appear on stderr. -#### Parameters - -- `property` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** path to uri for the properties to output (property and uri separated by `->`) (optional, default `[]`) -- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the root of the keys (ex: `istex/`) (optional, default `""`) - -#### Examples +See -data: +- [ISTEXResult](#istexresult) +- [OBJFlatten](https://inist-cnrs.github.io/ezs/#/plugin-basics?id=objflatten) (from `@ezs/basics`) +data: -```javascript +```js { 'author/0/name': 'Geoffrey Strickland', 'author/0/affiliations/0': 'University of Reading', @@ -279,10 +264,9 @@ data: } ``` -javascript: - +javascript: -```javascript +```js .pipe(ezs('ISTEXTriplify', { property: [ 'doi/0 -> http://purl.org/ontology/bibo/doi', @@ -293,11 +277,10 @@ javascript: )); ``` -output: - + output: -```javascript - +```turtle + a ; "10.1002/zaac.19936190205" ; "F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483" ; @@ -305,6 +288,11 @@ output: "University of Reading" ; ``` +#### Parameters + +- `property` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** path to uri for the properties to output (property and uri separated by `->`) (optional, default `[]`) +- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the root of the keys (ex: `istex/`) (optional, default `""`) + Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### ISTEXUniq @@ -315,29 +303,24 @@ subject). Assume that every triple of a document (except the first one) follows another triple of the same document. -#### Examples - -Input: - +Input: -```javascript +```turtle "S Corbett" . "Department of Public Health, University of Sydney, Australia." . "Department of Public Health, University of Sydney, Australia." . "Department of Public Health, University of Sydney, Australia." . ``` -Action in a `.ezs` script - +Action in a `.ezs` script -```javascript +```ini [ISTEXUniq] ``` -Output +Output - -```javascript +```n3 "S Corbett" . "Department of Public Health, University of Sydney, Australia." . ``` diff --git a/packages/istex/src/files-content.js b/packages/istex/src/files-content.js index 901da248..4f30bb7b 100644 --- a/packages/istex/src/files-content.js +++ b/packages/istex/src/files-content.js @@ -6,8 +6,8 @@ import getStream from 'get-stream'; * Warning: to access fulltext, you have to give a `token` parameter. * ISTEXFetch produces the stream you need to save the file. * + * See {@link ISTEXFiles} * @name ISTEXFilesContent - * @see ISTEXFiles * @param {string} [sid="ezs-istex"] User-agent identifier * @param {string} [token] authentication token (see [documentation](https://doc.istex.fr/api/access/fede.html#acc%C3%A8s-programmatique-via-un-token-didentification)) * @returns {Object} diff --git a/packages/istex/src/files-wrap.js b/packages/istex/src/files-wrap.js index 82019e02..02c5e68a 100644 --- a/packages/istex/src/files-wrap.js +++ b/packages/istex/src/files-wrap.js @@ -15,8 +15,8 @@ const add2archive = (archive, { content, name }) => { /** * Take and Object with ISTEX `stream` and wrap into a single zip * + * See {@link ISTEXFiles} * @name ISTEXFilesWrap - * @see ISTEXFiles * @returns {Buffer} */ function ISTEXFilesWrap(data, feed) { diff --git a/packages/istex/src/files.js b/packages/istex/src/files.js index fd0e06b4..94000a5e 100644 --- a/packages/istex/src/files.js +++ b/packages/istex/src/files.js @@ -3,8 +3,8 @@ import URL from 'url'; /** * Take an Object with ISTEX `id` and generate an object for each file * + * See {@link ISTEXScroll} * @name ISTEXFiles - * @see ISTEXScroll * @param {string} [fulltext=pdf] typology of the document to save * @param {string} [metadata=json] format of the files to save * @param {string} [enrichment] enrichment of the document to save diff --git a/packages/istex/src/istex-parse-dot-corpus.js b/packages/istex/src/istex-parse-dot-corpus.js index 8b4d45af..8667b45a 100644 --- a/packages/istex/src/istex-parse-dot-corpus.js +++ b/packages/istex/src/istex-parse-dot-corpus.js @@ -9,7 +9,9 @@ ezs.use(istex); * Parse a `.corpus` file content, and execute the action contained in the * `.corpus` file. * - * @example 1query.corpus + * 1query.corpus + * + * ```ini * [ISTEX] * query = language.raw:rum * field = doi @@ -20,10 +22,14 @@ ezs.use(istex); * field = keywords * field = host * field = fulltext + * ``` + * + * 1notice.corpus * - * @example 1notice.corpus + * ```ini * [ISTEX] * id 2FF3F5B1477986B9C617BB75CA3333DBEE99EB05 + * ``` * * @name ISTEXParseDotCorpus * @returns {Object} diff --git a/packages/istex/src/istex-result.js b/packages/istex/src/istex-result.js index 655da46c..7adddf69 100644 --- a/packages/istex/src/istex-result.js +++ b/packages/istex/src/istex-result.js @@ -7,8 +7,8 @@ import { newValue } from './utils'; * * This should be placed after ISTEXScroll. * + * See {@link ISTEXScroll} * @name ISTEXResult - * @see ISTEXScroll * @param {string} [source=data] * @param {string} [target=feed] * @returns {Array} diff --git a/packages/istex/src/istex-save.js b/packages/istex/src/istex-save.js index ad9338a8..973993ae 100644 --- a/packages/istex/src/istex-save.js +++ b/packages/istex/src/istex-save.js @@ -21,11 +21,13 @@ const worker = (options) => ({ source, target }, done) => fetch(source, options) /** * Take and Object with ISTEX `id` and save the document's file. + * * Warning: to access fulltext, you have to give a `token` parameter. - * ISTEXFetch produces the stream you need to save the file. * + * {@link ISTEXFetch} produces the stream you need to save the file. + * + * See {@link ISTEXFetch} * @name ISTEXSave - * @see ISTEXFetch * @param {string} [directory=current working directory] path for the PDFs * @param {string} [typology="fulltext"] typology of the document to save * @param {string} [format="pdf"] format of the files to save diff --git a/packages/istex/src/istex-triplify.js b/packages/istex/src/istex-triplify.js index 61fcc62a..2275b0d9 100644 --- a/packages/istex/src/istex-triplify.js +++ b/packages/istex/src/istex-triplify.js @@ -3,11 +3,13 @@ * * If the environment variable DEBUG is set, some errors could appear on stderr. * - * @name ISTEXTriplify - * @see ISTEXResult - * @see OBJFlatten (from ezs-basics) + * See + * - {@link ISTEXResult} + * - {@link https://inist-cnrs.github.io/ezs/#/plugin-basics?id=objflatten OBJFlatten} (from `@ezs/basics`) + * + * data: * - * @example data: + * ```js * { * 'author/0/name': 'Geoffrey Strickland', * 'author/0/affiliations/0': 'University of Reading', @@ -19,8 +21,11 @@ * 'id': 'F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483', * 'score': 1 * } + * ``` + * + * javascript: * - * @example javascript: + * ```js * .pipe(ezs('ISTEXTriplify', { * property: [ * 'doi/0 -> http://purl.org/ontology/bibo/doi', @@ -29,17 +34,21 @@ * 'author/\\d+/affiliations -> https://data.istex.fr/ontology/istex#affiliation', * ], * )); + * ``` * - * @example output: + * output: + * + * ```turtle * * a ; * "10.1002/zaac.19936190205" ; * "F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483" ; * "Geoffrey Strickland" ; * "University of Reading" ; + * ``` * + * @name ISTEXTriplify * @param {Object} [property=[]] path to uri for the properties to output (property and uri separated by ` -> `) - * * @param {string} [source=""] the root of the keys (ex: `istex/`) * @returns {string} */ diff --git a/packages/istex/src/uniq.js b/packages/istex/src/uniq.js index bb7437fc..c3ea0e45 100644 --- a/packages/istex/src/uniq.js +++ b/packages/istex/src/uniq.js @@ -69,20 +69,29 @@ function ISTEXUniq(data, feed) { * Assume that every triple of a document (except the first one) follows another * triple of the same document. * - * @name ISTEXUniq + * Input: * - * @example Input: + * ```turtle * "S Corbett" . * "Department of Public Health, University of Sydney, Australia." . * "Department of Public Health, University of Sydney, Australia." . * "Department of Public Health, University of Sydney, Australia." . + * ``` + * + * Action in a `.ezs` script * - * @example Action in a `.ezs` script + * ```ini * [ISTEXUniq] + * ``` + * + * Output * - * @example Output + * ```n3 * "S Corbett" . * "Department of Public Health, University of Sydney, Australia." . + * ``` + * + * @name ISTEXUniq */ export default { ISTEXUniq, From f2706cb04563aac8406e5f89a73838ea3c15a7b1 Mon Sep 17 00:00:00 2001 From: Nicolas Thouvenin Date: Thu, 22 Jul 2021 13:37:29 +0200 Subject: [PATCH 04/13] =?UTF-8?q?fix:=20=F0=9F=90=9B=20to=20avoid=20losing?= =?UTF-8?q?=20items=20that=20were=20skipped?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/analytics/src/expand.js | 39 ++++++++++++++++++++++++---- packages/analytics/test/expand.js | 42 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/packages/analytics/src/expand.js b/packages/analytics/src/expand.js index a5ee8975..ad99a8d8 100644 --- a/packages/analytics/src/expand.js +++ b/packages/analytics/src/expand.js @@ -8,7 +8,12 @@ async function mergeWith(data, feed) { if (this.isLast()) { return feed.close(); } - const { store, cache } = this.getEnv(); + const { + store, + cache, + stack, + bufferID, + } = this.getEnv(); const { id, value } = data; const path = this.getParam('path'); try { @@ -20,6 +25,7 @@ async function mergeWith(data, feed) { if (cache && source) { await cache.put(source, value); } + delete stack[bufferID][id]; set(obj, path, value); return feed.send(obj); } catch (e) { @@ -95,24 +101,46 @@ export default async function expand(data, feed) { this.cache = createPersistentStore(ezs, `expand${cacheName}`, location); } if (!this.buffer2stream) { - this.buffer2stream = () => { + this.buffer2stream = (bufferID) => { const statements = this.createStatements(); const stream = ezs.createStream(ezs.objectMode()); const output = ezs.createPipeline(stream, statements) .pipe(ezs(mergeWith, { path }, { store: this.store, cache: this.cache, + stack: this.stack, + bufferID, })) - .pipe(ezs.catch()); + .pipe(ezs.catch()) + .on('end', () => each( + Object.keys(this.stack[bufferID]), + async (cur, next) => { + try { + const obj = await this.store.get(cur); + if (obj === null) { + throw new Error('id has been lost'); + } + feed.write(obj); + } catch (e) { + feed.write(e); + } + next(); + }, + )); const input = Array.from(this.buffer); this.buffer = []; + this.bufferID += 1; + this.stack[this.bufferID] = {}; each(input, (cur, next) => ezs.writeTo(stream, cur, next), () => stream.end()); return output; }; } if (!this.buffer) { + this.stack = []; this.buffer = []; + this.bufferID = 0; + this.stack[this.bufferID] = {}; } if (!this.store) { const location = this.getParam('location'); @@ -124,7 +152,7 @@ export default async function expand(data, feed) { if (this.isLast()) { if (this.buffer && this.buffer.length > 0) { - return feed.flow(this.buffer2stream()); + return feed.flow(this.buffer2stream(this.bufferID)); } return feed.close(); } @@ -144,9 +172,10 @@ export default async function expand(data, feed) { await this.store.put(id, data); + this.stack[this.bufferID][id] = true; this.buffer.push(core(id, value)); if (this.buffer.length >= size) { - return feed.flow(this.buffer2stream()); + return feed.flow(this.buffer2stream(this.bufferID)); } return feed.end(); } catch (e) { diff --git a/packages/analytics/test/expand.js b/packages/analytics/test/expand.js index 4e600a7d..ee0d9457 100644 --- a/packages/analytics/test/expand.js +++ b/packages/analytics/test/expand.js @@ -615,3 +615,45 @@ test('with script (all values) #2 with cache', (done) => { done(); }); }); +test('with a script that loses some items', (done) => { + ezs.use(statements); + const output = []; + const input = [ + { a: 1, b: 'a' }, + { a: 2, b: 'b' }, + { a: 3, b: 'c' }, + { a: 4, b: 'd' }, + { a: 5, b: 'e' }, + { a: 6, b: 'f' }, + ]; + const script = ` + [use] + plugin = analytics + + [drop] + if = c + + [assign] + path = value + value = get('value').toUpper() + `; + + from(input) + .pipe(ezs('expand', { path: 'b', script })) + .pipe(ezs.catch()) + .on('error', done) + .on('data', (chunk) => { + output.push(chunk); + }) + .on('end', () => { + expect(output.length).toEqual(6); + expect(output[0].b).toEqual('A'); + expect(output[1].b).toEqual('B'); + expect(output[2].b).toEqual('c'); + expect(output[3].b).toEqual('D'); + expect(output[4].b).toEqual('E'); + expect(output[5].b).toEqual('F'); + expect(env.executed).toEqual(false); + done(); + }); +}); From 314f2ff7240795615bb4baf36a4d883a506481c6 Mon Sep 17 00:00:00 2001 From: Nicolas Thouvenin Date: Thu, 22 Jul 2021 14:05:50 +0200 Subject: [PATCH 05/13] Publish - @ezs/analytics@1.16.4 - @ezs/ark@1.2.2 - @ezs/conditor@2.3.2 - @ezs/core@1.24.3 - @ezs/istex@1.4.3 - @ezs/lodex@1.14.2 - @ezs/loterre@1.1.13 - @ezs/sparql@1.1.6 - @ezs/storage@1.5.2 - @ezs/transformers@1.3.5 --- packages/analytics/CHANGELOG.md | 11 +++++++++++ packages/analytics/package-lock.json | 2 +- packages/analytics/package.json | 4 ++-- packages/ark/CHANGELOG.md | 8 ++++++++ packages/ark/package-lock.json | 2 +- packages/ark/package.json | 4 ++-- packages/conditor/CHANGELOG.md | 8 ++++++++ packages/conditor/package-lock.json | 2 +- packages/conditor/package.json | 4 ++-- packages/core/CHANGELOG.md | 8 ++++++++ packages/core/package-lock.json | 2 +- packages/core/package.json | 4 ++-- packages/istex/CHANGELOG.md | 8 ++++++++ packages/istex/package-lock.json | 2 +- packages/istex/package.json | 4 ++-- packages/lodex/CHANGELOG.md | 8 ++++++++ packages/lodex/package-lock.json | 2 +- packages/lodex/package.json | 4 ++-- packages/loterre/CHANGELOG.md | 8 ++++++++ packages/loterre/package-lock.json | 2 +- packages/loterre/package.json | 6 +++--- packages/sparql/CHANGELOG.md | 8 ++++++++ packages/sparql/package-lock.json | 2 +- packages/sparql/package.json | 4 ++-- packages/storage/CHANGELOG.md | 8 ++++++++ packages/storage/package-lock.json | 2 +- packages/storage/package.json | 4 ++-- packages/transformers/CHANGELOG.md | 8 ++++++++ packages/transformers/package-lock.json | 2 +- packages/transformers/package.json | 4 ++-- 30 files changed, 114 insertions(+), 31 deletions(-) diff --git a/packages/analytics/CHANGELOG.md b/packages/analytics/CHANGELOG.md index 62e7dca6..09cacf4f 100644 --- a/packages/analytics/CHANGELOG.md +++ b/packages/analytics/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.16.4](https://github.com/Inist-CNRS/ezs/compare/@ezs/analytics@1.16.3...@ezs/analytics@1.16.4) (2021-07-22) + + +### Bug Fixes + +* 🐛 to avoid losing items that were skipped ([bca9cba](https://github.com/Inist-CNRS/ezs/commit/bca9cbaf5a63a7d16bfa28a8df287816e765ea92)) + + + + + ## [1.16.3](https://github.com/Inist-CNRS/ezs/compare/@ezs/analytics@1.16.2...@ezs/analytics@1.16.3) (2021-07-15) **Note:** Version bump only for package @ezs/analytics diff --git a/packages/analytics/package-lock.json b/packages/analytics/package-lock.json index 4f02ca6d..c9f2a5f4 100644 --- a/packages/analytics/package-lock.json +++ b/packages/analytics/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/analytics", - "version": "1.16.3", + "version": "1.16.4", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/analytics/package.json b/packages/analytics/package.json index b4e4acf4..5344def7 100644 --- a/packages/analytics/package.json +++ b/packages/analytics/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/analytics", - "version": "1.16.3", + "version": "1.16.4", "description": "Analytics statements for EZS", "directories": { "test": "test" @@ -50,4 +50,4 @@ "devDependencies": { "@ezs/core": "1.2.2" } -} \ No newline at end of file +} diff --git a/packages/ark/CHANGELOG.md b/packages/ark/CHANGELOG.md index 1b8ff4e9..1bde343e 100644 --- a/packages/ark/CHANGELOG.md +++ b/packages/ark/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.2.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/ark@1.2.1...@ezs/ark@1.2.2) (2021-07-22) + +**Note:** Version bump only for package @ezs/ark + + + + + ## [1.2.1](https://github.com/Inist-CNRS/ezs/compare/@ezs/ark@1.2.0...@ezs/ark@1.2.1) (2021-06-28) **Note:** Version bump only for package @ezs/ark diff --git a/packages/ark/package-lock.json b/packages/ark/package-lock.json index f87c14c2..d4e85d3e 100644 --- a/packages/ark/package-lock.json +++ b/packages/ark/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/ark", - "version": "1.2.1", + "version": "1.2.2", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/ark/package.json b/packages/ark/package.json index d17e3640..aca6dd6b 100644 --- a/packages/ark/package.json +++ b/packages/ark/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/ark", - "version": "1.2.1", + "version": "1.2.2", "description": "ARK dedicated statements for EZS", "directories": { "test": "test" @@ -43,4 +43,4 @@ "peerDependencies": { "@ezs/core": "*" } -} \ No newline at end of file +} diff --git a/packages/conditor/CHANGELOG.md b/packages/conditor/CHANGELOG.md index d7167b33..88c53d08 100644 --- a/packages/conditor/CHANGELOG.md +++ b/packages/conditor/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.3.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/conditor@2.3.1...@ezs/conditor@2.3.2) (2021-07-22) + +**Note:** Version bump only for package @ezs/conditor + + + + + ## [2.3.1](https://github.com/Inist-CNRS/ezs/compare/@ezs/conditor@2.3.0...@ezs/conditor@2.3.1) (2021-06-28) **Note:** Version bump only for package @ezs/conditor diff --git a/packages/conditor/package-lock.json b/packages/conditor/package-lock.json index 597b438c..782cf9d3 100644 --- a/packages/conditor/package-lock.json +++ b/packages/conditor/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/conditor", - "version": "2.3.1", + "version": "2.3.2", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/conditor/package.json b/packages/conditor/package.json index 1e41bd5a..23bba05d 100644 --- a/packages/conditor/package.json +++ b/packages/conditor/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/conditor", - "version": "2.3.1", + "version": "2.3.2", "description": "ezs statements for Conditor", "publishConfig": { "access": "public" @@ -52,4 +52,4 @@ "@ezs/core": "*" }, "gitHead": "bc1be6636627b450c72d59ec404c43d87d7a42aa" -} \ No newline at end of file +} diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index b37093b8..05185b6e 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.24.3](https://github.com/Inist-CNRS/ezs/compare/@ezs/core@1.24.2...@ezs/core@1.24.3) (2021-07-22) + +**Note:** Version bump only for package @ezs/core + + + + + ## [1.24.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/core@1.24.1...@ezs/core@1.24.2) (2021-07-15) **Note:** Version bump only for package @ezs/core diff --git a/packages/core/package-lock.json b/packages/core/package-lock.json index 15413438..6e7dce64 100644 --- a/packages/core/package-lock.json +++ b/packages/core/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/core", - "version": "1.24.2", + "version": "1.24.3", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/core/package.json b/packages/core/package.json index f18fa987..a88c911a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/core", - "version": "1.24.2", + "version": "1.24.3", "description": "A wrapper to build Stream transformers with functional style", "directories": { "test": "test" @@ -60,4 +60,4 @@ "node": ">=10 <=14" }, "gitHead": "bc1be6636627b450c72d59ec404c43d87d7a42aa" -} \ No newline at end of file +} diff --git a/packages/istex/CHANGELOG.md b/packages/istex/CHANGELOG.md index 91c39f80..74e8f4f1 100644 --- a/packages/istex/CHANGELOG.md +++ b/packages/istex/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.4.3](https://github.com/Inist-CNRS/ezs/compare/@ezs/istex@1.4.2...@ezs/istex@1.4.3) (2021-07-22) + +**Note:** Version bump only for package @ezs/istex + + + + + ## [1.4.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/istex@1.4.1...@ezs/istex@1.4.2) (2021-07-15) **Note:** Version bump only for package @ezs/istex diff --git a/packages/istex/package-lock.json b/packages/istex/package-lock.json index 74de93da..6eb6e338 100644 --- a/packages/istex/package-lock.json +++ b/packages/istex/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/istex", - "version": "1.4.2", + "version": "1.4.3", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/istex/package.json b/packages/istex/package.json index 551ecd0b..daf1a0cf 100644 --- a/packages/istex/package.json +++ b/packages/istex/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/istex", - "version": "1.4.2", + "version": "1.4.3", "description": "ISTEX statements for EZS", "main": "./lib/index.js", "directories": { @@ -62,4 +62,4 @@ "@ezs/core": "1.2.2" }, "gitHead": "bc1be6636627b450c72d59ec404c43d87d7a42aa" -} \ No newline at end of file +} diff --git a/packages/lodex/CHANGELOG.md b/packages/lodex/CHANGELOG.md index f6ba7148..1d7cded9 100644 --- a/packages/lodex/CHANGELOG.md +++ b/packages/lodex/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/lodex@1.14.1...@ezs/lodex@1.14.2) (2021-07-22) + +**Note:** Version bump only for package @ezs/lodex + + + + + ## [1.14.1](https://github.com/Inist-CNRS/ezs/compare/@ezs/lodex@1.14.0...@ezs/lodex@1.14.1) (2021-07-16) diff --git a/packages/lodex/package-lock.json b/packages/lodex/package-lock.json index 68a7837d..482f7ede 100644 --- a/packages/lodex/package-lock.json +++ b/packages/lodex/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/lodex", - "version": "1.14.1", + "version": "1.14.2", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/lodex/package.json b/packages/lodex/package.json index 5435efba..1cf61259 100644 --- a/packages/lodex/package.json +++ b/packages/lodex/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/lodex", - "version": "1.14.1", + "version": "1.14.2", "description": "ezs dedicated statements for Lodex", "directories": { "test": "test" @@ -51,4 +51,4 @@ "@ezs/core": "*" }, "gitHead": "bc1be6636627b450c72d59ec404c43d87d7a42aa" -} \ No newline at end of file +} diff --git a/packages/loterre/CHANGELOG.md b/packages/loterre/CHANGELOG.md index 60d5ff9e..e1191058 100644 --- a/packages/loterre/CHANGELOG.md +++ b/packages/loterre/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.13](https://github.com/Inist-CNRS/ezs/compare/@ezs/loterre@1.1.12...@ezs/loterre@1.1.13) (2021-07-22) + +**Note:** Version bump only for package @ezs/loterre + + + + + ## [1.1.12](https://github.com/Inist-CNRS/ezs/compare/@ezs/loterre@1.1.11...@ezs/loterre@1.1.12) (2021-07-15) **Note:** Version bump only for package @ezs/loterre diff --git a/packages/loterre/package-lock.json b/packages/loterre/package-lock.json index 1c7db7fb..17e073ad 100644 --- a/packages/loterre/package-lock.json +++ b/packages/loterre/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/loterre", - "version": "1.1.12", + "version": "1.1.13", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/loterre/package.json b/packages/loterre/package.json index 10b2160b..175af471 100644 --- a/packages/loterre/package.json +++ b/packages/loterre/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/loterre", - "version": "1.1.12", + "version": "1.1.13", "description": "Loterre statements for EZS", "directories": { "test": "test" @@ -43,9 +43,9 @@ "@ezs/core": "*" }, "devDependencies": { - "@ezs/core": "1.24.2" + "@ezs/core": "1.24.3" }, "dependencies": { "@ezs/store": "1.3.3" } -} \ No newline at end of file +} diff --git a/packages/sparql/CHANGELOG.md b/packages/sparql/CHANGELOG.md index e914f778..7ff681c8 100644 --- a/packages/sparql/CHANGELOG.md +++ b/packages/sparql/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.6](https://github.com/Inist-CNRS/ezs/compare/@ezs/sparql@1.1.5...@ezs/sparql@1.1.6) (2021-07-22) + +**Note:** Version bump only for package @ezs/sparql + + + + + ## [1.1.5](https://github.com/Inist-CNRS/ezs/compare/@ezs/sparql@1.1.4...@ezs/sparql@1.1.5) (2021-06-28) **Note:** Version bump only for package @ezs/sparql diff --git a/packages/sparql/package-lock.json b/packages/sparql/package-lock.json index 3685f360..de5412ba 100644 --- a/packages/sparql/package-lock.json +++ b/packages/sparql/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/sparql", - "version": "1.1.5", + "version": "1.1.6", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/sparql/package.json b/packages/sparql/package.json index 4a571dc7..564eea15 100644 --- a/packages/sparql/package.json +++ b/packages/sparql/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/sparql", - "version": "1.1.5", + "version": "1.1.6", "description": "SPARQL module for ezs", "main": "./lib/index.js", "scripts": { @@ -41,4 +41,4 @@ "isomorphic-fetch": "2.2.1" }, "gitHead": "bc1be6636627b450c72d59ec404c43d87d7a42aa" -} \ No newline at end of file +} diff --git a/packages/storage/CHANGELOG.md b/packages/storage/CHANGELOG.md index 8fbb5820..37f535fa 100644 --- a/packages/storage/CHANGELOG.md +++ b/packages/storage/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.5.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/storage@1.5.1...@ezs/storage@1.5.2) (2021-07-22) + +**Note:** Version bump only for package @ezs/storage + + + + + ## [1.5.1](https://github.com/Inist-CNRS/ezs/compare/@ezs/storage@1.5.0...@ezs/storage@1.5.1) (2021-06-28) **Note:** Version bump only for package @ezs/storage diff --git a/packages/storage/package-lock.json b/packages/storage/package-lock.json index ae54429b..4208f307 100644 --- a/packages/storage/package-lock.json +++ b/packages/storage/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/storage", - "version": "1.5.1", + "version": "1.5.2", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/storage/package.json b/packages/storage/package.json index 4a4123ff..2c2b0202 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/storage", - "version": "1.5.1", + "version": "1.5.2", "description": "Storage statements for EZS", "directories": { "test": "test" @@ -43,4 +43,4 @@ "peerDependencies": { "@ezs/core": "*" } -} \ No newline at end of file +} diff --git a/packages/transformers/CHANGELOG.md b/packages/transformers/CHANGELOG.md index e6267a80..c2f362f7 100644 --- a/packages/transformers/CHANGELOG.md +++ b/packages/transformers/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.3.5](https://github.com/Inist-CNRS/ezs/compare/@ezs/transformers@1.3.4...@ezs/transformers@1.3.5) (2021-07-22) + +**Note:** Version bump only for package @ezs/transformers + + + + + ## [1.3.4](https://github.com/Inist-CNRS/ezs/compare/@ezs/transformers@1.3.3...@ezs/transformers@1.3.4) (2021-07-15) **Note:** Version bump only for package @ezs/transformers diff --git a/packages/transformers/package-lock.json b/packages/transformers/package-lock.json index 1d8be4a0..7f9dc741 100644 --- a/packages/transformers/package-lock.json +++ b/packages/transformers/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ezs/transformers", - "version": "1.3.4", + "version": "1.3.5", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/transformers/package.json b/packages/transformers/package.json index 71a13ba1..f32e521a 100644 --- a/packages/transformers/package.json +++ b/packages/transformers/package.json @@ -1,6 +1,6 @@ { "name": "@ezs/transformers", - "version": "1.3.4", + "version": "1.3.5", "description": "LODEX transformers statements for EZS", "directories": { "test": "src" @@ -40,4 +40,4 @@ "peerDependencies": { "@ezs/core": "*" } -} \ No newline at end of file +} From 249230c091b3dbdcdbe4c798d77e0897b03512f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 09:04:15 +0200 Subject: [PATCH 06/13] docs(lodex): Fix bad JSDoc --- docs/plugin-lodex.md | 148 ++++++++++-------- packages/lodex/README.md | 148 ++++++++++-------- packages/lodex/src/flatten-patch.js | 2 +- packages/lodex/src/formatOutput.js | 2 +- packages/lodex/src/injectCountFrom.js | 40 ++--- packages/lodex/src/joinQuery.js | 2 +- packages/lodex/src/keyMapping.js | 15 +- packages/lodex/src/objects2columns.js | 26 ++- packages/lodex/src/writeTurtle.js | 28 ++-- .../getPublishedDatasetFilter.spec.js | 2 +- 10 files changed, 247 insertions(+), 166 deletions(-) rename packages/lodex/{src => test}/getPublishedDatasetFilter.spec.js (99%) diff --git a/docs/plugin-lodex.md b/docs/plugin-lodex.md index 5559e31d..42d3987b 100644 --- a/docs/plugin-lodex.md +++ b/docs/plugin-lodex.md @@ -104,6 +104,10 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa Take `Object` and transform all key ending byu number on array. +#### Parameters + +- `none` **[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)** + Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### getLastCharacteristic @@ -198,27 +202,18 @@ Output: Take an object and map its keys to the one in mapping parameters. Keep keys absent in `from` parameter. -#### Parameters - -- `from` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** keys of the input -- `to` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** matching keys for the output - -#### Examples - -Input: - +Input: -```javascript +```json [{ "dFgH": "Value", "AaAa": "Value 2" }] ``` -EZS: +EZS: - -```javascript +```ini [keyMapping] from = dFgH to = Title @@ -226,16 +221,20 @@ from = AaAa to = Description ``` -Output - +Output -```javascript +```json [{ "Title": "Value", "Description": "Value 2" }] ``` +#### Parameters + +- `from` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** keys of the input +- `to` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** matching keys for the output + Returns **any** Same object with modified keys ### labelizeFieldID @@ -353,50 +352,49 @@ Return the fields (the model) of a LODEX. Inject in each item the last characteristics (the dataset covering fields) of a LODEX. -#### Parameters - -- `connectionStringURI` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** MongoDB connection string -- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to get value to find -- `field` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name contains the value to find (generaly equals to path) (optional, default `auto`) - -#### Examples - -Input: - +Input: -````javascript ```json [ - { id: 0, value:2000 }, - { id: 1, value:2001 }, - { id: 2, value:2003 }, - { id: 3, value:2005 }, - { id: 4, value:2007 }, - { id: 2, value:2003 }, - { id: 6, value:2011 }, - { id: 7, value:2013 }, + { "id": 0, "value":2000 }, + { "id": 1, "value":2001 }, + { "id": 2, "value":2003 }, + { "id": 3, "value":2005 }, + { "id": 4, "value":2007 }, + { "id": 2, "value":2003 }, + { "id": 6, "value":2011 }, + { "id": 7, "value":2013 } ] ``` Script: + ```ini [injectCountFrom] path = value field = publicationDate - ``` +Output: + +```json [ - { id: 0, value:2003, value_count:3 }, - { id: 1, value:2001, value_count:1 }, - { id: 2, value:2003, value_count:3 }, - { id: 3, value:2005, value_count:1 }, - { id: 4, value:2007, value_count:1 }, - { id: 2, value:2003, value_count:3 }, - { id: 6, value:2011, value_count:2 }, - { id: 7, value:2011, value_count:2 }, + { "id": 0, "value":2003, "value_count":3 }, + { "id": 1, "value":2001, "value_count":1 }, + { "id": 2, "value":2003, "value_count":3 }, + { "id": 3, "value":2005, "value_count":1 }, + { "id": 4, "value":2007, "value_count":1 }, + { "id": 2, "value":2003, "value_count":3 }, + { "id": 6, "value":2011, "value_count":2 }, + { "id": 7, "value":2011, "value_count":2 } ] -```` +``` + +#### Parameters + +- `connectionStringURI` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** MongoDB connection string +- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to get value to find +- `field` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name contains the value to find (generaly equals to path) (optional, default `auto`) ### LodexInjectSyndicationFrom @@ -427,7 +425,7 @@ Output: ### LodexJoinQuery -Take 3 parametres and creates a join query (one to many, on sub-ressource) +Take 3 parameters and create a join query (one to many, on sub-ressource) The input object must contain a `connectionStringURI` property, valued with the connection string to MongoDB. @@ -453,7 +451,7 @@ Format the output in compliance with LODEX routines format. #### Parameters -- `keyName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the `data` property (optional, default `data`) +- `keyName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the `data` property (optional, default `"data"`) - `indent` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** indent or not (optional, default `false`) - `extract` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** fields to put at the root of the output object @@ -535,7 +533,33 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### objects2columns -Take `Object` and ... +Take an `Object` and flatten it to get only one level of keys. + +Input: + +```json +[{ + "foo": { + "hello": "world" + }, + "bar": "anything else", + "baz": 1 +}] +``` + +Output: + +```json +[{ + "foo": "{\"hello\":\"world\"}", + "bar": "anything else", + "baz": 1 +}] +``` + +#### Parameters + +- `none` **[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)** Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -549,12 +573,9 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G Take quad or prefixes object and return turtle string. -#### Examples - -Input: - +Input: -```javascript +```js [{ quad: { subject: { id: 'http://uri/janedoe' }, @@ -586,21 +607,20 @@ Input: object: { id: 'http://schema.org/Person' } } }, { prefixes: {} } - ] +] ``` -Output: +Output: +```txt +\@prefix schema: . +\@prefix rdf: . -```javascript -'@prefix schema: .\n' -'@prefix rdf: .\n' -'\n' -' schema:jobTitle "Professor";\n' -' schema:name "Jane Doe";\n' -' schema:telephone "(425) 123-4567";\n' -' schema:url ;\n' -' a schema:Person.\n"' + schema:jobTitle "Professor"; + schema:name "Jane Doe"; + schema:telephone "(425) 123-4567"; + schema:url ; + a schema:Person. ``` Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** turtle diff --git a/packages/lodex/README.md b/packages/lodex/README.md index 5559e31d..42d3987b 100644 --- a/packages/lodex/README.md +++ b/packages/lodex/README.md @@ -104,6 +104,10 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa Take `Object` and transform all key ending byu number on array. +#### Parameters + +- `none` **[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)** + Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### getLastCharacteristic @@ -198,27 +202,18 @@ Output: Take an object and map its keys to the one in mapping parameters. Keep keys absent in `from` parameter. -#### Parameters - -- `from` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** keys of the input -- `to` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** matching keys for the output - -#### Examples - -Input: - +Input: -```javascript +```json [{ "dFgH": "Value", "AaAa": "Value 2" }] ``` -EZS: +EZS: - -```javascript +```ini [keyMapping] from = dFgH to = Title @@ -226,16 +221,20 @@ from = AaAa to = Description ``` -Output - +Output -```javascript +```json [{ "Title": "Value", "Description": "Value 2" }] ``` +#### Parameters + +- `from` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** keys of the input +- `to` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** matching keys for the output + Returns **any** Same object with modified keys ### labelizeFieldID @@ -353,50 +352,49 @@ Return the fields (the model) of a LODEX. Inject in each item the last characteristics (the dataset covering fields) of a LODEX. -#### Parameters - -- `connectionStringURI` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** MongoDB connection string -- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to get value to find -- `field` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name contains the value to find (generaly equals to path) (optional, default `auto`) - -#### Examples - -Input: - +Input: -````javascript ```json [ - { id: 0, value:2000 }, - { id: 1, value:2001 }, - { id: 2, value:2003 }, - { id: 3, value:2005 }, - { id: 4, value:2007 }, - { id: 2, value:2003 }, - { id: 6, value:2011 }, - { id: 7, value:2013 }, + { "id": 0, "value":2000 }, + { "id": 1, "value":2001 }, + { "id": 2, "value":2003 }, + { "id": 3, "value":2005 }, + { "id": 4, "value":2007 }, + { "id": 2, "value":2003 }, + { "id": 6, "value":2011 }, + { "id": 7, "value":2013 } ] ``` Script: + ```ini [injectCountFrom] path = value field = publicationDate - ``` +Output: + +```json [ - { id: 0, value:2003, value_count:3 }, - { id: 1, value:2001, value_count:1 }, - { id: 2, value:2003, value_count:3 }, - { id: 3, value:2005, value_count:1 }, - { id: 4, value:2007, value_count:1 }, - { id: 2, value:2003, value_count:3 }, - { id: 6, value:2011, value_count:2 }, - { id: 7, value:2011, value_count:2 }, + { "id": 0, "value":2003, "value_count":3 }, + { "id": 1, "value":2001, "value_count":1 }, + { "id": 2, "value":2003, "value_count":3 }, + { "id": 3, "value":2005, "value_count":1 }, + { "id": 4, "value":2007, "value_count":1 }, + { "id": 2, "value":2003, "value_count":3 }, + { "id": 6, "value":2011, "value_count":2 }, + { "id": 7, "value":2011, "value_count":2 } ] -```` +``` + +#### Parameters + +- `connectionStringURI` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** MongoDB connection string +- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to get value to find +- `field` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name contains the value to find (generaly equals to path) (optional, default `auto`) ### LodexInjectSyndicationFrom @@ -427,7 +425,7 @@ Output: ### LodexJoinQuery -Take 3 parametres and creates a join query (one to many, on sub-ressource) +Take 3 parameters and create a join query (one to many, on sub-ressource) The input object must contain a `connectionStringURI` property, valued with the connection string to MongoDB. @@ -453,7 +451,7 @@ Format the output in compliance with LODEX routines format. #### Parameters -- `keyName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the `data` property (optional, default `data`) +- `keyName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the `data` property (optional, default `"data"`) - `indent` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** indent or not (optional, default `false`) - `extract` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** fields to put at the root of the output object @@ -535,7 +533,33 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### objects2columns -Take `Object` and ... +Take an `Object` and flatten it to get only one level of keys. + +Input: + +```json +[{ + "foo": { + "hello": "world" + }, + "bar": "anything else", + "baz": 1 +}] +``` + +Output: + +```json +[{ + "foo": "{\"hello\":\"world\"}", + "bar": "anything else", + "baz": 1 +}] +``` + +#### Parameters + +- `none` **[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)** Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -549,12 +573,9 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G Take quad or prefixes object and return turtle string. -#### Examples - -Input: - +Input: -```javascript +```js [{ quad: { subject: { id: 'http://uri/janedoe' }, @@ -586,21 +607,20 @@ Input: object: { id: 'http://schema.org/Person' } } }, { prefixes: {} } - ] +] ``` -Output: +Output: +```txt +\@prefix schema: . +\@prefix rdf: . -```javascript -'@prefix schema: .\n' -'@prefix rdf: .\n' -'\n' -' schema:jobTitle "Professor";\n' -' schema:name "Jane Doe";\n' -' schema:telephone "(425) 123-4567";\n' -' schema:url ;\n' -' a schema:Person.\n"' + schema:jobTitle "Professor"; + schema:name "Jane Doe"; + schema:telephone "(425) 123-4567"; + schema:url ; + a schema:Person. ``` Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** turtle diff --git a/packages/lodex/src/flatten-patch.js b/packages/lodex/src/flatten-patch.js index 4827b5a8..1fa8f517 100644 --- a/packages/lodex/src/flatten-patch.js +++ b/packages/lodex/src/flatten-patch.js @@ -29,7 +29,7 @@ function flattenPatch(data, feed) { * * @name flattenPatch * @alias flatten - * @param none. + * @param {undefined} none * @returns {Object} */ export default { diff --git a/packages/lodex/src/formatOutput.js b/packages/lodex/src/formatOutput.js index fb304401..e0299384 100644 --- a/packages/lodex/src/formatOutput.js +++ b/packages/lodex/src/formatOutput.js @@ -22,7 +22,7 @@ import unset from 'lodash.unset'; * } * * @name LodexOutput - * @param {string} [keyName=data] name of the `data` property + * @param {string} [keyName="data"] name of the `data` property * @param {boolean} [indent=false] indent or not * @param {string[]} [extract] fields to put at the root of the output * object diff --git a/packages/lodex/src/injectCountFrom.js b/packages/lodex/src/injectCountFrom.js index 8da4171c..2b0ba797 100644 --- a/packages/lodex/src/injectCountFrom.js +++ b/packages/lodex/src/injectCountFrom.js @@ -6,39 +6,43 @@ import mongoDatabase from './mongoDatabase'; /** * Inject in each item the last characteristics (the dataset covering fields) of a LODEX. * - * @example * Input: + * * ```json * [ - * { id: 0, value:2000 }, - * { id: 1, value:2001 }, - * { id: 2, value:2003 }, - * { id: 3, value:2005 }, - * { id: 4, value:2007 }, - * { id: 2, value:2003 }, - * { id: 6, value:2011 }, - * { id: 7, value:2013 }, + * { "id": 0, "value":2000 }, + * { "id": 1, "value":2001 }, + * { "id": 2, "value":2003 }, + * { "id": 3, "value":2005 }, + * { "id": 4, "value":2007 }, + * { "id": 2, "value":2003 }, + * { "id": 6, "value":2011 }, + * { "id": 7, "value":2013 } * ] * ``` * * Script: + * * ```ini * [injectCountFrom] * path = value * field = publicationDate - * * ``` * + * Output: + * + * ```json * [ - * { id: 0, value:2003, value_count:3 }, - * { id: 1, value:2001, value_count:1 }, - * { id: 2, value:2003, value_count:3 }, - * { id: 3, value:2005, value_count:1 }, - * { id: 4, value:2007, value_count:1 }, - * { id: 2, value:2003, value_count:3 }, - * { id: 6, value:2011, value_count:2 }, - * { id: 7, value:2011, value_count:2 }, + * { "id": 0, "value":2003, "value_count":3 }, + * { "id": 1, "value":2001, "value_count":1 }, + * { "id": 2, "value":2003, "value_count":3 }, + * { "id": 3, "value":2005, "value_count":1 }, + * { "id": 4, "value":2007, "value_count":1 }, + * { "id": 2, "value":2003, "value_count":3 }, + * { "id": 6, "value":2011, "value_count":2 }, + * { "id": 7, "value":2011, "value_count":2 } * ] + * ``` * * @export * @param {string} connectionStringURI MongoDB connection string diff --git a/packages/lodex/src/joinQuery.js b/packages/lodex/src/joinQuery.js index ef6c8a25..ba9448ea 100644 --- a/packages/lodex/src/joinQuery.js +++ b/packages/lodex/src/joinQuery.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import mongoDatabase from './mongoDatabase'; /** - * Take 3 parametres and creates a join query (one to many, on sub-ressource) + * Take 3 parameters and create a join query (one to many, on sub-ressource) * * The input object must contain a `connectionStringURI` property, valued with * the connection string to MongoDB. diff --git a/packages/lodex/src/keyMapping.js b/packages/lodex/src/keyMapping.js index 69b50034..4c805d01 100644 --- a/packages/lodex/src/keyMapping.js +++ b/packages/lodex/src/keyMapping.js @@ -4,24 +4,33 @@ import zipObject from 'lodash.zipobject'; * Take an object and map its keys to the one in mapping parameters. * Keep keys absent in `from` parameter. * - * @example Input: + * Input: + * + * ```json * [{ * "dFgH": "Value", * "AaAa": "Value 2" * }] + * ``` + * + * EZS: * - * @example EZS: + * ```ini * [keyMapping] * from = dFgH * to = Title * from = AaAa * to = Description + * ``` + * + * Output * - * @example Output + * ```json * [{ * "Title": "Value", * "Description": "Value 2" * }] + * ``` * * @param {Array} from keys of the input * @param {Array} to matching keys for the output diff --git a/packages/lodex/src/objects2columns.js b/packages/lodex/src/objects2columns.js index 6432bb16..b251d373 100644 --- a/packages/lodex/src/objects2columns.js +++ b/packages/lodex/src/objects2columns.js @@ -1,9 +1,31 @@ /** - * Take `Object` and ... + * Take an `Object` and flatten it to get only one level of keys. + * + * Input: + * + * ```json + * [{ + * "foo": { + * "hello": "world" + * }, + * "bar": "anything else", + * "baz": 1 + * }] + * ``` + * + * Output: + * + * ```json + * [{ + * "foo": "{\"hello\":\"world\"}", + * "bar": "anything else", + * "baz": 1 + * }] + * ``` * * @name objects2columns * @alias flatten - * @param none. + * @param {undefined} none * @returns {Object} */ export default function objects2columns(data, feed) { diff --git a/packages/lodex/src/writeTurtle.js b/packages/lodex/src/writeTurtle.js index 4220179b..8a48d29d 100644 --- a/packages/lodex/src/writeTurtle.js +++ b/packages/lodex/src/writeTurtle.js @@ -7,7 +7,9 @@ const uriPrefixes = Object.values(defaultPrefixes); /** * Take quad or prefixes object and return turtle string. * - * @example Input: + * Input: + * + * ```js * [{ * quad: { * subject: { id: 'http://uri/janedoe' }, @@ -39,17 +41,21 @@ const uriPrefixes = Object.values(defaultPrefixes); * object: { id: 'http://schema.org/Person' } * } * }, { prefixes: {} } - * ] + * ] + * ``` + * + * Output: + * + * ```txt + * \@prefix schema: . + * \@prefix rdf: . * - * @example Output: - * '@prefix schema: .\n' - * '@prefix rdf: .\n' - * '\n' - * ' schema:jobTitle "Professor";\n' - * ' schema:name "Jane Doe";\n' - * ' schema:telephone "(425) 123-4567";\n' - * ' schema:url ;\n' - * ' a schema:Person.\n"' + * schema:jobTitle "Professor"; + * schema:name "Jane Doe"; + * schema:telephone "(425) 123-4567"; + * schema:url ; + * a schema:Person. + * ``` * * @export * @return {String} turtle diff --git a/packages/lodex/src/getPublishedDatasetFilter.spec.js b/packages/lodex/test/getPublishedDatasetFilter.spec.js similarity index 99% rename from packages/lodex/src/getPublishedDatasetFilter.spec.js rename to packages/lodex/test/getPublishedDatasetFilter.spec.js index 0789b204..258c24b3 100644 --- a/packages/lodex/src/getPublishedDatasetFilter.spec.js +++ b/packages/lodex/test/getPublishedDatasetFilter.spec.js @@ -4,7 +4,7 @@ import { addRegexToFilters, addKeyToFilters, getValueQueryFragment, -} from './getPublishedDatasetFilter'; +} from '../src/getPublishedDatasetFilter'; describe('getPublishedDatasetFilter', () => { describe('addFacetToFilters', () => { From 775b5c09c0456512660a03e32dcbc806577640f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 09:23:11 +0200 Subject: [PATCH 07/13] docs(loterre): Fix bad JSDoc --- docs/plugin-loterre.md | 165 +++++++------------------ packages/loterre/README.md | 165 +++++++------------------ packages/loterre/src/skos-hierarchy.js | 7 +- packages/loterre/src/skos-pathenum.js | 59 +++++---- packages/loterre/src/skos-to-gexf.js | 10 +- 5 files changed, 121 insertions(+), 285 deletions(-) diff --git a/docs/plugin-loterre.md b/docs/plugin-loterre.md index f4a0c9a9..e09f5603 100644 --- a/docs/plugin-loterre.md +++ b/docs/plugin-loterre.md @@ -14,63 +14,13 @@ npm install @ezs/loterre #### Table of Contents -- [checkIfPropertyExist](#checkifpropertyexist) -- [checkIfPropertyExist](#checkifpropertyexist-1) -- [checkIfPropertyExist](#checkifpropertyexist-2) -- [getBroaderAndNarrower](#getbroaderandnarrower) -- [getBroaderAndNarrower](#getbroaderandnarrower-1) - [SKOSHierarchy](#skoshierarchy) -- [SKOSHierarchy](#skoshierarchy-1) - [SKOSObject](#skosobject) - [SKOSPathEnum](#skospathenum) -- [SKOSPathEnum](#skospathenum-1) -- [writeEdge](#writeedge) -- [writeHierarchy](#writehierarchy) - -### checkIfPropertyExist - -#### Parameters - -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -### checkIfPropertyExist - -#### Parameters - -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -### checkIfPropertyExist - -#### Parameters - -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -### getBroaderAndNarrower - -#### Parameters - -- `broaderOrNarrower` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `concept` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `store` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `lang` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Returns object - -### getBroaderAndNarrower - -#### Parameters - -- `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `feed` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Returns object +- [SKOSToGexf](#skostogexf) ### SKOSHierarchy -SKOSHierarchy Output: ```json @@ -85,30 +35,9 @@ Output: #### Parameters -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) +- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose language of `prefLabel` (optional, default `en`) -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fedd Object - -### SKOSHierarchy - -SKOSHierarchy -Output: - -```json - [ - { - "source": ..., - "target": ..., - "weight": ... - } - ] -``` - -#### Parameters - -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fedd Object +Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fed Object ### SKOSObject @@ -123,16 +52,8 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### SKOSPathEnum -#### Parameters - -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Returns object - -### SKOSPathEnum - -Takes an `Object` and transform "broader","narrower" and "related" -properties to an 'Object' containing the prefLabel and rdf$about +Take an `Object` and transform "broader","narrower" and "related" +properties to an 'Object' containing the `prefLabel` and `rdf$about` @@ -182,33 +103,33 @@ Output: ```json [ { - 'rdf$about': 'http://example.com/dishes#fries', - 'prefLabel@fr': 'Frites', - 'prefLabel@en': 'French fries', - 'prefLabel@de': 'Französisch frites', - inScheme: 'http://example.com/dishes', - broader: [ [{ key: 'http://example.com/dishes#potatoBased', label: 'Plats à base de pomme de terre' }] ] + "rdf$about": "http://example.com/dishes#fries", + "prefLabel@fr": "Frites", + "prefLabel@en": "French fries", + "prefLabel@de": "Französisch frites", + "inScheme": "http://example.com/dishes", + "broader": [ [{ "key": "http://example.com/dishes#potatoBased", "label": "Plats à base de pomme de terre" }] ] }, { - 'rdf$about': 'http://example.com/dishes#mashed', - 'prefLabel@fr': 'Purée de pomme de terre', - 'prefLabel@en': 'Mashed potatoes', - 'prefLabel@de': 'Kartoffelpüree', - inScheme: 'http://example.com/dishes', - broader: [ [{ key: 'http://example.com/dishes#potatoBased', label: 'Plats à base de pomme de terre' }] ] + "rdf$about": "http://example.com/dishes#mashed", + "prefLabel@fr": "Purée de pomme de terre", + "prefLabel@en": "Mashed potatoes", + "prefLabel@de": "Kartoffelpüree", + "inScheme": "http://example.com/dishes", + "broader": [ [{ "key": "http://example.com/dishes#potatoBased", "label": "Plats à base de pomme de terre" }] ] }, { - 'rdf$about': 'http://example.com/dishes#potatoBased', - 'prefLabel@fr': 'Plats à base de pomme de terre', - 'prefLabel@en': 'Potato based dishes', - 'prefLabel@de': 'Kartoffelgerichte', - inScheme: 'http://example.com/dishes', - topConceptOf: 'http://example.com/dishes', - narrower: [ - { key: 'http://example.com/dishes#fries', label: 'Frites' }, + "rdf$about": "http://example.com/dishes#potatoBased", + "prefLabel@fr": "Plats à base de pomme de terre", + "prefLabel@en": "Potato based dishes", + "prefLabel@de": "Kartoffelgerichte", + "inScheme": "http://example.com/dishes", + "topConceptOf": "http://example.com/dishes", + "narrower": [ + { "key": "http://example.com/dishes#fries", "label": "Frites" }, { - key: 'http://example.com/dishes#mashed', - label: 'Purée de pomme de terre' + "key": "http://example.com/dishes#mashed", + "label": "Purée de pomme de terre" } ] } @@ -217,28 +138,26 @@ Output: #### Parameters -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) +- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose language of `prefLabel` (optional, default `en`) Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Returns object -### writeEdge - -#### Parameters +### SKOSToGexf -- `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `feed` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `store` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `lang` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `weight` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** +Output: -### writeHierarchy +```json + [ + { + "source": ..., + "target": ..., + "weight": ... + } + ] +``` #### Parameters -- `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `feed` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `store` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `lang` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `weight` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** +- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose language of `prefLabel` (optional, default `en`) + +Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fed Object diff --git a/packages/loterre/README.md b/packages/loterre/README.md index f4a0c9a9..e09f5603 100644 --- a/packages/loterre/README.md +++ b/packages/loterre/README.md @@ -14,63 +14,13 @@ npm install @ezs/loterre #### Table of Contents -- [checkIfPropertyExist](#checkifpropertyexist) -- [checkIfPropertyExist](#checkifpropertyexist-1) -- [checkIfPropertyExist](#checkifpropertyexist-2) -- [getBroaderAndNarrower](#getbroaderandnarrower) -- [getBroaderAndNarrower](#getbroaderandnarrower-1) - [SKOSHierarchy](#skoshierarchy) -- [SKOSHierarchy](#skoshierarchy-1) - [SKOSObject](#skosobject) - [SKOSPathEnum](#skospathenum) -- [SKOSPathEnum](#skospathenum-1) -- [writeEdge](#writeedge) -- [writeHierarchy](#writehierarchy) - -### checkIfPropertyExist - -#### Parameters - -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -### checkIfPropertyExist - -#### Parameters - -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -### checkIfPropertyExist - -#### Parameters - -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -### getBroaderAndNarrower - -#### Parameters - -- `broaderOrNarrower` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `concept` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `store` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `lang` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Returns object - -### getBroaderAndNarrower - -#### Parameters - -- `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `feed` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Returns object +- [SKOSToGexf](#skostogexf) ### SKOSHierarchy -SKOSHierarchy Output: ```json @@ -85,30 +35,9 @@ Output: #### Parameters -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) +- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose language of `prefLabel` (optional, default `en`) -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fedd Object - -### SKOSHierarchy - -SKOSHierarchy -Output: - -```json - [ - { - "source": ..., - "target": ..., - "weight": ... - } - ] -``` - -#### Parameters - -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fedd Object +Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fed Object ### SKOSObject @@ -123,16 +52,8 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### SKOSPathEnum -#### Parameters - -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) - -Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Returns object - -### SKOSPathEnum - -Takes an `Object` and transform "broader","narrower" and "related" -properties to an 'Object' containing the prefLabel and rdf$about +Take an `Object` and transform "broader","narrower" and "related" +properties to an 'Object' containing the `prefLabel` and `rdf$about` @@ -182,33 +103,33 @@ Output: ```json [ { - 'rdf$about': 'http://example.com/dishes#fries', - 'prefLabel@fr': 'Frites', - 'prefLabel@en': 'French fries', - 'prefLabel@de': 'Französisch frites', - inScheme: 'http://example.com/dishes', - broader: [ [{ key: 'http://example.com/dishes#potatoBased', label: 'Plats à base de pomme de terre' }] ] + "rdf$about": "http://example.com/dishes#fries", + "prefLabel@fr": "Frites", + "prefLabel@en": "French fries", + "prefLabel@de": "Französisch frites", + "inScheme": "http://example.com/dishes", + "broader": [ [{ "key": "http://example.com/dishes#potatoBased", "label": "Plats à base de pomme de terre" }] ] }, { - 'rdf$about': 'http://example.com/dishes#mashed', - 'prefLabel@fr': 'Purée de pomme de terre', - 'prefLabel@en': 'Mashed potatoes', - 'prefLabel@de': 'Kartoffelpüree', - inScheme: 'http://example.com/dishes', - broader: [ [{ key: 'http://example.com/dishes#potatoBased', label: 'Plats à base de pomme de terre' }] ] + "rdf$about": "http://example.com/dishes#mashed", + "prefLabel@fr": "Purée de pomme de terre", + "prefLabel@en": "Mashed potatoes", + "prefLabel@de": "Kartoffelpüree", + "inScheme": "http://example.com/dishes", + "broader": [ [{ "key": "http://example.com/dishes#potatoBased", "label": "Plats à base de pomme de terre" }] ] }, { - 'rdf$about': 'http://example.com/dishes#potatoBased', - 'prefLabel@fr': 'Plats à base de pomme de terre', - 'prefLabel@en': 'Potato based dishes', - 'prefLabel@de': 'Kartoffelgerichte', - inScheme: 'http://example.com/dishes', - topConceptOf: 'http://example.com/dishes', - narrower: [ - { key: 'http://example.com/dishes#fries', label: 'Frites' }, + "rdf$about": "http://example.com/dishes#potatoBased", + "prefLabel@fr": "Plats à base de pomme de terre", + "prefLabel@en": "Potato based dishes", + "prefLabel@de": "Kartoffelgerichte", + "inScheme": "http://example.com/dishes", + "topConceptOf": "http://example.com/dishes", + "narrower": [ + { "key": "http://example.com/dishes#fries", "label": "Frites" }, { - key: 'http://example.com/dishes#mashed', - label: 'Purée de pomme de terre' + "key": "http://example.com/dishes#mashed", + "label": "Purée de pomme de terre" } ] } @@ -217,28 +138,26 @@ Output: #### Parameters -- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose langauge of prefLabel (optional, default `en`) +- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose language of `prefLabel` (optional, default `en`) Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Returns object -### writeEdge - -#### Parameters +### SKOSToGexf -- `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `feed` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `store` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `lang` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `weight` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** +Output: -### writeHierarchy +```json + [ + { + "source": ..., + "target": ..., + "weight": ... + } + ] +``` #### Parameters -- `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `feed` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `store` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `lang` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `weight` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** +- `language` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Choose language of `prefLabel` (optional, default `en`) + +Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Return fed Object diff --git a/packages/loterre/src/skos-hierarchy.js b/packages/loterre/src/skos-hierarchy.js index 7ef1f7f6..2a1cd196 100644 --- a/packages/loterre/src/skos-hierarchy.js +++ b/packages/loterre/src/skos-hierarchy.js @@ -3,6 +3,7 @@ import { createStore } from '@ezs/store'; /** * @param {string} property * @param {Object} obj + * @private */ function checkIfPropertyExist(property, obj) { return (typeof (obj[property]) !== 'undefined'); @@ -16,6 +17,7 @@ function checkIfPropertyExist(property, obj) { * @param {Object} store * @param {string} lang * @param {number} weight + * @private */ async function writeHierarchy(data, feed, property, store, lang, weight) { for (let i = 0; i < data[property].length; i += 1) { @@ -34,7 +36,6 @@ async function writeHierarchy(data, feed, property, store, lang, weight) { } /** - * SKOSHierarchy * Output: * * ```json @@ -47,8 +48,8 @@ async function writeHierarchy(data, feed, property, store, lang, weight) { * ] * ``` * @name SKOSHierarchy - * @param {String} [language=en] Choose langauge of prefLabel - * @returns {Promise} Return fedd Object + * @param {String} [language=en] Choose language of `prefLabel` + * @returns {Promise} Return fed Object */ async function SKOSHierarchy(data, feed) { const lang = this.getParam('language', 'en'); diff --git a/packages/loterre/src/skos-pathenum.js b/packages/loterre/src/skos-pathenum.js index e9d190f2..1b42dd1a 100644 --- a/packages/loterre/src/skos-pathenum.js +++ b/packages/loterre/src/skos-pathenum.js @@ -4,6 +4,7 @@ import { createStore } from '@ezs/store'; * @name checkIfPropertyExist * @param {string} property * @param {Object} obj + * @private */ function checkIfPropertyExist(obj, property) { return Object.prototype.hasOwnProperty.call(obj, property); @@ -16,6 +17,7 @@ function checkIfPropertyExist(obj, property) { * @param {Object} store * @param {string} lang * @returns {Promise} Returns object + * @private */ async function getBroaderOrNarrowerLst(broaderOrNarrower, concept, store, lang) { const result = []; @@ -54,6 +56,7 @@ async function getBroaderOrNarrowerLst(broaderOrNarrower, concept, store, lang) * @param {Object} data * @param {Object} feed * @returns {Promise} Returns object + * @private */ async function getBroaderAndNarrower(data, feed) { const store = this.getEnv(); @@ -82,11 +85,6 @@ async function getBroaderAndNarrower(data, feed) { return feed.end(); } -/** -* @name SKOSPathEnum -* @param {String} [language=en] Choose langauge of prefLabel -* @returns {Promise} Returns object -*/ async function SKOSPathEnum(data, feed) { if (!this.store) { this.store = createStore(this.ezs, 'skos_pathenum_store'); @@ -107,8 +105,8 @@ async function SKOSPathEnum(data, feed) { } /** - * Takes an `Object` and transform "broader","narrower" and "related" - * properties to an 'Object' containing the prefLabel and rdf$about + * Take an `Object` and transform "broader","narrower" and "related" + * properties to an 'Object' containing the `prefLabel` and `rdf$about` * * ``` * @@ -153,7 +151,6 @@ async function SKOSPathEnum(data, feed) { * * [SKOSPathEnum] * language = fr - * * ``` * * Output: @@ -161,33 +158,33 @@ async function SKOSPathEnum(data, feed) { * ```json * [ * { - * 'rdf$about': 'http://example.com/dishes#fries', - * 'prefLabel@fr': 'Frites', - * 'prefLabel@en': 'French fries', - * 'prefLabel@de': 'Französisch frites', - * inScheme: 'http://example.com/dishes', - * broader: [ [{ key: 'http://example.com/dishes#potatoBased', label: 'Plats à base de pomme de terre' }] ] + * "rdf$about": "http://example.com/dishes#fries", + * "prefLabel@fr": "Frites", + * "prefLabel@en": "French fries", + * "prefLabel@de": "Französisch frites", + * "inScheme": "http://example.com/dishes", + * "broader": [ [{ "key": "http://example.com/dishes#potatoBased", "label": "Plats à base de pomme de terre" }] ] * }, * { - * 'rdf$about': 'http://example.com/dishes#mashed', - * 'prefLabel@fr': 'Purée de pomme de terre', - * 'prefLabel@en': 'Mashed potatoes', - * 'prefLabel@de': 'Kartoffelpüree', - * inScheme: 'http://example.com/dishes', - * broader: [ [{ key: 'http://example.com/dishes#potatoBased', label: 'Plats à base de pomme de terre' }] ] + * "rdf$about": "http://example.com/dishes#mashed", + * "prefLabel@fr": "Purée de pomme de terre", + * "prefLabel@en": "Mashed potatoes", + * "prefLabel@de": "Kartoffelpüree", + * "inScheme": "http://example.com/dishes", + * "broader": [ [{ "key": "http://example.com/dishes#potatoBased", "label": "Plats à base de pomme de terre" }] ] * }, * { - * 'rdf$about': 'http://example.com/dishes#potatoBased', - * 'prefLabel@fr': 'Plats à base de pomme de terre', - * 'prefLabel@en': 'Potato based dishes', - * 'prefLabel@de': 'Kartoffelgerichte', - * inScheme: 'http://example.com/dishes', - * topConceptOf: 'http://example.com/dishes', - * narrower: [ - * { key: 'http://example.com/dishes#fries', label: 'Frites' }, + * "rdf$about": "http://example.com/dishes#potatoBased", + * "prefLabel@fr": "Plats à base de pomme de terre", + * "prefLabel@en": "Potato based dishes", + * "prefLabel@de": "Kartoffelgerichte", + * "inScheme": "http://example.com/dishes", + * "topConceptOf": "http://example.com/dishes", + * "narrower": [ + * { "key": "http://example.com/dishes#fries", "label": "Frites" }, * { - * key: 'http://example.com/dishes#mashed', - * label: 'Purée de pomme de terre' + * "key": "http://example.com/dishes#mashed", + * "label": "Purée de pomme de terre" * } * ] * } @@ -195,7 +192,7 @@ async function SKOSPathEnum(data, feed) { * ``` * * @name SKOSPathEnum - * @param {String} [language=en] Choose langauge of prefLabel + * @param {String} [language=en] Choose language of `prefLabel` * @returns {Object} Returns object */ export default { diff --git a/packages/loterre/src/skos-to-gexf.js b/packages/loterre/src/skos-to-gexf.js index cf2ecbbc..36b46434 100644 --- a/packages/loterre/src/skos-to-gexf.js +++ b/packages/loterre/src/skos-to-gexf.js @@ -4,6 +4,7 @@ import { createStore } from '@ezs/store'; /** * @param {string} property * @param {Object} obj + * @private */ function checkIfPropertyExist(property, obj) { return (typeof (obj[property]) !== 'undefined'); @@ -17,8 +18,8 @@ function checkIfPropertyExist(property, obj) { * @param {Object} store * @param {string} lang * @param {number} weight + * @private */ - async function writeEdge(data, feed, property, store, lang, weight) { for (let i = 0; i < data[property].length; i += 1) { const key = `${data.rdf$about}#${data[property][i].key}`; @@ -38,7 +39,6 @@ async function writeEdge(data, feed, property, store, lang, weight) { } /** - * SKOSHierarchy * Output: * * ```json @@ -50,9 +50,9 @@ async function writeEdge(data, feed, property, store, lang, weight) { * } * ] * ``` - * @name SKOSHierarchy - * @param {String} [language=en] Choose langauge of prefLabel - * @returns {Promise} Return fedd Object + * @name SKOSToGexf + * @param {String} [language=en] Choose language of `prefLabel` + * @returns {Promise} Return fed Object */ async function SKOSToGexf(data, feed) { const lang = this.getParam('language', 'en'); From 4309c109f516a581452da2361d657f2973ad93bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 09:51:13 +0200 Subject: [PATCH 08/13] docs(sparql): Fix bad JSDoc --- docs/plugin-sparql.md | 58 +++++++++++++----------------- packages/sparql/README.md | 58 +++++++++++++----------------- packages/sparql/src/decodeQuery.js | 21 +++++++---- packages/sparql/src/query.js | 16 ++++++--- packages/sparql/src/toDistinct.js | 16 ++++++--- 5 files changed, 89 insertions(+), 80 deletions(-) diff --git a/docs/plugin-sparql.md b/docs/plugin-sparql.md index 6a4b71da..7597eadc 100644 --- a/docs/plugin-sparql.md +++ b/docs/plugin-sparql.md @@ -24,45 +24,42 @@ npm install @ezs/sparql ** Take a query share link from a YASGUI editor and convert it into an object -which contains the query and the endpoint. Then, it could be used by `SPARQLQuery` instruction. +which contains the query and the endpoint. Then, it could be used by +`SPARQLQuery` instruction. -#### Examples +Input: -Input: - - -```javascript +```json { - linkQuery: 'https://data.istex.fr/triplestore/sparql/#query=SELECT+DISTINCT+%3Fg%2C+count(*)+AS+%3Fnb+%0AWHERE+%0A%7B+%0A%09graph+%3Fg+%7B+%3Fs+%3Fp+%3Fo+%7D+%0A%7D+%0ALIMIT+3&contentTypeConstruct=text%2Fturtle&endpoint=https%3A%2F%2Fdata.istex.fr%2Fsparql%2F&outputFormat=table' + "linkQuery": "https://data.istex.fr/triplestore/sparql/#query=SELECT+DISTINCT+%3Fg%2C+count(*)+AS+%3Fnb+%0AWHERE+%0A%7B+%0A%09graph+%3Fg+%7B+%3Fs+%3Fp+%3Fo+%7D+%0A%7D+%0ALIMIT+3&contentTypeConstruct=text%2Fturtle&endpoint=https%3A%2F%2Fdata.istex.fr%2Fsparql%2F&outputFormat=table" } ``` -Output: +Output: - -```javascript -{ query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3', - endpoint: 'https://data.istex.fr/sparql/' } +```json +{ + "query": "SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3", + "endpoint": "https://data.istex.fr/sparql/" +} ``` ### SPARQLQuery Take a SPARQL query and endpoint and send in output the execution result in JSON format. -#### Examples - -Input: +Input: - -```javascript -{ query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3', - endpoint: 'https://data.istex.fr/sparql/' } +```json +{ + "query": "SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3", + "endpoint": "https://data.istex.fr/sparql/" +} ``` -Ouput: - +Ouput: -```javascript +```json { "head": { "link": [], "vars": ["g", "nb"] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "g": { @@ -98,10 +95,7 @@ Ouput: ### SPARQLToDistinct -- **See: SPARQLQuery - ** - -Format SPARQLQuery result as a LODEX routine. +Format [SPARQLQuery](#sparqlquery) result as a LODEX routine. The input should contain **at least two fields**: @@ -110,12 +104,11 @@ The input should contain **at least two fields**: > **Warning**: input's second field value should contain an integer -#### Examples - -Input: +See [SPARQLQuery](#sparqlquery) +Input: -```javascript +```json { "head": { "link": [], "vars": ["g", "nb"] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "g": { @@ -147,10 +140,9 @@ Input: } ``` -Output: - +Output: -```javascript +```json { "total": 3, "data": [{ diff --git a/packages/sparql/README.md b/packages/sparql/README.md index 6a4b71da..7597eadc 100644 --- a/packages/sparql/README.md +++ b/packages/sparql/README.md @@ -24,45 +24,42 @@ npm install @ezs/sparql ** Take a query share link from a YASGUI editor and convert it into an object -which contains the query and the endpoint. Then, it could be used by `SPARQLQuery` instruction. +which contains the query and the endpoint. Then, it could be used by +`SPARQLQuery` instruction. -#### Examples +Input: -Input: - - -```javascript +```json { - linkQuery: 'https://data.istex.fr/triplestore/sparql/#query=SELECT+DISTINCT+%3Fg%2C+count(*)+AS+%3Fnb+%0AWHERE+%0A%7B+%0A%09graph+%3Fg+%7B+%3Fs+%3Fp+%3Fo+%7D+%0A%7D+%0ALIMIT+3&contentTypeConstruct=text%2Fturtle&endpoint=https%3A%2F%2Fdata.istex.fr%2Fsparql%2F&outputFormat=table' + "linkQuery": "https://data.istex.fr/triplestore/sparql/#query=SELECT+DISTINCT+%3Fg%2C+count(*)+AS+%3Fnb+%0AWHERE+%0A%7B+%0A%09graph+%3Fg+%7B+%3Fs+%3Fp+%3Fo+%7D+%0A%7D+%0ALIMIT+3&contentTypeConstruct=text%2Fturtle&endpoint=https%3A%2F%2Fdata.istex.fr%2Fsparql%2F&outputFormat=table" } ``` -Output: +Output: - -```javascript -{ query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3', - endpoint: 'https://data.istex.fr/sparql/' } +```json +{ + "query": "SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3", + "endpoint": "https://data.istex.fr/sparql/" +} ``` ### SPARQLQuery Take a SPARQL query and endpoint and send in output the execution result in JSON format. -#### Examples - -Input: +Input: - -```javascript -{ query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3', - endpoint: 'https://data.istex.fr/sparql/' } +```json +{ + "query": "SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3", + "endpoint": "https://data.istex.fr/sparql/" +} ``` -Ouput: - +Ouput: -```javascript +```json { "head": { "link": [], "vars": ["g", "nb"] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "g": { @@ -98,10 +95,7 @@ Ouput: ### SPARQLToDistinct -- **See: SPARQLQuery - ** - -Format SPARQLQuery result as a LODEX routine. +Format [SPARQLQuery](#sparqlquery) result as a LODEX routine. The input should contain **at least two fields**: @@ -110,12 +104,11 @@ The input should contain **at least two fields**: > **Warning**: input's second field value should contain an integer -#### Examples - -Input: +See [SPARQLQuery](#sparqlquery) +Input: -```javascript +```json { "head": { "link": [], "vars": ["g", "nb"] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "g": { @@ -147,10 +140,9 @@ Input: } ``` -Output: - +Output: -```javascript +```json { "total": 3, "data": [{ diff --git a/packages/sparql/src/decodeQuery.js b/packages/sparql/src/decodeQuery.js index a06553c8..cf20ac58 100644 --- a/packages/sparql/src/decodeQuery.js +++ b/packages/sparql/src/decodeQuery.js @@ -1,15 +1,24 @@ /** * Take a query share link from a YASGUI editor and convert it into an object - * which contains the query and the endpoint. Then, it could be used by ` SPARQLQuery ` instruction. + * which contains the query and the endpoint. Then, it could be used by + * `SPARQLQuery` instruction. * - * @example Input: + * Input: + * + * ```json * { - * linkQuery: 'https://data.istex.fr/triplestore/sparql/#query=SELECT+DISTINCT+%3Fg%2C+count(*)+AS+%3Fnb+%0AWHERE+%0A%7B+%0A%09graph+%3Fg+%7B+%3Fs+%3Fp+%3Fo+%7D+%0A%7D+%0ALIMIT+3&contentTypeConstruct=text%2Fturtle&endpoint=https%3A%2F%2Fdata.istex.fr%2Fsparql%2F&outputFormat=table' + * "linkQuery": "https://data.istex.fr/triplestore/sparql/#query=SELECT+DISTINCT+%3Fg%2C+count(*)+AS+%3Fnb+%0AWHERE+%0A%7B+%0A%09graph+%3Fg+%7B+%3Fs+%3Fp+%3Fo+%7D+%0A%7D+%0ALIMIT+3&contentTypeConstruct=text%2Fturtle&endpoint=https%3A%2F%2Fdata.istex.fr%2Fsparql%2F&outputFormat=table" * } + * ``` + * + * Output: * - * @example Output: - * { query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3', - * endpoint: 'https://data.istex.fr/sparql/' } + * ```json + * { + * "query": "SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3", + * "endpoint": "https://data.istex.fr/sparql/" + * } + * ``` * * @export * @name SPARQLDecodeQuery diff --git a/packages/sparql/src/query.js b/packages/sparql/src/query.js index a60bd105..0dc51baa 100644 --- a/packages/sparql/src/query.js +++ b/packages/sparql/src/query.js @@ -3,11 +3,18 @@ const fetch = require('fetch-with-proxy').default; /** * Take a SPARQL query and endpoint and send in output the execution result in JSON format. * - * @example Input: - * { query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3', - * endpoint: 'https://data.istex.fr/sparql/' } + * Input: * - * @example Ouput: + * ```json + * { + * "query": "SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3", + * "endpoint": "https://data.istex.fr/sparql/" + * } + * ``` + * + * Ouput: + * + * ```json * { "head": { "link": [], "vars": ["g", "nb"] }, * "results": { "distinct": false, "ordered": true, "bindings": [ * { "g": { @@ -39,6 +46,7 @@ const fetch = require('fetch-with-proxy').default; * }} * ]} * } + * ``` * * @export * @name SPARQLQuery diff --git a/packages/sparql/src/toDistinct.js b/packages/sparql/src/toDistinct.js index 8d0ff8a7..1561357a 100644 --- a/packages/sparql/src/toDistinct.js +++ b/packages/sparql/src/toDistinct.js @@ -1,13 +1,18 @@ /** - * Format SPARQLQuery result as a LODEX routine. + * Format {@link SPARQLQuery} result as a LODEX routine. * * The input should contain **at least two fields**: + * * - the first is corresponding with the **_id** output field * - the second is corresponding with the **value** output field * * > **Warning**: input's second field value should contain an integer * - * @example Input: + * See {@link SPARQLQuery} + * + * Input: + * + * ```json * { "head": { "link": [], "vars": ["g", "nb"] }, * "results": { "distinct": false, "ordered": true, "bindings": [ * { "g": { @@ -37,8 +42,11 @@ * }} * ]} * } + * ``` + * + * Output: * - * @example Output: + * ```json * { * "total": 3, * "data": [{ @@ -53,9 +61,9 @@ * } * ] * } + * ``` * * @export - * @see SPARQLQuery * @name SPARQLToDistinct */ export default function SPARQLToDistinct(data, feed) { From 13754fc0f52c925b5762efe3f7dd31d1b7edeb69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 09:58:54 +0200 Subject: [PATCH 09/13] docs(storage): Small improvements to JSDoc --- docs/plugin-storage.md | 7 ++++--- packages/storage/README.md | 7 ++++--- packages/storage/src/boost.js | 2 +- packages/storage/src/flow.js | 3 ++- packages/storage/src/identify.js | 7 +++++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/plugin-storage.md b/docs/plugin-storage.md index 611c3de0..37245201 100644 --- a/docs/plugin-storage.md +++ b/docs/plugin-storage.md @@ -32,7 +32,7 @@ Takes an `Object` delegate processing to an external pipeline and cache the resu - `feed` - `file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a file - `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of characters -- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a object +- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an object - `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a URL-like command - `key` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the cache key form the stream, in not provided, it's computed with the first chunk - `cleanupDelay` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Frequency (seconds) to cleanup the cache (EZS_DELAY) (optional, default `3600`) @@ -42,7 +42,8 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### flow Take an `Object` and replace it with all the objects of the same domain contained in the store. -Warning: order is not guaranteed + +> Warning: order is not guaranteed #### Parameters @@ -55,7 +56,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### identify -Take `Object`, and compute & add a identifier +Take `Object`, and compute & add an identifier #### Parameters diff --git a/packages/storage/README.md b/packages/storage/README.md index 611c3de0..37245201 100644 --- a/packages/storage/README.md +++ b/packages/storage/README.md @@ -32,7 +32,7 @@ Takes an `Object` delegate processing to an external pipeline and cache the resu - `feed` - `file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a file - `script` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a string of characters -- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a object +- `commands` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in an object - `command` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the external pipeline is described in a URL-like command - `key` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the cache key form the stream, in not provided, it's computed with the first chunk - `cleanupDelay` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Frequency (seconds) to cleanup the cache (EZS_DELAY) (optional, default `3600`) @@ -42,7 +42,8 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### flow Take an `Object` and replace it with all the objects of the same domain contained in the store. -Warning: order is not guaranteed + +> Warning: order is not guaranteed #### Parameters @@ -55,7 +56,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### identify -Take `Object`, and compute & add a identifier +Take `Object`, and compute & add an identifier #### Parameters diff --git a/packages/storage/src/boost.js b/packages/storage/src/boost.js index d65ce4f1..de4bc95d 100644 --- a/packages/storage/src/boost.js +++ b/packages/storage/src/boost.js @@ -47,7 +47,7 @@ function hitThe(cache, ttl) { * * @param {String} [file] the external pipeline is described in a file * @param {String} [script] the external pipeline is described in a string of characters - * @param {String} [commands] the external pipeline is described in a object + * @param {String} [commands] the external pipeline is described in an object * @param {String} [command] the external pipeline is described in a URL-like command * @param {String} [key] the cache key form the stream, in not provided, it's computed with the first chunk * @param {Number} [cleanupDelay=3600] Frequency (seconds) to cleanup the cache (EZS_DELAY) diff --git a/packages/storage/src/flow.js b/packages/storage/src/flow.js index bc63ff00..23fa5d95 100644 --- a/packages/storage/src/flow.js +++ b/packages/storage/src/flow.js @@ -2,7 +2,8 @@ import Store from './store'; /** * Take an `Object` and replace it with all the objects of the same domain contained in the store. - * Warning: order is not guaranteed + * + * > Warning: order is not guaranteed * * @param {String} [domain=ezs] domain ID (same for all objects) * @param {Number} [length] limit the number of output objects diff --git a/packages/storage/src/identify.js b/packages/storage/src/identify.js index f1920abe..cf299762 100644 --- a/packages/storage/src/identify.js +++ b/packages/storage/src/identify.js @@ -3,7 +3,10 @@ import set from 'lodash.set'; import generate from 'nanoid/async/generate'; import nolookalikes from 'nanoid-dictionary/nolookalikes'; -export const validKey = (input) => (Boolean(input) && typeof input === 'string' && input.search(/\w+:(\/?\/?)[^\s]+/g) >= 0); +export const validKey = (input) => + Boolean(input) && + typeof input === 'string' && + input.search(/\w+:(\/?\/?)[^\s]+/g) >= 0; // // JS implentation of NCDA @@ -31,7 +34,7 @@ export function ncda(input, alphabet = []) { } /** - * Take `Object`, and compute & add a identifier + * Take `Object`, and compute & add an identifier * * @param {String} [scheme = uid] scheme prefix * @param {String} [path = uri] path containing the object Identifier From 6f0760e1547cc6a420cbce61d4c2d417b19877bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 10:19:36 +0200 Subject: [PATCH 10/13] style(transformers): Lint code --- packages/transformers/src/operations/NUMBER.js | 2 +- packages/transformers/src/operations/SPLIT.js | 2 +- packages/transformers/src/operations/UNIQ.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/transformers/src/operations/NUMBER.js b/packages/transformers/src/operations/NUMBER.js index 45d2256f..1982ad14 100644 --- a/packages/transformers/src/operations/NUMBER.js +++ b/packages/transformers/src/operations/NUMBER.js @@ -3,7 +3,7 @@ import { transformer } from './transformer'; export const valueToNumber = value => { const number = Number(value); - return isNaN(number) ? 0 : number; + return Number.isNaN(number) ? 0 : number; }; const transformation = () => value => transformer(valueToNumber, value); diff --git a/packages/transformers/src/operations/SPLIT.js b/packages/transformers/src/operations/SPLIT.js index 31be8bef..a7031f8f 100644 --- a/packages/transformers/src/operations/SPLIT.js +++ b/packages/transformers/src/operations/SPLIT.js @@ -8,7 +8,7 @@ export const split = (value, separator) => { if (typeof value !== 'string') { throw new Error('Invalid value: need a string'); } - let splitted = value.split(separator).map(x => x.trim()); + const splitted = value.split(separator).map(x => x.trim()); return splitted.filter(x => x != ''); }; diff --git a/packages/transformers/src/operations/UNIQ.js b/packages/transformers/src/operations/UNIQ.js index 835f402a..1d54387a 100644 --- a/packages/transformers/src/operations/UNIQ.js +++ b/packages/transformers/src/operations/UNIQ.js @@ -1,4 +1,5 @@ import uniq from 'lodash.uniq'; + export const uniqArray = value => { if (value === null || typeof value === 'undefined') { return null; From fc2edef61909dc5797cee601ed8f47f6e6a9165d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 10:20:48 +0200 Subject: [PATCH 11/13] fix(transformers): non string search value non string search value was not stringified in REPLACE --- packages/transformers/src/operations/REPLACE_REGEX.js | 2 +- packages/transformers/src/operations/REPLACE_REGEX.spec.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/transformers/src/operations/REPLACE_REGEX.js b/packages/transformers/src/operations/REPLACE_REGEX.js index 25aff337..7eba24b1 100644 --- a/packages/transformers/src/operations/REPLACE_REGEX.js +++ b/packages/transformers/src/operations/REPLACE_REGEX.js @@ -1,7 +1,7 @@ import { transformerWithTwoArgs } from './transformer'; export const replace = (value, searchValue, replaceValue) => { - const template = typeof input === 'string' ? searchValue : searchValue.toString(); + const template = typeof searchValue === 'string' ? searchValue : searchValue.toString(); const cleantemplate = template.trim().replace(/^[/]+/, '').replace(/[/]+$/, ''); return value.replace(RegExp(cleantemplate, 'gi'), replaceValue); }; diff --git a/packages/transformers/src/operations/REPLACE_REGEX.spec.js b/packages/transformers/src/operations/REPLACE_REGEX.spec.js index bd4fe036..ffbab866 100644 --- a/packages/transformers/src/operations/REPLACE_REGEX.spec.js +++ b/packages/transformers/src/operations/REPLACE_REGEX.spec.js @@ -13,4 +13,7 @@ describe('REPLACE_REGEX', () => { it('should return new value from string', () => { expect(replace('hello world', '\\s*wo\\w+', '')).toBe('hello'); }); + it('should return new value from number search value', () => { + expect(replace('1', 1, '2')).toBe('2'); + }); }); From 7ade53d0725ae7c0af88e790122a046994e9434b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 10:22:40 +0200 Subject: [PATCH 12/13] fix(transformers): Fix error messages --- .../src/operations/transformer.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/transformers/src/operations/transformer.js b/packages/transformers/src/operations/transformer.js index 36a07193..59df39dd 100644 --- a/packages/transformers/src/operations/transformer.js +++ b/packages/transformers/src/operations/transformer.js @@ -15,7 +15,7 @@ export const transformerWithArg = (func, name, value, args) => { const arg = args.find(a => a.name === name); if (!arg) { - throw new Error('Invalid Argument for ${name}'); + throw new Error(`Invalid Argument for ${name}`); } return new Promise((resolve, reject) => { @@ -36,7 +36,7 @@ export const transformerWithTwoArgs = (func, name1, name2, value, args) => { const arg2 = args.find(a => a.name === name2); if (!arg1 || !arg2) { - throw new Error('Invalid Argument for ${name1} or ${name2}'); + throw new Error(`Invalid Argument for ${name1} or ${name2}`); } return new Promise((resolve, reject) => { @@ -56,7 +56,7 @@ export const rawTransformerWithArg = (func, name, value, args) => { const arg = args.find(a => a.name === name); if (!arg) { - throw new Error('Invalid Argument for ${name}'); + throw new Error(`Invalid Argument for ${name}`); } return new Promise((resolve, reject) => { @@ -68,12 +68,10 @@ export const rawTransformerWithArg = (func, name, value, args) => { }); }; -export const rawTransformerWithoutArg = (func, value) => { - return new Promise((resolve, reject) => { - try { - resolve(func(value)); - } catch (error) { - reject(error); - } - }); -}; +export const rawTransformerWithoutArg = (func, value) => new Promise((resolve, reject) => { + try { + resolve(func(value)); + } catch (error) { + reject(error); + } +}); From 59bc7f5a9de9568e299354af1c4fadb668add584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Parmentier?= Date: Fri, 23 Jul 2021 11:26:20 +0200 Subject: [PATCH 13/13] docs(transformers): Slightly improve JSDoc --- docs/plugin-transformers.md | 170 ++++++++++++------ packages/transformers/README.md | 170 ++++++++++++------ packages/transformers/src/dollar-array.js | 25 ++- packages/transformers/src/dollar-boolean.js | 35 +++- packages/transformers/src/dollar-column.js | 5 +- .../transformers/src/dollar-concat-uri.js | 9 +- packages/transformers/src/dollar-concat.js | 4 +- packages/transformers/src/dollar-default.js | 4 +- packages/transformers/src/dollar-format.js | 4 +- packages/transformers/src/dollar-get.js | 6 +- packages/transformers/src/dollar-join.js | 4 +- packages/transformers/src/dollar-lowercase.js | 2 +- packages/transformers/src/dollar-mapping.js | 6 +- packages/transformers/src/dollar-mask.js | 4 +- packages/transformers/src/dollar-number.js | 4 +- packages/transformers/src/dollar-parse.js | 2 +- packages/transformers/src/dollar-prefix.js | 4 +- packages/transformers/src/dollar-remove.js | 4 +- .../transformers/src/dollar-replace-regex.js | 7 +- packages/transformers/src/dollar-replace.js | 7 +- packages/transformers/src/dollar-select.js | 9 +- packages/transformers/src/dollar-shift.js | 4 +- packages/transformers/src/dollar-split.js | 5 +- packages/transformers/src/dollar-string.js | 2 +- packages/transformers/src/dollar-suffix.js | 4 +- packages/transformers/src/dollar-trim.js | 2 +- .../transformers/src/dollar-truncate-words.js | 2 +- packages/transformers/src/dollar-truncate.js | 5 +- packages/transformers/src/dollar-uniq.js | 2 +- packages/transformers/src/dollar-uppercase.js | 2 +- packages/transformers/src/dollar-urlencode.js | 2 +- packages/transformers/src/dollar-value.js | 4 +- 32 files changed, 342 insertions(+), 177 deletions(-) diff --git a/docs/plugin-transformers.md b/docs/plugin-transformers.md index 4a0cd07f..af8a1142 100644 --- a/docs/plugin-transformers.md +++ b/docs/plugin-transformers.md @@ -123,13 +123,36 @@ Exemple : ```ini [$ARRAY] field = keywords + +[exchange] +value = omit('$origin') +``` + +Entrée: + +```json +[{ + "keywords": "un" +}, { + "keywords": "deux" +}] +``` + +Sortie: + +```json +[{ + "keywords": ["un"] +}, { + "keywords": ["deux"] +}] ``` #### Parameters - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -142,13 +165,46 @@ Exemple : ```ini [$BOOLEAN] field = haveMoney + +[exchange] +value = omit('$origin') +``` + +Entrée: + +```json +[{ + "name": "Chuck", + "haveMoney": 10000 +}, { + "name": "Charlot", + "haveMoney": "yes" +}, { + "name": "Alan", + "haveMoney": 1 +}] +``` + +Sortie: + +```json +[{ + "name": "Chuck", + "haveMoney": false +}, { + "name": "Charlot", + "haveMoney": true +}, { + "name": "Alan", + "haveMoney": true +}] ``` #### Parameters - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -187,8 +243,8 @@ column = oldTitle - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use during the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use during the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -209,14 +265,14 @@ columns = part2 - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the transformation -- `columns` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get value +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the transformation +- `columns` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get value Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $CONCAT_URI -compoer un identifiant avec plusieurs champs +composer un identifiant avec plusieurs champs Exemple : @@ -232,9 +288,9 @@ separator = - - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the transformation -- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get data -- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** glue between each column +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the transformation +- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get data +- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** glue between each column Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -254,8 +310,8 @@ alternative = not available - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `alternative` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use if field does not exist +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `alternative` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use if field does not exist Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -273,14 +329,14 @@ with = (%s:%s) - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get data source (must be an array) -- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** template string like sprintf +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get data source (must be an array) +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** template string like sprintf Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $GET -Récupére toutes les valeurs correspondant à un chemin (dot path) +Récupère toutes les valeurs correspondant à un chemin (dot path) Exemple : @@ -294,8 +350,8 @@ path = input - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the transformation -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get value +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the transformation +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get value Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -315,8 +371,8 @@ path = input - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation (must be an array) -- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** glue between each field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation (must be an array) +- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** glue between each field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -335,14 +391,14 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $MAPPING Opération permettant le remplacement à partir d'une table -(équivalent à l'enchaînement de plusieurs opération REPLACE) +(équivalent à l'enchaînement de plusieurs opérations [$REPLACE](#replace)) Exemple : @@ -356,8 +412,8 @@ list = "hello":"bonjour", "hi":"salut" - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `list` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the mapping list +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `list` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the mapping list Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -377,8 +433,8 @@ with = ^[a-z]+$ - `data` - `feed` -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the control -- `value` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use during the transformation +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the control +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** regular expression to check Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -397,7 +453,7 @@ field = counter - `data` - `feed` -- `feild` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -416,7 +472,7 @@ field = json - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -436,8 +492,8 @@ with = # - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `vith` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to add at the begining of the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to add at the begining of the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -457,8 +513,8 @@ the = . - `data` - `feed` -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `the` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value todrop in the field +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `the` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to drop in the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -479,9 +535,9 @@ replaceValue = un - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to search -- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to replace with +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to search +- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to replace with Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -502,30 +558,30 @@ replaceValue = bonjour - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** regex to search -- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to replace with +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** regex to search +- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to replace with Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $SELECT -Prendre une valeir dans un objet à partir de son chemin (dot path) +Prendre une valeur dans un objet à partir de son chemin (dot path) Exemple : ```ini [$SELECT] field = title -path +path = en ``` #### Parameters - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the selection -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get value +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the selection +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get value Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -545,8 +601,8 @@ gap = 2 - `data` - `feed` -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** how many item or characters to drop +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** how many items or characters to drop Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -566,8 +622,8 @@ separator = | - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use to split the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use to split the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -586,7 +642,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -606,8 +662,8 @@ with = ! - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to add at the end of the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to add at the end of the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -626,7 +682,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -646,15 +702,15 @@ gap = 25 - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** how many items or characters to keep +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** how many items or characters to keep Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $TRUNCATE_WORDS Opération permettant la troncature par nombre de mots -et non pas par nombre de caractères comme pour opération TRUNCATE +et non pas par nombre de caractères comme pour l'opération [$TRUNCATE](#truncate) Exemple : @@ -688,7 +744,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation (must be an aarray) +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation (must be an aarray) Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -707,7 +763,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -726,7 +782,7 @@ field = url - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -746,7 +802,7 @@ value = Hello world - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** new field path -- `value` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use to set the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** new field path +- `value` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use to set the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** diff --git a/packages/transformers/README.md b/packages/transformers/README.md index 4a0cd07f..af8a1142 100644 --- a/packages/transformers/README.md +++ b/packages/transformers/README.md @@ -123,13 +123,36 @@ Exemple : ```ini [$ARRAY] field = keywords + +[exchange] +value = omit('$origin') +``` + +Entrée: + +```json +[{ + "keywords": "un" +}, { + "keywords": "deux" +}] +``` + +Sortie: + +```json +[{ + "keywords": ["un"] +}, { + "keywords": ["deux"] +}] ``` #### Parameters - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -142,13 +165,46 @@ Exemple : ```ini [$BOOLEAN] field = haveMoney + +[exchange] +value = omit('$origin') +``` + +Entrée: + +```json +[{ + "name": "Chuck", + "haveMoney": 10000 +}, { + "name": "Charlot", + "haveMoney": "yes" +}, { + "name": "Alan", + "haveMoney": 1 +}] +``` + +Sortie: + +```json +[{ + "name": "Chuck", + "haveMoney": false +}, { + "name": "Charlot", + "haveMoney": true +}, { + "name": "Alan", + "haveMoney": true +}] ``` #### Parameters - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -187,8 +243,8 @@ column = oldTitle - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use during the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use during the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -209,14 +265,14 @@ columns = part2 - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the transformation -- `columns` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get value +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the transformation +- `columns` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get value Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $CONCAT_URI -compoer un identifiant avec plusieurs champs +composer un identifiant avec plusieurs champs Exemple : @@ -232,9 +288,9 @@ separator = - - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the transformation -- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get data -- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** glue between each column +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the transformation +- `column` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get data +- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** glue between each column Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -254,8 +310,8 @@ alternative = not available - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `alternative` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use if field does not exist +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `alternative` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use if field does not exist Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -273,14 +329,14 @@ with = (%s:%s) - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get data source (must be an array) -- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** template string like sprintf +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get data source (must be an array) +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** template string like sprintf Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $GET -Récupére toutes les valeurs correspondant à un chemin (dot path) +Récupère toutes les valeurs correspondant à un chemin (dot path) Exemple : @@ -294,8 +350,8 @@ path = input - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the transformation -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get value +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the transformation +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get value Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -315,8 +371,8 @@ path = input - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation (must be an array) -- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** glue between each field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation (must be an array) +- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** glue between each field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -335,14 +391,14 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $MAPPING Opération permettant le remplacement à partir d'une table -(équivalent à l'enchaînement de plusieurs opération REPLACE) +(équivalent à l'enchaînement de plusieurs opérations [$REPLACE](#replace)) Exemple : @@ -356,8 +412,8 @@ list = "hello":"bonjour", "hi":"salut" - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `list` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** the mapping list +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `list` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the mapping list Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -377,8 +433,8 @@ with = ^[a-z]+$ - `data` - `feed` -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the control -- `value` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use during the transformation +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the control +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** regular expression to check Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -397,7 +453,7 @@ field = counter - `data` - `feed` -- `feild` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -416,7 +472,7 @@ field = json - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -436,8 +492,8 @@ with = # - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `vith` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to add at the begining of the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to add at the begining of the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -457,8 +513,8 @@ the = . - `data` - `feed` -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `the` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value todrop in the field +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `the` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to drop in the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -479,9 +535,9 @@ replaceValue = un - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to search -- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to replace with +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to search +- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to replace with Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -502,30 +558,30 @@ replaceValue = bonjour - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** regex to search -- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to replace with +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `searchValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** regex to search +- `replaceValue` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to replace with Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $SELECT -Prendre une valeir dans un objet à partir de son chemin (dot path) +Prendre une valeur dans un objet à partir de son chemin (dot path) Exemple : ```ini [$SELECT] field = title -path +path = en ``` #### Parameters - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get the result of the selection -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to get value +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get the result of the selection +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to get value Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -545,8 +601,8 @@ gap = 2 - `data` - `feed` -- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** how many item or characters to drop +- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** how many items or characters to drop Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -566,8 +622,8 @@ separator = | - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use to split the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use to split the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -586,7 +642,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -606,8 +662,8 @@ with = ! - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to add at the end of the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `with` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to add at the end of the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -626,7 +682,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -646,15 +702,15 @@ gap = 25 - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation -- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** how many items or characters to keep +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation +- `gap` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** how many items or characters to keep Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### $TRUNCATE_WORDS Opération permettant la troncature par nombre de mots -et non pas par nombre de caractères comme pour opération TRUNCATE +et non pas par nombre de caractères comme pour l'opération [$TRUNCATE](#truncate) Exemple : @@ -688,7 +744,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation (must be an aarray) +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation (must be an aarray) Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -707,7 +763,7 @@ field = title - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -726,7 +782,7 @@ field = url - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** field path to apply the transformation +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** field path to apply the transformation Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** @@ -746,7 +802,7 @@ value = Hello world - `data` - `feed` -- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** new field path -- `value` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** value to use to set the field +- `field` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** new field path +- `value` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** value to use to set the field Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** diff --git a/packages/transformers/src/dollar-array.js b/packages/transformers/src/dollar-array.js index 68432c1d..ecbb0f6a 100644 --- a/packages/transformers/src/dollar-array.js +++ b/packages/transformers/src/dollar-array.js @@ -9,9 +9,32 @@ import dollar from './dollar'; * ```ini * [$ARRAY] * field = keywords + * + * [exchange] + * value = omit('$origin') + * ``` + * + * Entrée: + * + * ```json + * [{ + * "keywords": "un" + * }, { + * "keywords": "deux" + * }] + * ``` + * + * Sortie: + * + * ```json + * [{ + * "keywords": ["un"] + * }, { + * "keywords": ["deux"] + * }] * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $ARRAY(data, feed) { diff --git a/packages/transformers/src/dollar-boolean.js b/packages/transformers/src/dollar-boolean.js index 42e5d3f0..3f20c09a 100644 --- a/packages/transformers/src/dollar-boolean.js +++ b/packages/transformers/src/dollar-boolean.js @@ -9,9 +9,42 @@ import dollar from './dollar'; * ```ini * [$BOOLEAN] * field = haveMoney + * + * [exchange] + * value = omit('$origin') + * ``` + * + * Entrée: + * + * ```json + * [{ + * "name": "Chuck", + * "haveMoney": 10000 + * }, { + * "name": "Charlot", + * "haveMoney": "yes" + * }, { + * "name": "Alan", + * "haveMoney": 1 + * }] + * ``` + * + * Sortie: + * + * ```json + * [{ + * "name": "Chuck", + * "haveMoney": false + * }, { + * "name": "Charlot", + * "haveMoney": true + * }, { + * "name": "Alan", + * "haveMoney": true + * }] * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $BOOLEAN(data, feed) { diff --git a/packages/transformers/src/dollar-column.js b/packages/transformers/src/dollar-column.js index afdbac9f..050c0b30 100644 --- a/packages/transformers/src/dollar-column.js +++ b/packages/transformers/src/dollar-column.js @@ -11,8 +11,9 @@ import dollar from './dollar'; * field = newTitle * column = oldTitle * ``` - * @param {String} [field] field path to apply the transformation - * @param {String} [column] value to use during the transformation + * + * @param {String} field field path to apply the transformation + * @param {String} column value to use during the transformation * @returns {Object} */ export default function $COLUMN(data, feed) { diff --git a/packages/transformers/src/dollar-concat-uri.js b/packages/transformers/src/dollar-concat-uri.js index 80e94539..cc7b7684 100644 --- a/packages/transformers/src/dollar-concat-uri.js +++ b/packages/transformers/src/dollar-concat-uri.js @@ -2,7 +2,7 @@ import transformer from './operations/CONCAT_URI'; import dollar from './dollar'; /** - * compoer un identifiant avec plusieurs champs + * composer un identifiant avec plusieurs champs * * Exemple : * @@ -13,9 +13,10 @@ import dollar from './dollar'; * column = prenom * separator = - * ``` - * @param {String} [field] field path to get the result of the transformation - * @param {String} [column] field path to get data - * @param {String} [separator] glue between each column + * + * @param {String} field field path to get the result of the transformation + * @param {String} column field path to get data + * @param {String} separator glue between each column * @returns {Object} */ export default function $CONCAT_URI(data, feed) { diff --git a/packages/transformers/src/dollar-concat.js b/packages/transformers/src/dollar-concat.js index 2b1cf37c..b200b94a 100644 --- a/packages/transformers/src/dollar-concat.js +++ b/packages/transformers/src/dollar-concat.js @@ -13,8 +13,8 @@ import dollar from './dollar'; * columns = part2 * ``` * - * @param {String} [field] field path to get the result of the transformation - * @param {String} [columns] field path to get value + * @param {String} field field path to get the result of the transformation + * @param {String} columns field path to get value * @returns {Object} */ export default function $CONCAT(data, feed) { diff --git a/packages/transformers/src/dollar-default.js b/packages/transformers/src/dollar-default.js index dc180e31..9e6599e5 100644 --- a/packages/transformers/src/dollar-default.js +++ b/packages/transformers/src/dollar-default.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * alternative = not available * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [alternative] value to use if field does not exist + * @param {String} field field path to apply the transformation + * @param {String} alternative value to use if field does not exist * @returns {Object} */ export default function $DEFAULT(data, feed) { diff --git a/packages/transformers/src/dollar-format.js b/packages/transformers/src/dollar-format.js index 6074b318..0fd5c42c 100644 --- a/packages/transformers/src/dollar-format.js +++ b/packages/transformers/src/dollar-format.js @@ -10,8 +10,8 @@ import dollar from './dollar'; * with = (%s:%s) * ``` * - * @param {String} [field] field path to get data source (must be an array) - * @param {String} [with] template string like sprintf + * @param {String} field field path to get data source (must be an array) + * @param {String} with template string like sprintf * @returns {Object} */ export default function $FORMAT(data, feed) { diff --git a/packages/transformers/src/dollar-get.js b/packages/transformers/src/dollar-get.js index 70f536d2..957722f2 100644 --- a/packages/transformers/src/dollar-get.js +++ b/packages/transformers/src/dollar-get.js @@ -2,7 +2,7 @@ import transformer from './operations/GET'; import dollar from './dollar'; /** - * Récupére toutes les valeurs correspondant à un chemin (dot path) + * Récupère toutes les valeurs correspondant à un chemin (dot path) * * Exemple : * @@ -12,8 +12,8 @@ import dollar from './dollar'; * path = input * ``` * - * @param {String} [field] field path to get the result of the transformation - * @param {String} [path] field path to get value + * @param {String} field field path to get the result of the transformation + * @param {String} path field path to get value * @returns {Object} */ export default function $GET(data, feed) { diff --git a/packages/transformers/src/dollar-join.js b/packages/transformers/src/dollar-join.js index 6041178f..e3e4f9ce 100644 --- a/packages/transformers/src/dollar-join.js +++ b/packages/transformers/src/dollar-join.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * path = input * ``` * - * @param {String} [field] field path to apply the transformation (must be an array) - * @param {String} [separator] glue between each field + * @param {String} field field path to apply the transformation (must be an array) + * @param {String} separator glue between each field * @returns {Object} */ export default function $JOIN(data, feed) { diff --git a/packages/transformers/src/dollar-lowercase.js b/packages/transformers/src/dollar-lowercase.js index f186418b..fbe18d66 100644 --- a/packages/transformers/src/dollar-lowercase.js +++ b/packages/transformers/src/dollar-lowercase.js @@ -11,7 +11,7 @@ import dollar from './dollar'; * field = title * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $LOWERCASE(data, feed) { diff --git a/packages/transformers/src/dollar-mapping.js b/packages/transformers/src/dollar-mapping.js index f5350213..23eed735 100644 --- a/packages/transformers/src/dollar-mapping.js +++ b/packages/transformers/src/dollar-mapping.js @@ -3,7 +3,7 @@ import dollar from './dollar'; /** * Opération permettant le remplacement à partir d'une table - * (équivalent à l'enchaînement de plusieurs opération REPLACE) + * (équivalent à l'enchaînement de plusieurs opérations {@link $REPLACE}) * * Exemple : * @@ -13,8 +13,8 @@ import dollar from './dollar'; * list = "hello":"bonjour", "hi":"salut" * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [list] the mapping list + * @param {String} field field path to apply the transformation + * @param {String} list the mapping list * @returns {Object} */ export default function $MAPPING(data, feed) { diff --git a/packages/transformers/src/dollar-mask.js b/packages/transformers/src/dollar-mask.js index 5f86ce81..ae175336 100644 --- a/packages/transformers/src/dollar-mask.js +++ b/packages/transformers/src/dollar-mask.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * with = ^[a-z]+$ * ``` * - * @param {String} [path] field path to apply the control - * @param {String} [value] value to use during the transformation + * @param {String} path field path to apply the control + * @param {String} with regular expression to check * @returns {Object} */ export default function $MASK(data, feed) { diff --git a/packages/transformers/src/dollar-number.js b/packages/transformers/src/dollar-number.js index 0eef0476..88fd6736 100644 --- a/packages/transformers/src/dollar-number.js +++ b/packages/transformers/src/dollar-number.js @@ -10,8 +10,8 @@ import dollar from './dollar'; * [$NUMBER] * field = counter * ``` - * - * @param {String} [feild] field path to apply the transformation + * + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $NUMBER(data, feed) { diff --git a/packages/transformers/src/dollar-parse.js b/packages/transformers/src/dollar-parse.js index 4f8ee3ab..225d458a 100644 --- a/packages/transformers/src/dollar-parse.js +++ b/packages/transformers/src/dollar-parse.js @@ -11,7 +11,7 @@ import dollar from './dollar'; * field = json * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $PARSE(data, feed) { diff --git a/packages/transformers/src/dollar-prefix.js b/packages/transformers/src/dollar-prefix.js index 4acd71a6..575c2ae3 100644 --- a/packages/transformers/src/dollar-prefix.js +++ b/packages/transformers/src/dollar-prefix.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * with = # * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [vith] value to add at the begining of the field + * @param {String} field field path to apply the transformation + * @param {String} with value to add at the begining of the field * @returns {Object} */ export default function $PREFIX(data, feed) { diff --git a/packages/transformers/src/dollar-remove.js b/packages/transformers/src/dollar-remove.js index 7ead09e2..5ebd8f45 100644 --- a/packages/transformers/src/dollar-remove.js +++ b/packages/transformers/src/dollar-remove.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * the = . * ``` * - * @param {String} [path] field path to apply the transformation - * @param {String} [the] value todrop in the field + * @param {String} path field path to apply the transformation + * @param {String} the value to drop in the field * @returns {Object} */ export default function $REMOVE(data, feed) { diff --git a/packages/transformers/src/dollar-replace-regex.js b/packages/transformers/src/dollar-replace-regex.js index f5815947..4ba0dbbf 100644 --- a/packages/transformers/src/dollar-replace-regex.js +++ b/packages/transformers/src/dollar-replace-regex.js @@ -11,12 +11,11 @@ import dollar from './dollar'; * field = title * searchValue = $hel\w+ * replaceValue = bonjour - * * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [searchValue] regex to search - * @param {String} [replaceValue] value to replace with + * @param {String} field field path to apply the transformation + * @param {String} searchValue regex to search + * @param {String} replaceValue value to replace with * @returns {Object} */ export default function $REPLACE_REGEX(data, feed) { diff --git a/packages/transformers/src/dollar-replace.js b/packages/transformers/src/dollar-replace.js index 80bccbde..1f33d3ee 100644 --- a/packages/transformers/src/dollar-replace.js +++ b/packages/transformers/src/dollar-replace.js @@ -11,12 +11,11 @@ import dollar from './dollar'; * field = title * searchValue = 1 * replaceValue = un - * * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [searchValue] value to search - * @param {String} [replaceValue] value to replace with + * @param {String} field field path to apply the transformation + * @param {String} searchValue value to search + * @param {String} replaceValue value to replace with * @returns {Object} */ export default function $REPLACE(data, feed) { diff --git a/packages/transformers/src/dollar-select.js b/packages/transformers/src/dollar-select.js index 9ec824b0..7816d8b0 100644 --- a/packages/transformers/src/dollar-select.js +++ b/packages/transformers/src/dollar-select.js @@ -2,19 +2,18 @@ import transformer from './operations/SELECT'; import dollar from './dollar'; /** - * Prendre une valeir dans un objet à partir de son chemin (dot path) + * Prendre une valeur dans un objet à partir de son chemin (dot path) * * Exemple : * * ```ini * [$SELECT] * field = title - * path - * + * path = en * ``` * - * @param {String} [field] field path to get the result of the selection - * @param {String} [path] field path to get value + * @param {String} field field path to get the result of the selection + * @param {String} path field path to get value * @returns {Object} */ export default function $SELECT(data, feed) { diff --git a/packages/transformers/src/dollar-shift.js b/packages/transformers/src/dollar-shift.js index 564ecfcc..fb8382e5 100644 --- a/packages/transformers/src/dollar-shift.js +++ b/packages/transformers/src/dollar-shift.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * gap = 2 * ``` * - * @param {String} [path] field path to apply the transformation - * @param {String} [gap] how many item or characters to drop + * @param {String} path field path to apply the transformation + * @param {String} gap how many items or characters to drop * @returns {Object} */ export default function $SHIFT(data, feed) { diff --git a/packages/transformers/src/dollar-split.js b/packages/transformers/src/dollar-split.js index b8b1fd6e..eccce74e 100644 --- a/packages/transformers/src/dollar-split.js +++ b/packages/transformers/src/dollar-split.js @@ -10,11 +10,10 @@ import dollar from './dollar'; * [$SPLIT] * field = title * separator = | - * * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [separator] value to use to split the field + * @param {String} field field path to apply the transformation + * @param {String} separator value to use to split the field * @returns {Object} */ export default function $SPLIT(data, feed) { diff --git a/packages/transformers/src/dollar-string.js b/packages/transformers/src/dollar-string.js index 4a0333d9..50ea6d78 100644 --- a/packages/transformers/src/dollar-string.js +++ b/packages/transformers/src/dollar-string.js @@ -11,7 +11,7 @@ import dollar from './dollar'; * field = title * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $STRING(data, feed) { diff --git a/packages/transformers/src/dollar-suffix.js b/packages/transformers/src/dollar-suffix.js index 5c42b7fa..a231ec98 100644 --- a/packages/transformers/src/dollar-suffix.js +++ b/packages/transformers/src/dollar-suffix.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * with = ! * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [with] value to add at the end of the field + * @param {String} field field path to apply the transformation + * @param {String} with value to add at the end of the field * @returns {Object} */ export default function $SUFFIX(data, feed) { diff --git a/packages/transformers/src/dollar-trim.js b/packages/transformers/src/dollar-trim.js index 0fb3e455..2d583222 100644 --- a/packages/transformers/src/dollar-trim.js +++ b/packages/transformers/src/dollar-trim.js @@ -11,7 +11,7 @@ import dollar from './dollar'; * field = title * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $TRIM(data, feed) { diff --git a/packages/transformers/src/dollar-truncate-words.js b/packages/transformers/src/dollar-truncate-words.js index 1c59b833..f66febea 100644 --- a/packages/transformers/src/dollar-truncate-words.js +++ b/packages/transformers/src/dollar-truncate-words.js @@ -3,7 +3,7 @@ import dollar from './dollar'; /** * Opération permettant la troncature par nombre de mots - * et non pas par nombre de caractères comme pour opération TRUNCATE + * et non pas par nombre de caractères comme pour l'opération {@link $TRUNCATE} * * Exemple : * diff --git a/packages/transformers/src/dollar-truncate.js b/packages/transformers/src/dollar-truncate.js index 4b20c033..0d6672ce 100644 --- a/packages/transformers/src/dollar-truncate.js +++ b/packages/transformers/src/dollar-truncate.js @@ -10,11 +10,10 @@ import dollar from './dollar'; * [$TRUNCATE] * field = title * gap = 25 - * * ``` * - * @param {String} [field] field path to apply the transformation - * @param {String} [gap] how many items or characters to keep + * @param {String} field field path to apply the transformation + * @param {String} gap how many items or characters to keep * @returns {Object} */ export default function $TRUNCATE(data, feed) { diff --git a/packages/transformers/src/dollar-uniq.js b/packages/transformers/src/dollar-uniq.js index d0698c70..727c07e3 100644 --- a/packages/transformers/src/dollar-uniq.js +++ b/packages/transformers/src/dollar-uniq.js @@ -11,7 +11,7 @@ import dollar from './dollar'; * field = title * ``` * - * @param {String} [field] field path to apply the transformation (must be an aarray) + * @param {String} field field path to apply the transformation (must be an aarray) * @returns {Object} */ export default function $UNIQ(data, feed) { diff --git a/packages/transformers/src/dollar-uppercase.js b/packages/transformers/src/dollar-uppercase.js index 74f19e5a..bfa23781 100644 --- a/packages/transformers/src/dollar-uppercase.js +++ b/packages/transformers/src/dollar-uppercase.js @@ -11,7 +11,7 @@ import dollar from './dollar'; * field = title * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $UPPERCASE(data, feed) { diff --git a/packages/transformers/src/dollar-urlencode.js b/packages/transformers/src/dollar-urlencode.js index 5315dfe6..d43c21e2 100644 --- a/packages/transformers/src/dollar-urlencode.js +++ b/packages/transformers/src/dollar-urlencode.js @@ -11,7 +11,7 @@ import dollar from './dollar'; * field = url * ``` * - * @param {String} [field] field path to apply the transformation + * @param {String} field field path to apply the transformation * @returns {Object} */ export default function $URLENCODE(data, feed) { diff --git a/packages/transformers/src/dollar-value.js b/packages/transformers/src/dollar-value.js index d9e3aef4..56c1a778 100644 --- a/packages/transformers/src/dollar-value.js +++ b/packages/transformers/src/dollar-value.js @@ -12,8 +12,8 @@ import dollar from './dollar'; * value = Hello world * ``` * - * @param {String} [field] new field path - * @param {String} [value] value to use to set the field + * @param {String} field new field path + * @param {String} value value to use to set the field * @returns {Object} */ export default function $VALUE(data, feed) {