Permalink
Browse files

Remove unused ol.array.flatten function

  • Loading branch information...
1 parent ed79048 commit d8c5e81675f5c0c65075b47c82205c4b176ae289 @fredj fredj committed Jan 12, 2017
Showing with 0 additions and 26 deletions.
  1. +0 −16 src/ol/array.js
  2. +0 −10 test/spec/ol/array.test.js
View
@@ -125,22 +125,6 @@ ol.array.reverseSubArray = function(arr, begin, end) {
/**
- * @param {Array.<*>} arr Array.
- * @return {!Array.<?>} Flattened Array.
- */
-ol.array.flatten = function(arr) {
- var data = arr.reduce(function(flattened, value) {
- if (Array.isArray(value)) {
- return flattened.concat(ol.array.flatten(value));
- } else {
- return flattened.concat(value);
- }
- }, []);
- return data;
-};
-
-
-/**
* @param {Array.<VALUE>} arr The array to modify.
* @param {Array.<VALUE>|VALUE} data The elements or arrays of elements
* to add to arr.
@@ -427,16 +427,6 @@ describe('ol.array', function() {
});
});
- describe('flatten', function() {
- it('flattens different kinds of nested arrays', function() {
- expect(ol.array.flatten([1, 2])).to.eql([1, 2]);
- expect(ol.array.flatten([1, [2, [3, [4, 5]]]])).to.eql([1, 2, 3, 4, 5]);
- expect(ol.array.flatten([[[[1], 2], 3], 4])).to.eql([1, 2, 3, 4]);
- expect(ol.array.flatten([[1]])).to.eql([1]);
- expect(ol.array.flatten([])).to.eql([]);
- });
- });
-
describe('isSorted', function() {
it('works with just an array as argument', function() {
expect(ol.array.isSorted([1, 2, 3])).to.be(true);

0 comments on commit d8c5e81

Please sign in to comment.