Initial commit
This commit is contained in:
25
node_modules/react-draggable/lib/utils/shims.js
generated
vendored
Normal file
25
node_modules/react-draggable/lib/utils/shims.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// @flow
|
||||
// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
|
||||
export function findInArray(array: Array<any> | TouchList, callback: Function): any {
|
||||
for (let i = 0, length = array.length; i < length; i++) {
|
||||
if (callback.apply(callback, [array[i], i, array])) return array[i];
|
||||
}
|
||||
}
|
||||
|
||||
export function isFunction(func: any): boolean {
|
||||
return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
|
||||
}
|
||||
|
||||
export function isNum(num: any): boolean {
|
||||
return typeof num === 'number' && !isNaN(num);
|
||||
}
|
||||
|
||||
export function int(a: string): number {
|
||||
return parseInt(a, 10);
|
||||
}
|
||||
|
||||
export function dontSetMe(props: Object, propName: string, componentName: string) {
|
||||
if (props[propName]) {
|
||||
return new Error(`Invalid prop ${propName} passed to ${componentName} - do not set this, set it on the child.`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user