1 The `exists()` function checks the existence of the given key within the 2 given object. If the object contains the given key, `true` is returned, 3 otherwise `false`. 4 5 If the object argument is not an object, `false` is returned as well. 6 7 The key argument is converted to a string in case it is not one already. 8 9 -- Testcase -- 10 {% 11 let obj = { 12 "foo": true, 13 "bar": false, 14 "false": null, 15 "123": "a number" 16 }; 17 18 printf("%.J\n", [ 19 exists(true, "test"), 20 exists(obj, "doesnotexists"), 21 exists(obj, "foo"), 22 exists(obj, "bar"), 23 exists(obj, !true), 24 exists(obj, 123) 25 ]); 26 %} 27 -- End -- 28 29 -- Expect stdout -- 30 [ 31 false, 32 false, 33 true, 34 true, 35 true, 36 true 37 ] 38 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt