Skip to content

Commit

Permalink
docs(transformers): Slightly improve JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
parmentf committed Jul 23, 2021
1 parent 7ade53d commit 59bc7f5
Show file tree
Hide file tree
Showing 32 changed files with 342 additions and 177 deletions.
170 changes: 113 additions & 57 deletions docs/plugin-transformers.md

Large diffs are not rendered by default.

170 changes: 113 additions & 57 deletions packages/transformers/README.md

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion packages/transformers/src/dollar-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
35 changes: 34 additions & 1 deletion packages/transformers/src/dollar-boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions packages/transformers/src/dollar-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 5 additions & 4 deletions packages/transformers/src/dollar-concat-uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
*
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions packages/transformers/src/dollar-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
*
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-join.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/src/dollar-lowercase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions packages/transformers/src/dollar-mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
*
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/src/dollar-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions packages/transformers/src/dollar-replace-regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions packages/transformers/src/dollar-replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 4 additions & 5 deletions packages/transformers/src/dollar-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-shift.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions packages/transformers/src/dollar-split.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/src/dollar-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transformers/src/dollar-suffix.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/src/dollar-trim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/src/dollar-truncate-words.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
*
Expand Down
5 changes: 2 additions & 3 deletions packages/transformers/src/dollar-truncate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 59bc7f5

Please sign in to comment.