envoc-form
Version:
Envoc form components
19 lines (16 loc) • 739 B
text/typescript
export const isUndefined = (value: any) => value === undefined;
export const isNull = (value: any) => value === null;
export const isBoolean = (value: any) => typeof value === 'boolean';
export const isObject = (value: any) => value === Object(value);
export const isArray = (value: any) => Array.isArray(value);
export const isDate = (value: any) => value instanceof Date;
export const isBlob = (value: any) =>
value &&
typeof value.size === 'number' &&
typeof value.type === 'string' &&
typeof value.slice === 'function';
export const isFile = (value: any) =>
isBlob(value) &&
typeof value.name === 'string' &&
(typeof value.lastModifiedDate === 'object' ||
typeof value.lastModified === 'number');