* Memoizes the return value of a function that accepts one string argument.
(callback)
| 12582 | */ |
| 12583 | |
| 12584 | function memoizeStringOnly(callback) { |
| 12585 | var cache = {}; |
| 12586 | return function (string) { |
| 12587 | if (!cache.hasOwnProperty(string)) { |
| 12588 | cache[string] = callback.call(this, string); |
| 12589 | } |
| 12590 | return cache[string]; |
| 12591 | }; |
| 12592 | } |
| 12593 | |
| 12594 | module.exports = memoizeStringOnly; |
| 12595 |