-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (32 loc) · 956 Bytes
/
index.js
File metadata and controls
35 lines (32 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import chain from './chain/chain'; // include chain here to resolve af circular reference
import ChainWrapper from './chain/wrapper';
import functions from './functions';
/**
* Creates a chain object that wraps `subject`, enabling <i>implicit</i> chain sequences.<br/>
* A function that returns `number`, `boolean` or `array` type <i>terminates</i> the chain sequence and returns the unwrapped value.
* Otherwise use `v.prototype.value()` to unwrap the result.
*
* @memberOf Chain
* @since 1.0.0
* @function v
* @param {string} subject The string to wrap.
* @return {Object} Returns the new wrapper object.
* @example
* v('Back to School')
* .lowerCase()
* .words()
* // => ['back', 'to', 'school']
*
* v(" Back to School ")
* .trim()
* .truncate(7)
* .value()
* // => 'Back...'
*/
function Voca(subject) {
return new ChainWrapper(subject, false);
}
Object.assign(Voca, functions, {
chain: chain,
});
export default Voca;