Skip to content

Commit

Permalink
Update index.js (#142)
Browse files Browse the repository at this point in the history
* Update index.js

* lint
 🐿 v2.5.16
  • Loading branch information
wheresrhys authored Nov 17, 2017
1 parent 51e4bca commit 44b5dcb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ A number of additional methods can be used to aggregate, reduce, or otherwise ma

**Note on specifying dimensions:**
Some methods expect a dimension to be specified e.g to choose between taking an average across rows or columns. The value of dimension can be
- `timeframe` or the name of a property that has been grouped by
- a positive integer (0 indexed) to refer dirctly to a given dimension e.g in a table plotting count against time, a value of `1` would pick out the time dimension. Dimensions are added in the same order the methods creating them are called so e.g. `->interval(d)->group(uuid)` would have `timeframe` as the 0th dimension, `uuid` as the 1st;
- `timeframe` or the name of a property that has been grouped by
- a positive integer (0 indexed) to refer dirctly to a given dimension e.g in a table plotting count against time, a value of `1` would pick out the time dimension. Dimensions are added in the same order the methods creating them are called so e.g. `->interval(d)->group(uuid)` would have `timeframe` as the 0th dimension, `uuid` as the 1st;

#### Aggregators

Expand Down Expand Up @@ -211,21 +211,19 @@ There are a few built in methods for outputting data

```
{
headings: ['array', 'of', 'column', 'headings',
rows: [[], [], []] // rows of data, including row headings in the first position of each sub array
headings: ['array', 'of', 'column', 'headings',
rows: [[], [], []] // rows of data, including row headings in the first position of each sub array
}
```
- `cellIterator (func, endDepth)` - Iterates a function over each cell in the table *TODO - known bug. need to change to being immutable*
- `switchDimensions (a, b, method)` - switches two dimensions e.g. swaps rows for columns
- a - index/name of the first dimension to move (default 0)
- b - index/name of the second dimension to move (default: the deepest dimension of the table)
- method - when a or b are their default values, setting method to `shuffle` will move the dimension to be the first/last, and shuffle all other dimesnions along to make room, as opposed to swapping the a/bth dimension with the first/last
- a - index/name of the first dimension to move (default 0)
- b - index/name of the second dimension to move (default: the deepest dimension of the table)
- method - when a or b are their default values, setting method to `shuffle` will move the dimension to be the first/last, and shuffle all other dimesnions along to make room, as opposed to swapping the a/bth dimension with the first/last


the Keen data with all aggregations, reductions etc. already applied.



### Utilities

- KeenQuery.parseFilter(str) - converts a string compatible with the above syntax into a Keen filter object
Expand Down
6 changes: 6 additions & 0 deletions lib/keen-query/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class KeenQuery {
}
}

if (this.excludeNulls) {
str += '->tidy()';
} else if (this.excludeFalsy) {
str += '->tidy(true)';
}

str += this.stringifyPostProcessors();

if (this._printer) {
Expand Down
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"commit": "commit-wizard"
"commit": "commit-wizard",
"precommit": "node_modules/.bin/secret-squirrel",
"commitmsg": "node_modules/.bin/secret-squirrel-commitmsg",
"prepush": "make verify -j3"
},
"repository": {
"type": "git",
Expand All @@ -39,11 +42,5 @@
"npm-prepublish": "^1.2.1",
"sinon": "^1.17.3"
},
"config": {
"pre-git": {
"pre-commit": [
"node_modules/.bin/secret-squirrel"
]
}
}
"config": {}
}

0 comments on commit 44b5dcb

Please sign in to comment.