Begin d3 v4 update

This commit is contained in:
Tom MacWright
2016-08-12 10:29:00 -04:00
parent 36a90b4f86
commit cdb533fa84
137 changed files with 842 additions and 6691 deletions
+15
View File
@@ -1,3 +1,5 @@
import { functor } from '../index';
import * as d3 from 'd3';
import { t } from './locale';
import { Detect } from './detect';
import { remove as removeDiacritics } from 'diacritics';
@@ -193,3 +195,16 @@ export function wrap(index, length) {
index += Math.ceil(-index/length)*length;
return index % length;
}
/**
* a replacement for functor
*
* @param {*} value any value
* @returns {Function} a function that returns that value or the value if it's a function
*/
export function functor(value) {
if (typeof value === 'function') return value;
return function() {
return value;
};
}