UNPKG

@wordpress/core-data

Version:
19 lines 599 B
/** * Given a value which can be specified as one or the other of a comma-separated * string or an array, returns a value normalized to an array of strings, or * null if the value cannot be interpreted as either. * * @param {string|string[]|*} value * * @return {?(string[])} Normalized field value. */ function getNormalizedCommaSeparable(value) { if (typeof value === 'string') { return value.split(','); } else if (Array.isArray(value)) { return value; } return null; } export default getNormalizedCommaSeparable; //# sourceMappingURL=get-normalized-comma-separable.js.map