github.com/outbrain/consul@v1.4.5/ui-v2/app/utils/keyToArray.js (about) 1 /** 2 * Turns a separated path or 'key name' in this case to 3 * an array. If the key name is simply the separator (for example '/') 4 * then the array should contain a single empty string value 5 * 6 * @param {string} key - The separated path/key 7 * @param {string} [separator=/] - The separator 8 * @returns {string[]} 9 */ 10 export default function(key, separator = '/') { 11 return (key === separator ? '' : key).split(separator); 12 }