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