Skip to content

Commit a7c7027

Browse files
committed
Rename uniq to distinct.
1 parent f1faa36 commit a7c7027

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ node_modules
44
.idea
55
datalib.js
66
datalib.min.js
7-
datalib.min.js.map
7+
datalib.min.js.map
8+
index.html

src/util/stats.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ stats.unique = function(data, f, results) {
1515
return results;
1616
};
1717

18-
stats.uniq = function(data, f) {
18+
stats.distinct = function(data, f) {
1919
if (!util.isArray(data) || data.length===0) return 0;
2020
f = f || util.identity;
2121
var u = {}, v, i, count = 0;;

test/stats.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ describe('stats', function() {
3333
});
3434
});
3535

36-
describe('uniq', function() {
37-
it('should count unique values', function() {
38-
assert.equal(stats.uniq([3, 1, 2]), 3);
39-
assert.equal(stats.uniq([1, 1, 2, 1, 2, 3, 1, 2, 3, 3, 3]), 3);
36+
describe('distinct', function() {
37+
it('should count distinct values', function() {
38+
assert.equal(stats.distinct([3, 1, 2]), 3);
39+
assert.equal(stats.distinct([1, 1, 2, 1, 2, 3, 1, 2, 3, 3, 3]), 3);
4040
});
4141

4242
it('should recognize null values', function() {
43-
assert.equal(stats.uniq([null, 1, 2]), 3);
43+
assert.equal(stats.distinct([null, 1, 2]), 3);
4444
});
4545

4646
it('should recognize undefined values', function() {
47-
assert.equal(stats.uniq([1, undefined, 2, undefined]), 3);
47+
assert.equal(stats.distinct([1, undefined, 2, undefined]), 3);
4848
});
4949
});
5050

0 commit comments

Comments
 (0)