@wordpress/core-data
Version:
Access to and manipulation of core WordPress entities.
19 lines • 599 B
JavaScript
/**
* 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