All files / packages/tao-router/src routeTag.js

0% Statements 0/7
100% Branches 0/0
0% Functions 0/3
0% Lines 0/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14                           
import get from 'get-value';
 
export function routeTag(strings, ...keys) {
  return (...values) => {
    const vals = values[0];
    const route = [strings[0]];
    keys.forEach((key, i) => {
      const data = get(vals, key, { default: '' });
      route.push(data, strings[i + 1]);
    });
    return route.join('');
  };
}