UNPKG

react-native-reanimated

Version:

More powerful alternative to Animated library for React Native.

36 lines (29 loc) 1.07 kB
'use strict'; export const isDefined = value => value !== undefined && value !== null; export const isAngle = value => { 'worklet'; return typeof value === 'string' && /^-?\d+(\.\d+)?(deg|rad)$/.test(value); }; export const isNumber = value => { 'worklet'; return typeof value === 'number' && !isNaN(value); }; export const isNumberArray = value => { 'worklet'; return Array.isArray(value) && value.every(isNumber); }; export const isLength = value => { 'worklet'; return value.endsWith('px') || !isNaN(Number(value)); }; export const isPercentage = value => { 'worklet'; return typeof value === 'string' && /^-?\d+(\.\d+)?%$/.test(value); }; export const isRecord = value => { 'worklet'; return typeof value === 'object' && value !== null && !Array.isArray(value); }; export const isConfigPropertyAlias = value => !!value && typeof value === 'object' && 'as' in value && typeof value.as === 'string'; export const hasValueProcessor = configValue => isRecord(configValue) && 'process' in configValue; //# sourceMappingURL=guards.js.map