Skip to content

Commit

Permalink
[UPDATE] license info. Use SPDX license identifier. Remove unneeded v…
Browse files Browse the repository at this point in the history
…ariable.
  • Loading branch information
kgryte committed May 25, 2015
1 parent a95ebb5 commit 143251e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 #

Expand Down Expand Up @@ -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 #
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ $ node ./examples/index.js





## Tests

### Unit
Expand Down Expand Up @@ -130,7 +128,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-incrmmean.svg
Expand Down
11 changes: 4 additions & 7 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ function incrmmean( W ) {
mu = 0,
N = 0,
i = -1,
delta,
tmp;
delta;
/**
* FUNCTION: incrmmean( [value] )
* If a `value` is provided, updates and returns the updated mean. If no `value` is provided, returns the current mean.
*
* @param {Number} [value] - value used to update the moving mean
* @returns {Number} mean
* @returns {Number|Null} mean or null
*/
return function incrmmean( x ) {
if ( !arguments.length ) {
Expand All @@ -43,16 +42,14 @@ function incrmmean( W ) {

// Fill up the initial window; else, update the existing window...
if ( N < W ) {
arr[ i ] = x;
N += 1;
delta = x - mu;
mu += delta / N;
} else {
tmp = arr[ i ];
arr[ i ] = x;
delta = x - tmp;
delta = x - arr[ i ];
mu += delta / W;
}
arr[ i ] = x;
return mu;
};
} // end FUNCTION incrmmean()
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
"arithmetic mean",
"moving mean",
"moving average",
"sliding window"
"sliding window",
"arithmetic",
"sliding",
"window",
"moving"
],
"bugs": {
"url": "https://github.com/compute-io/incrmmean/issues"
Expand All @@ -56,10 +60,5 @@
"jshint": "2.x.x",
"jshint-stylish": "^1.0.0"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
]
"license": "MIT"
}
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe( 'compute-incrmmean', function tests() {
'5',
-5,
0,
Math.PI,
true,
null,
undefined,
Expand Down

0 comments on commit 143251e

Please sign in to comment.