mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-02 13:11:41 +02:00
Begin d3 v4 update
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user