repl.txt (1273B)
1 2 {{alias}}( obj, prop, descriptor ) 3 Defines a memoized object property. 4 5 Parameters 6 ---------- 7 obj: Object 8 Object on which to define the property. 9 10 prop: string|symbol 11 Property name. 12 13 descriptor: Object 14 Property descriptor. 15 16 descriptor.configurable: boolean (optional) 17 Boolean indicating if property descriptor can be changed and if the 18 property can be deleted from the provided object. Default: false. 19 20 descriptor.enumerable: boolean (optional) 21 Boolean indicating if the property shows up when enumerating object 22 properties. Default: false. 23 24 descriptor.writable: boolean (optional) 25 Boolean indicating if the value associated with the property can be 26 changed with an assignment operator. Default: false. 27 28 descriptor.value: Function 29 Synchronous function whose return value will be memoized and set as the 30 property value. 31 32 Examples 33 -------- 34 > var obj = {}; 35 > function foo() { 36 ... return 'bar'; 37 ... }; 38 > {{alias}}( obj, 'foo', { 39 ... 'configurable': false, 40 ... 'enumerable': true, 41 ... 'writable': false, 42 ... 'value': foo 43 ... }); 44 > obj.foo 45 'bar' 46 47 See Also 48 -------- 49