| Current Path : /home/emeraadmin/public_html/4d695/ |
| Current File : /home/emeraadmin/public_html/4d695/utils.tar |
isValidType.d.ts 0000644 00000000123 15170136313 0007567 0 ustar 00 export declare function isValidType(type: unknown, allowArray?: boolean): boolean;
cloneWithRef.d.ts 0000644 00000000172 15170136313 0007727 0 ustar 00 /// <reference types="react" />
export declare function cloneWithRef(element: any, newRef: any): React.ReactElement<any>;
js_utils.d.ts 0000644 00000000243 15170136313 0007171 0 ustar 00 export declare function isFunction(input: unknown): boolean;
export declare function noop(): void;
export declare function isPlainObject(input: unknown): boolean;
isRef.d.ts 0000644 00000000142 15170136313 0006403 0 ustar 00 export interface Ref<T> {
current: T;
}
export declare function isRef(obj: unknown): boolean;
isRef.js 0000644 00000000330 15170136313 0006146 0 ustar 00 export function isRef(obj) {
return (
// eslint-disable-next-line no-prototype-builtins
obj !== null &&
typeof obj === 'object' &&
Object.prototype.hasOwnProperty.call(obj, 'current'));
}
cloneWithRef.js 0000644 00000001763 15170136313 0007502 0 ustar 00 import { cloneElement } from 'react';
import { invariant } from '@react-dnd/invariant';
function setRef(ref, node) {
if (typeof ref === 'function') {
ref(node);
}
else {
ref.current = node;
}
}
export function cloneWithRef(element, newRef) {
const previousRef = element.ref;
invariant(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' +
'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' +
'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');
if (!previousRef) {
// When there is no ref on the element, use the new ref directly
return cloneElement(element, {
ref: newRef,
});
}
else {
return cloneElement(element, {
ref: (node) => {
setRef(previousRef, node);
setRef(newRef, node);
},
});
}
}
js_utils.js 0000644 00000001116 15170136313 0006735 0 ustar 00 // cheap lodash replacements
export function isFunction(input) {
return typeof input === 'function';
}
export function noop() {
// noop
}
function isObjectLike(input) {
return typeof input === 'object' && input !== null;
}
export function isPlainObject(input) {
if (!isObjectLike(input)) {
return false;
}
if (Object.getPrototypeOf(input) === null) {
return true;
}
let proto = input;
while (Object.getPrototypeOf(proto) !== null) {
proto = Object.getPrototypeOf(proto);
}
return Object.getPrototypeOf(input) === proto;
}
isValidType.js 0000644 00000000362 15170136313 0007340 0 ustar 00 export function isValidType(type, allowArray) {
return (typeof type === 'string' ||
typeof type === 'symbol' ||
(!!allowArray &&
Array.isArray(type) &&
type.every((t) => isValidType(t, false))));
}
symbol-observable.js 0000644 00000000230 15170142541 0010524 0 ustar 00 // Inlined version of the `symbol-observable` polyfill
export default (() =>
(typeof Symbol === 'function' && Symbol.observable) || '@@observable')()
isPlainObject.js 0000644 00000000610 15170142541 0007625 0 ustar 00 /**
* @param {any} obj The object to inspect.
* @returns {boolean} True if the argument appears to be a plain object.
*/
export default function isPlainObject(obj) {
if (typeof obj !== 'object' || obj === null) return false
let proto = obj
while (Object.getPrototypeOf(proto) !== null) {
proto = Object.getPrototypeOf(proto)
}
return Object.getPrototypeOf(obj) === proto
}
warning.js 0000644 00000001133 15170142541 0006545 0 ustar 00 /**
* Prints a warning in the console if it exists.
*
* @param {String} message The warning message.
* @returns {void}
*/
export default function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message)
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error(message)
} catch (e) {} // eslint-disable-line no-empty
}
actionTypes.js 0000644 00000001071 15170142541 0007403 0 ustar 00 /**
* These are private action types reserved by Redux.
* For any unknown actions, you must return the current state.
* If the current state is undefined, you must return the initial state.
* Do not reference these action types directly in your code.
*/
const randomString = () =>
Math.random().toString(36).substring(7).split('').join('.')
const ActionTypes = {
INIT: `@@redux/INIT${randomString()}`,
REPLACE: `@@redux/REPLACE${randomString()}`,
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`,
}
export default ActionTypes
kindOf.js 0000644 00000002712 15170142541 0006316 0 ustar 00 // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
function miniKindOf(val) {
if (val === void 0) return 'undefined'
if (val === null) return 'null'
const type = typeof val
switch (type) {
case 'boolean':
case 'string':
case 'number':
case 'symbol':
case 'function': {
return type
}
default:
break
}
if (Array.isArray(val)) return 'array'
if (isDate(val)) return 'date'
if (isError(val)) return 'error'
const constructorName = ctorName(val)
switch (constructorName) {
case 'Symbol':
case 'Promise':
case 'WeakMap':
case 'WeakSet':
case 'Map':
case 'Set':
return constructorName
default:
break
}
// other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '')
}
function ctorName(val) {
return typeof val.constructor === 'function' ? val.constructor.name : null
}
function isError(val) {
return (
val instanceof Error ||
(typeof val.message === 'string' &&
val.constructor &&
typeof val.constructor.stackTraceLimit === 'number')
)
}
function isDate(val) {
if (val instanceof Date) return true
return (
typeof val.toDateString === 'function' &&
typeof val.getDate === 'function' &&
typeof val.setDate === 'function'
)
}
export function kindOf(val) {
let typeOfVal = typeof val
if (process.env.NODE_ENV !== 'production') {
typeOfVal = miniKindOf(val)
}
return typeOfVal
}
formatProdErrorMessage.js 0000644 00000001046 15170142541 0011537 0 ustar 00 /**
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
*
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
* during build.
* @param {number} code
*/
function formatProdErrorMessage(code) {
return (
`Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or ` +
'use the non-minified dev environment for full errors. '
)
}
export default formatProdErrorMessage