UNPKG

map-transform

Version:

Map and transform objects with mapping definitions

5 lines 394 B
import { isNonvalue } from '../utils/stateHelpers.js'; export const ensureArray = (value, nonvalues) => Array.isArray(value) ? value : isNonvalue(value, nonvalues) ? [] : [value]; export const cloneAsArray = (value) => ensureArray(value).slice(); export const indexOfIfArray = (arr, index) => Array.isArray(arr) && typeof index === 'number' ? arr[index] : arr; //# sourceMappingURL=array.js.map