functions
优质
小牛编辑
129浏览
2023-12-01
Creates a Sequence consisting of the keys from this sequence whose values are functions.
Signature
ObjectLikeSequence.functions = function() { /*...*/ }
ObjectLikeSequence.functions = function functions() { return this .filter(function(v, k) { return typeof(v) === "function"; }) .map(function(v, k) { return k; }); }
Name | Type(s) | Description |
---|---|---|
returns | Sequence | The new sequence. |
Examples
var dog = { name: "Fido", breed: "Golden Retriever", bark: function() { console.log("Woof!"); }, wagTail: function() { console.log("TODO: implement robotic dog interface"); } }; Lazy(dog).functions() // sequence: ["bark", "wagTail"]