Skip to content

Commit

Permalink
docs (analytics): fix indents and bad html tag
Browse files Browse the repository at this point in the history
  • Loading branch information
AlasDiablo committed Feb 12, 2024
1 parent c1278c3 commit fb7287c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
13 changes: 6 additions & 7 deletions docs/plugin-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1695,13 +1695,12 @@ plugin = analytics
- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** <ul><li>path of the element used to create the unified identifier</li></ul>
<ul><li>chemin de l'élément utilisé pour créer l'identifiant unifié</li></ul> (optional, default `id`)
- `method` **(`"natural"` \| `"levenshtein"` \| `"numerical"`)** <ul><li>method used to create the unified identifier</li></ul>
<ul><ul><li>natural - Create a normalised identifier that is set to a fixed length</li></ul></ul>
<ul><ul><li>levenshtein - Create an identifier based on the Levenshtein algorithm</li></ul></ul>
ul><ul><li>numerical - Create an identifier based on a numeric value</li></ul></ul>
<ul><li>méthode utilisée pour créer l'identifiant unifié</li></ul>
<ul><ul><li>natural - Crée un identifiant normalisé de longueur fixe</li></ul></ul>
<ul><ul><li>levenshtein - Crée un identifiant basé sur l'algorithme de Levenshtein</li></ul></ul>
<ul><ul><li>numerical - Crée un identifiant basé sur une valeur numérique</li></ul></ul> (optional, default `natural`)
<ul><ul><li>natural - Create a normalised identifier that is set to a fixed length</li></ul></ul>
<ul><ul><li>levenshtein - Create an identifier based on the Levenshtein algorithm</li></ul></ul>
<ul><ul><li>numerical - Create an identifier based on a numeric value</li></ul></ul><ul><li>méthode utilisée pour créer l'identifiant unifié</li></ul>
<ul><ul><li>natural - Crée un identifiant normalisé de longueur fixe</li></ul></ul>
<ul><ul><li>levenshtein - Crée un identifiant basé sur l'algorithme de Levenshtein</li></ul></ul>
<ul><ul><li>numerical - Crée un identifiant basé sur une valeur numérique</li></ul></ul> (optional, default `natural`)

Returns **{id: [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), value: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}**

Expand Down
13 changes: 6 additions & 7 deletions packages/analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1695,13 +1695,12 @@ plugin = analytics
- `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** <ul><li>path of the element used to create the unified identifier</li></ul>
<ul><li>chemin de l'élément utilisé pour créer l'identifiant unifié</li></ul> (optional, default `id`)
- `method` **(`"natural"` \| `"levenshtein"` \| `"numerical"`)** <ul><li>method used to create the unified identifier</li></ul>
<ul><ul><li>natural - Create a normalised identifier that is set to a fixed length</li></ul></ul>
<ul><ul><li>levenshtein - Create an identifier based on the Levenshtein algorithm</li></ul></ul>
ul><ul><li>numerical - Create an identifier based on a numeric value</li></ul></ul>
<ul><li>méthode utilisée pour créer l'identifiant unifié</li></ul>
<ul><ul><li>natural - Crée un identifiant normalisé de longueur fixe</li></ul></ul>
<ul><ul><li>levenshtein - Crée un identifiant basé sur l'algorithme de Levenshtein</li></ul></ul>
<ul><ul><li>numerical - Crée un identifiant basé sur une valeur numérique</li></ul></ul> (optional, default `natural`)
<ul><ul><li>natural - Create a normalised identifier that is set to a fixed length</li></ul></ul>
<ul><ul><li>levenshtein - Create an identifier based on the Levenshtein algorithm</li></ul></ul>
<ul><ul><li>numerical - Create an identifier based on a numeric value</li></ul></ul><ul><li>méthode utilisée pour créer l'identifiant unifié</li></ul>
<ul><ul><li>natural - Crée un identifiant normalisé de longueur fixe</li></ul></ul>
<ul><ul><li>levenshtein - Crée un identifiant basé sur l'algorithme de Levenshtein</li></ul></ul>
<ul><ul><li>numerical - Crée un identifiant basé sur une valeur numérique</li></ul></ul> (optional, default `natural`)

Returns **{id: [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), value: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}**

Expand Down
27 changes: 18 additions & 9 deletions packages/analytics/src/tune.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ import core from './core';
*/
export const normalize = (s) => {
if (typeof s === 'string') {
return String(s).normalize('NFD').replace(/[\u0300-\u036f]/g, '').padEnd(40, '~');
return String(s)
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.padEnd(40, '~');
}
if (typeof s === 'number') {
return s.toFixed(20).toString().padStart(40, '0');
return s.toFixed(20)
.toString()
.padStart(40, '0');
}
return String(s);
};
Expand All @@ -37,7 +42,8 @@ const methods = {
levenshtein,
numerical,
};
const allMethods = Object.keys(methods).join(',');
const allMethods = Object.keys(methods)
.join(',');

/**
* Tune function see documentation at the end.
Expand Down Expand Up @@ -150,15 +156,18 @@ const tune = (data, feed, ctx) => {
* @param {String} [path=id]
* <ul><li>path of the element used to create the unified identifier</li></ul>
* <ul><li>chemin de l'élément utilisé pour créer l'identifiant unifié</li></ul>
*
* @param {'natural' | 'levenshtein' | 'numerical'} [method=natural]
* <ul><li>method used to create the unified identifier</li></ul>
* <ul><ul><li>natural - Create a normalised identifier that is set to a fixed length</li></ul></ul>
* <ul><ul><li>levenshtein - Create an identifier based on the Levenshtein algorithm</li></ul></ul>
* ul><ul><li>numerical - Create an identifier based on a numeric value</li></ul></ul>
* <ul><ul><li>natural - Create a normalised identifier that is set to a fixed length</li></ul></ul>
* <ul><ul><li>levenshtein - Create an identifier based on the Levenshtein algorithm</li></ul></ul>
* <ul><ul><li>numerical - Create an identifier based on a numeric value</li></ul></ul>
*
* <ul><li>méthode utilisée pour créer l'identifiant unifié</li></ul>
* <ul><ul><li>natural - Crée un identifiant normalisé de longueur fixe</li></ul></ul>
* <ul><ul><li>levenshtein - Crée un identifiant basé sur l'algorithme de Levenshtein</li></ul></ul>
* <ul><ul><li>numerical - Crée un identifiant basé sur une valeur numérique</li></ul></ul>
* <ul><ul><li>natural - Crée un identifiant normalisé de longueur fixe</li></ul></ul>
* <ul><ul><li>levenshtein - Crée un identifiant basé sur l'algorithme de Levenshtein</li></ul></ul>
* <ul><ul><li>numerical - Crée un identifiant basé sur une valeur numérique</li></ul></ul>
*
* @returns {{
* id: String,
* value: Object
Expand Down

0 comments on commit fb7287c

Please sign in to comment.