repl.txt (1664B)
1 2 {{alias}}( value, path[, options] ) 3 Returns a boolean indicating whether an object contains a nested key path, 4 either own or inherited. 5 6 Value arguments other than `null` or `undefined` are coerced to objects. 7 8 Key path array elements are coerced to strings. 9 10 Parameters 11 ---------- 12 value: any 13 Value to test. 14 15 path: string|Array 16 Key path. 17 18 options: Object (optional) 19 Options. 20 21 options.sep: string (optional) 22 Key path separator. Default: '.'. 23 24 Returns 25 ------- 26 bool: boolean 27 Boolean indicating if an object has a specified path. 28 29 Examples 30 -------- 31 > function Foo() { return this; }; 32 > Foo.prototype.b = { 'c': 'd' }; 33 > var obj = { 'a': new Foo() }; 34 > var bool = {{alias}}( obj, 'a.b.c' ) 35 true 36 37 // Specify a custom separator via the `sep` option: 38 > bool = {{alias}}( obj, 'a/b/c', { 'sep': '/' } ) 39 true 40 41 {{alias}}.factory( path[, options] ) 42 Returns a function which tests whether an object contains a nested key path, 43 either own or inherited. 44 45 Parameters 46 ---------- 47 path: string|Array 48 Key path. 49 50 options: Object (optional) 51 Options. 52 53 options.sep: string (optional) 54 Key path separator. Default: '.'. 55 56 Returns 57 ------- 58 out: Function 59 Function which tests whether an object contains a nested key path. 60 61 Examples 62 -------- 63 > function Foo() { return this; }; 64 > Foo.prototype.b = { 'c': 'd' }; 65 > var has = {{alias}}.factory( 'a/b/c', { 'sep': '/' } ); 66 > var obj = { 'a': new Foo() }; 67 > var bool = has( obj ) 68 true 69 70 See Also 71 -------- 72