From e3f85f52f329ae5a9b34740584d5c643b006483a Mon Sep 17 00:00:00 2001 From: Planeshifter Date: Sun, 3 May 2015 01:10:58 -0400 Subject: [PATCH 1/4] [UPDATE] according to todo --- .travis.yml | 11 +++++++++-- LICENSE | 4 ++-- Makefile | 2 -- README.md | 8 +++----- lib/index.js | 34 +++------------------------------- package.json | 12 ++++++++---- 6 files changed, 25 insertions(+), 46 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c16620..29cff27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,12 @@ language: node_js node_js: - - "0.10" + - '0.12' + - '0.11' + - '0.10' + - '0.8' + - 'iojs' +before_install: + - npm update -g npm after_script: - - npm run coveralls \ No newline at end of file + - npm run coveralls + diff --git a/LICENSE b/LICENSE index 2fe3939..d8731b6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Athan Reines. +Copyright (c) 2014-2015 Athan Reines. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/Makefile b/Makefile index d8fb6dd..8f4ec98 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,6 @@ lint-jshint: node_modules ./ - # NODE # # Installing node_modules: @@ -132,7 +131,6 @@ clean-node: # CLEAN # - .PHONY: clean clean: diff --git a/README.md b/README.md index d289d44..34fc0b4 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ For use in the browser, use [browserify](https://github.com/substack/node-browse ## Usage -To use the module, - ``` javascript var incrmstdev = require( 'compute-incrmstdev' ); ``` @@ -121,15 +119,15 @@ $ make view-cov ``` +--- ## License -[MIT license](http://opensource.org/licenses/MIT). +[MIT license](http://opensource.org/licenses/MIT). ---- ## Copyright -Copyright © 2014. Athan Reines. +Copyright © 2014-2015. Athan Reines. [npm-image]: http://img.shields.io/npm/v/compute-incrmstdev.svg diff --git a/lib/index.js b/lib/index.js index f723c8f..cd940b6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,36 +1,8 @@ -/** -* -* COMPUTE: incrmstdev -* -* -* DESCRIPTION: -* - Provides a method to compute a moving sample standard deviation incrementally. -* -* -* NOTES: -* [1] -* -* -* TODO: -* [1] -* -* -* LICENSE: -* MIT -* -* Copyright (c) 2014. Athan Reines. -* -* -* AUTHOR: -* Athan Reines. kgryte@gmail.com. 2014. -* -*/ - 'use strict'; // MODULES // -var isInteger = require( 'validate.io-integer' ); +var isPositiveInteger = require( 'validate.io-positive-integer' ); // INCREMENTAL MOVING SAMPLE STANDARD DEVIATION // @@ -43,8 +15,8 @@ var isInteger = require( 'validate.io-integer' ); * @returns {Function} method to compute a moving sample standard deviation incrementally */ function incrmstdev( W ) { - if ( !isInteger( W ) || W < 1 ) { - throw new TypeError( 'incrmstdev()::invalid input argument. Window size must be a positive integer.' ); + if ( !isPositiveInteger( W ) ) { + throw new TypeError( 'incrmstdev()::invalid input argument. Window size must be a positive integer. Value: `' + W + '`.' ); } var arr = new Array( W ), n = W - 1, diff --git a/package.json b/package.json index e4eaa02..ee573f2 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,10 @@ { "name": "Athan Reines", "email": "kgryte@gmail.com" + }, + { + "name": "Philipp Burckhardt", + "email": "pburckhardt@outlook.com" } ], "scripts": { @@ -44,15 +48,15 @@ "url": "https://github.com/compute-io/incrmstdev/issues" }, "dependencies": { - "validate.io-integer": "^1.0.2" + "validate.io-positive-integer": "^1.0.0" }, "devDependencies": { - "chai": "1.x.x", - "mocha": "1.x.x", + "chai": "2.x.x", "coveralls": "^2.11.1", "istanbul": "^0.3.0", "jshint": "2.x.x", - "jshint-stylish": "^1.0.0" + "jshint-stylish": "^1.0.0", + "mocha": "2.x.x", }, "licenses": [ { From 073cc52553aa2c1ec92b5b0f004b39fba02d25bc Mon Sep 17 00:00:00 2001 From: Planeshifter Date: Sun, 3 May 2015 02:40:54 -0400 Subject: [PATCH 2/4] [FIX] package.json trailing comma --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee573f2..04e7140 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "istanbul": "^0.3.0", "jshint": "2.x.x", "jshint-stylish": "^1.0.0", - "mocha": "2.x.x", + "mocha": "2.x.x" }, "licenses": [ { From 7c34eaaa2f712accb1833a0cac0712de363c6bd6 Mon Sep 17 00:00:00 2001 From: kgryte Date: Mon, 25 May 2015 04:55:31 -0700 Subject: [PATCH 3/4] [UPDATE] license info. Use SPDX license identifier. Makefile. fcn docs. --- LICENSE | 2 +- Makefile | 11 +++++++++-- README.md | 2 +- lib/index.js | 2 +- package.json | 7 +------ test/test.js | 1 + 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/LICENSE b/LICENSE index d8731b6..93cf2ea 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2015 Athan Reines. +Copyright (c) 2014-2015 The Compute.io Authors. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 8f4ec98..3234fbb 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,14 @@ # Set the node.js environment to test: NODE_ENV ?= test +# Kernel name: +KERNEL ?= $(shell uname -s) + +ifeq ($(KERNEL), Darwin) + OPEN ?= open +else + OPEN ?= xdg-open +endif # NOTES # @@ -98,8 +106,7 @@ test-istanbul-mocha: node_modules view-cov: view-istanbul-report view-istanbul-report: - open $(ISTANBUL_HTML_REPORT_PATH) - + $(OPEN) $(ISTANBUL_HTML_REPORT_PATH) # LINT # diff --git a/README.md b/README.md index 34fc0b4..cc07961 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ $ make view-cov ## Copyright -Copyright © 2014-2015. Athan Reines. +Copyright © 2014-2015. The Compute.io Authors. [npm-image]: http://img.shields.io/npm/v/compute-incrmstdev.svg diff --git a/lib/index.js b/lib/index.js index cd940b6..2c95fdf 100644 --- a/lib/index.js +++ b/lib/index.js @@ -33,7 +33,7 @@ function incrmstdev( W ) { * If a `value` is provided, updates and returns the updated sample standard deviation. If no `value` is provided, returns the current sample standard deviation. * * @param {Number} [value] - value used to update the moving sample standard deviation - * @returns {Number} sample standard deviation + * @returns {Number|Null} sample standard deviation or null */ return function incrmstdev( x ) { if ( !arguments.length ) { diff --git a/package.json b/package.json index 04e7140..1fb37ba 100644 --- a/package.json +++ b/package.json @@ -58,10 +58,5 @@ "jshint-stylish": "^1.0.0", "mocha": "2.x.x" }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ] + "license": "MIT" } diff --git a/test/test.js b/test/test.js index 6f51be3..7bc1487 100644 --- a/test/test.js +++ b/test/test.js @@ -29,6 +29,7 @@ describe( 'compute-incrmstdev', function tests() { '5', -5, 0, + Math.PI, true, null, undefined, From 4f45d9b195b91a0959cee131346353e728357285 Mon Sep 17 00:00:00 2001 From: kgryte Date: Mon, 25 May 2015 05:02:31 -0700 Subject: [PATCH 4/4] [TESTS] documentation. --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 7bc1487..3aabf82 100644 --- a/test/test.js +++ b/test/test.js @@ -24,7 +24,7 @@ describe( 'compute-incrmstdev', function tests() { expect( incrmstdev ).to.be.a( 'function' ); }); - it( 'should throw an error if not provided an integer', function test() { + it( 'should throw an error if not provided a positive integer', function test() { var values = [ '5', -5,