awesome-string
Version:
The ultimate JavaScript string library
22 lines (21 loc) • 571 B
JavaScript
import ChainWrapper from 'chain/wrapper';
/**
* Creates a chain object that wraps `subject`, enabling <i>explicit</i> chain sequences. <br/>
* Use `as.prototype.value()` to unwrap the result.
*
* @memberOf Chain
* @since 1.0.0
* @function chain
* @param {string} subject The string to wrap.
* @return {Object} Returns the new wrapper object.
* @example
* v
* .chain('Back to School')
* .lowerCase()
* .words()
* .value()
* // => ['back', 'to', 'school']
*/
export default function chain(subject) {
return new ChainWrapper(subject, true);
}