Skip to content

Commit

Permalink
fix: 🐛 unable to disable cache from vars env
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed May 12, 2020
1 parent 5dafaad commit 1949927
Show file tree
Hide file tree
Showing 21 changed files with 1,489 additions and 675 deletions.
899 changes: 585 additions & 314 deletions docs/plugin-analytics.md

Large diffs are not rendered by default.

899 changes: 585 additions & 314 deletions packages/analytics/README.md

Large diffs are not rendered by default.

39 changes: 34 additions & 5 deletions packages/analytics/src/count.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import get from 'lodash.get';
import core from './core';
/**
* Take `Object` object getting some fields with json path, and do ...
* Take `Object` and throw special `Object` like `{id, value}` if key(s) was found
* id is the key, value is equal to 1 (if found)
*
* ```json
* [{
* }]
* [
* {
* "a": "nancy",
* "b": "lucy",
* "c": "geny",
* },
* {
* "a": "lorem",
* "b": "loret",
* },
* {
* "a": "fred",
* }
* ]
* ```
*
* Script:
Expand All @@ -15,14 +28,30 @@ import core from './core';
* plugin = analytics
*
* [count]
* path = a
* path = b
* path = c
*
* [aggregate]
* [summing]
*
* ```
*
* Output:
*
* ```json
* [
* ]
* [{
* "id": "a",
* "value": 3
* },
* {
* "id": "b",
* "value": 2
* },
* {
* "id": "c",
* "value": 1
* }]
* ```
*
* @name count
Expand Down
28 changes: 25 additions & 3 deletions packages/analytics/src/distribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ import Store from './store';
* Take `Object` like { id, value } and throw a serie of number value
*
* ```json
* [{
* }]
* [
* { id: 2000, value: 1 },
* { id: 2001, value: 2 },
* { id: 2003, value: 3 },
* { id: 2005, value: 4 },
* { id: 2007, value: 5 },
* { id: 2009, value: 6 },
* { id: 2011, value: 7 },
* { id: 2013, value: 8 },
* ]
* ```
*
* Script:
Expand All @@ -24,13 +32,27 @@ import Store from './store';
*
* ```json
* [
* { "id": 2000, "value": 1 },
* { "id": 2001, "value": 2 },
* { "id": 2002, "value": 0 },
* { "id": 2003, "value": 3 },
* { "id": 2004, "value": 0 },
* { "id": 2005, "value": 4 },
* { "id": 2006, "value": 0 },
* { "id": 2007, "value": 5 },
* { "id": 2008, "value": 0 },
* { "id": 2009, "value": 6 },
* { "id": 2010, "value": 0 },
* { "id": 2011, "value": 7 },
* { "id": 2012, "value": 0 },
* { "id": 2013, "value": 8 }
* ]
* ```
*
* @name distribute
* @param {String} [id="id"] path to use for id
* @param {String} [value="value"] path to use for value
* @param {String} [step=1] step between each valut
* @param {String} [step=1] step between each value
* @param {Number} [start=min value in the stream] first value to throw
* @param {Number} [size=(max value - min value) in the stream] size of the distribution
* @param {Number} [default=0] default value for missing object
Expand Down
26 changes: 22 additions & 4 deletions packages/analytics/src/drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ import get from 'lodash.get';
* Take `Object` and throw the same object only if there the value of the select field is not equals than a value
*
* ```json
* [{
* }]
* [
* {
* "departure": "nancy",
* "arrival": "paris",
* },
* {
* "departure": "nancy",
* "arrival": "toul",
* },
* {
* "departure": "paris",
* "arrival": "londre",
* }
* ]
* ```
*
* Script:
Expand All @@ -21,8 +33,14 @@ import get from 'lodash.get';
* Output:
*
* ```json
* [
* ]
* [{
* "departure": "nancy",
* "arrival": "paris"
* },
* {
* "departure": "nancy",
* "arrival": "toul"
* }]
* ```
*
* @name drop
Expand Down
11 changes: 10 additions & 1 deletion packages/analytics/src/exploding.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import core from './core';
* and throw object of each value. The new object is build with [id] and eac value.
*
* ```json
* [{
* [
* { departure: ['tokyo', 'nancy'], arrival: 'toul' },
* { departure: ['paris', 'nancy'], arrival: 'toul' },
* { departure: ['london', 'berlin'], arrival: 'toul' },
* }]
* ```
*
Expand All @@ -23,6 +26,12 @@ import core from './core';
*
* ```json
* [
* { "id": "toul", "value": "tokyo" },
* { "id": "toul", "value": "nancy" },
* { "id": "toul", "value": "paris" },
* { "id": "toul", "value": "nancy" },
* { "id": "toul", "value": "london" },
* { "id": "toul", "value": "berlin" }
* ]
* ```
*
Expand Down
14 changes: 12 additions & 2 deletions packages/analytics/src/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import get from 'lodash.get';
import core from './core';

/**
* Take `Object` object getting some fields with json path, and do ...
* Take `Object` and throw a new special object (id, value) for each combination of values
*
* ```json
* [{
* [
* { cities: ['berlin', 'nancy', 'toul'] },
* { cities: ['paris', 'nancy', 'toul']},
* { cities: ['paris', 'berlin', 'toul'] },
* }]
* ```
*
Expand All @@ -16,13 +19,20 @@ import core from './core';
* plugin = analytics
*
* [graph]
* path = cities
*
* ```
*
* Output:
*
* ```json
* [
* { "id": [ "berlin", "nancy" ], "value": 1 },
* { "id": [ "berlin", "toul" ], "value": 2 },
* { "id": [ "nancy", "toul" ], "value": 2 },
* { "id": [ "nancy", "paris" ], "value": 1 },
* { "id": [ "paris", "toul" ], "value": 2 },
* { "id": [ "berlin", "paris" ], "value": 1 }
* ]
* ```
*
Expand Down
4 changes: 2 additions & 2 deletions packages/analytics/src/greater.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import get from 'lodash.get';
* field is greater (or equal) than a value
*
* ```json
* [{
* [
* { id: 2000, value: 1 },
* { id: 2001, value: 2 },
* { id: 2003, value: 3 },
Expand All @@ -14,7 +14,7 @@ import get from 'lodash.get';
* { id: 2009, value: 6 },
* { id: 2011, value: 7 },
* { id: 2013, value: 8 },
* }]
* ]
* ```
*
* Script:
Expand Down
21 changes: 19 additions & 2 deletions packages/analytics/src/groupingByEquality.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ const equalTo = (id) => (item) => item.id.some((key) => key === id);
* in a single object
*
* ```json
* [{
* }]
* [
* { "id": "lorem", "value": 1 },
* { "id": "Lorem", "value": 1 },
* { "id": "loren", "value": 1 },
* { "id": "korem", "value": 1 },
* { "id": "olrem", "value": 1 },
* { "id": "toto", "value": 1 },
* { "id": "titi", "value": 1 },
* { "id": "lorem", "value": 1 }
* ]
* ```
*
* Script:
Expand All @@ -20,12 +28,21 @@ const equalTo = (id) => (item) => item.id.some((key) => key === id);
*
* [groupingByEquality]
*
* [summing]
*
* ```
*
* Output:
*
* ```json
* [
* { "id": [ "lorem" ], "value": 2 },
* { "id": [ "Lorem" ], "value": 1 },
* { "id": [ "loren" ], "value": 1 },
* { "id": [ "korem" ], "value": 1 },
* { "id": [ "olrem" ], "value": 1 },
* { "id": [ "toto" ], "value": 1 },
* { "id": [ "titi" ], "value": 1 }
* ]
* ```
*
Expand Down
20 changes: 17 additions & 3 deletions packages/analytics/src/groupingByHamming.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ const equalTo = (id, distance) => (item) => item.id.some((key) => hammingDistanc
* Take `Object` like `{ id, value }` and reduce all `value` with `id` which
* have the same Hamming distance in a single object
*
* ```json
* [{
* }]
* * ```json
* [
* { "id": "lorem", "value": 1 },
* { "id": "Lorem", "value": 1 },
* { "id": "loren", "value": 1 },
* { "id": "korem", "value": 1 },
* { "id": "olrem", "value": 1 },
* { "id": "toto", "value": 1 },
* { "id": "titi", "value": 1 },
* { "id": "lorem", "value": 1 }
* ]
* ```
*
* Script:
Expand All @@ -21,13 +29,19 @@ const equalTo = (id, distance) => (item) => item.id.some((key) => hammingDistanc
* plugin = analytics
*
* [groupingByHamming]
* distance = 1
*
* [summing]
*
* ```
*
* Output:
*
* ```json
* [
* { "id": [ "lorem", "Lorem", "loren", "korem" ], "value": 5 },
* { "id": [ "olrem" ], "value": 1 },
* { "id": [ "toto", "titi" ], "value": 2 }
* ]
* ```
*
Expand Down
19 changes: 16 additions & 3 deletions packages/analytics/src/groupingByLevenshtein.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ const equalTo = (id, distance) => (item) => item.id.some((key) => levenshteinDis
* Take `Object` like `{ id, value }` and reduce all `value`s with
* `id` which have the same Levenshtein distance in a single object
*
* * ```json
* [{
* }]
* ```json
* [
* { "id": "lorem", "value": 1 },
* { "id": "Lorem", "value": 1 },
* { "id": "loren", "value": 1 },
* { "id": "korem", "value": 1 },
* { "id": "olrem", "value": 1 },
* { "id": "toto", "value": 1 },
* { "id": "titi", "value": 1 },
* { "id": "lorem", "value": 1 }
* ]
* ```
*
* Script:
Expand All @@ -21,13 +29,18 @@ const equalTo = (id, distance) => (item) => item.id.some((key) => levenshteinDis
* plugin = analytics
*
* [groupingByLevenshtein]
* distance = 2
*
* [summing]
*
* ```
*
* Output:
*
* ```json
* [
* { "id": [ "lorem", "Lorem", "loren", "korem", "olrem" ], "value": 6 },
* { "id": [ "toto", "titi" ], "value": 2 }
* ]
* ```
*
Expand Down
26 changes: 24 additions & 2 deletions packages/analytics/src/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ import core from './core';
* Take `Object` and throws all its keys
*
* ```json
* [{
* }]
* [
* { city: 'tokyo', year: 2000, count: 1 },
* { city: 'paris', year: 2001, count: 2 },
* { city: 'london', year: 2003, count: 3 },
* { city: 'nancy', year: 2005, count: 4 },
* { city: 'berlin', year: 2007, count: 5 },
* { city: 'madrid', year: 2009, count: 6 },
* { city: 'stockholm', year: 2011, count: 7 },
* { city: 'bruxelles', year: 2013, count: 8 },
* ]
* ```
*
* Script:
Expand All @@ -14,13 +22,27 @@ import core from './core';
* plugin = analytics
*
* [keys]
* [aggregate]
* [summing]
*
* ```
*
* Output:
*
* ```json
* [
* {
* "id": "city",
* "value": 8
* },
* {
* "id": "year",
* "value": 8
* },
* {
* "id": "count",
* "value": 8
* }⏎
* ]
* ```
*
Expand Down
Loading

0 comments on commit 1949927

Please sign in to comment.