(fn)
| 5 | */ |
| 6 | |
| 7 | export function cached(fn) { |
| 8 | const cache = Object.create(null); |
| 9 | return function (str) { |
| 10 | const key = isPrimitive(str) ? str : JSON.stringify(str); |
| 11 | const hit = cache[key]; |
| 12 | return hit || (cache[key] = fn(str)); |
| 13 | }; |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Hyphenate a camelCase string. |
no test coverage detected
searching dependent graphs…