(key, fn)
| 103 | }; |
| 104 | |
| 105 | function fn2method(key, fn) { |
| 106 | if (typeof fn !== 'function') return; |
| 107 | s.prototype[key] = function() { |
| 108 | var args = [this._wrapped].concat(Array.prototype.slice.call(arguments)); |
| 109 | var res = fn.apply(null, args); |
| 110 | // if the result is non-string stop the chain and return the value |
| 111 | return typeof res === 'string' ? new s(res) : res; |
| 112 | }; |
| 113 | } |
| 114 | |
| 115 | // Copy functions to instance methods for chaining |
| 116 | for (var key in s) fn2method(key, s[key]); |
no outgoing calls
no test coverage detected
searching dependent graphs…