* Create a cached version of a pure function.
(fn)
| 81 | * Create a cached version of a pure function. |
| 82 | */ |
| 83 | function cached (fn) { |
| 84 | var cache = Object.create(null); |
| 85 | return (function cachedFn (str) { |
| 86 | var hit = cache[str]; |
| 87 | return hit || (cache[str] = fn(str)) |
| 88 | }) |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Camelize a hyphen-delimited string. |
no test coverage detected