Skip to content

Commit 0c7b2f8

Browse files
committed
rename Lib.fillUnique -> Lib.pushUnique
1 parent 9837d8b commit 0c7b2f8

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) {
336336
};
337337

338338
/**
339-
* Fill with unique items
339+
* Push array with unique items
340340
*
341341
* @param {array} array
342342
* array to be filled
@@ -346,7 +346,7 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) {
346346
* ref to array (now possibly containing one more item)
347347
*
348348
*/
349-
lib.fillUnique = function(array, item) {
349+
lib.pushUnique = function(array, item) {
350350
if(item && array.indexOf(item) === -1) array.push(item);
351351

352352
return array;

src/plots/cartesian/layout_defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
9595
// make sure that plots with orphan cartesian axes
9696
// are considered 'cartesian'
9797
if(xaListCartesian.length && yaListCartesian.length) {
98-
Lib.fillUnique(layoutOut._basePlotModules, Plots.subplotsRegistry.cartesian);
98+
Lib.pushUnique(layoutOut._basePlotModules, Plots.subplotsRegistry.cartesian);
9999
}
100100

101101
function axSort(a, b) {

src/plots/plots.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ plots.supplyDefaults = function(gd) {
485485
if(!_module) continue;
486486

487487
// fill in module lists
488-
Lib.fillUnique(modules, _module);
489-
Lib.fillUnique(basePlotModules, fullTrace._module.basePlotModule);
488+
Lib.pushUnique(modules, _module);
489+
Lib.pushUnique(basePlotModules, fullTrace._module.basePlotModule);
490490
}
491491

492492
// attach helper method to check whether a plot type is present on graph

test/jasmine/tests/lib_test.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -857,42 +857,42 @@ describe('Test lib.js:', function() {
857857
});
858858
});
859859

860-
describe('fillUnique', function() {
860+
describe('pushUnique', function() {
861861

862862
beforeEach(function() {
863863
this.obj = { a: 'A' };
864864
this.array = ['a', 'b', 'c', this.obj];
865865
});
866866

867867
it('should fill new items in array', function() {
868-
var out = Lib.fillUnique(this.array, 'd');
868+
var out = Lib.pushUnique(this.array, 'd');
869869

870870
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }, 'd']);
871871
expect(this.array).toBe(out);
872872
});
873873

874874
it('should ignore falsy items', function() {
875-
Lib.fillUnique(this.array, false);
875+
Lib.pushUnique(this.array, false);
876876
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }]);
877877

878-
Lib.fillUnique(this.array, undefined);
878+
Lib.pushUnique(this.array, undefined);
879879
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }]);
880880

881-
Lib.fillUnique(this.array, 0);
881+
Lib.pushUnique(this.array, 0);
882882
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }]);
883883

884-
Lib.fillUnique(this.array, null);
884+
Lib.pushUnique(this.array, null);
885885
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }]);
886886

887-
Lib.fillUnique(this.array, '');
887+
Lib.pushUnique(this.array, '');
888888
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }]);
889889
});
890890

891891
it('should ignore item already in array', function() {
892-
Lib.fillUnique(this.array, 'a');
892+
Lib.pushUnique(this.array, 'a');
893893
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }]);
894894

895-
Lib.fillUnique(this.array, this.obj);
895+
Lib.pushUnique(this.array, this.obj);
896896
expect(this.array).toEqual(['a', 'b', 'c', { a: 'A' }]);
897897

898898
});

0 commit comments

Comments
 (0)