@wordpress/core-data
Version:
Access to and manipulation of core WordPress entities.
25 lines (24 loc) • 723 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* 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;
}
var _default = exports.default = getNormalizedCommaSeparable;
//# sourceMappingURL=get-normalized-comma-separable.js.map
;