John Cowen 61d7acd51f
ui: Tweak some code related meta information (#12117)
* ui: Correct some meta info

* Encoder doesn't take an argument whereas decoder does

* Math.trunc looks like the closest to parseInt but using the correct type

*  use a dynamic string when setting things on window
2022-01-21 11:42:48 +00:00

13 lines
423 B
JavaScript

/**
* Turns a separated path or 'key name' in this case to
* an array. If the key name is simply the separator (for example '/')
* then the array should contain a single empty string value
*
* @param {String} key - The separated path/key
* @param {String} separator - The separator
* @returns {String[]}
*/
export default function(key, separator = '/') {
return (key === separator ? '' : key).split(separator);
}