UNPKG

@voiceflow/common

Version:

Junk drawer of utility functions

6 lines (5 loc) 370 B
import numberToWords from 'number-to-words/src/index.js'; export const NON_ALPHANUMERIC_REGEXP = /\W/g; export const convertToWord = (value) => numberToWords.toWords(value).replace(NON_ALPHANUMERIC_REGEXP, ' '); export const isInRange = (target, min, max) => target >= min && target <= max; export const clamp = (value, min, max) => Math.max(Math.min(value, max), min);