Skip to content

Commit

Permalink
Add min function to go with max
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashid Khan committed Jan 22, 2016
1 parent 48eb7eb commit fa9d44e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "timelion",
"version": "0.1.201",
"version": "0.1.204",
"dependencies": {
"body-parser": "^1.12.0",
"boom": "^2.8.0",
Expand Down
24 changes: 24 additions & 0 deletions series_functions/min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var reduce = require('../lib/reduce.js');

var Chainable = require('../lib/classes/chainable');
module.exports = new Chainable('max', {
args: [
{
name: 'inputSeries',
types: ['seriesList']
},
{
name: 'value',
types: ['seriesList', 'number'],
help: 'Number, series to min with the input series. If passing a seriesList it must contain exactly 1 series.'

}

],
help: 'Minimum values of one or more series in a seriesList to each position, in each series, of the input seriesList',
fn: function minFn(args) {
return reduce(args, function (a, b) {
return Math.min(a, b);
});
}
});

0 comments on commit fa9d44e

Please sign in to comment.