pairs
优质
小牛编辑
135浏览
2023-12-01
Maps the key/value pairs in this sequence to arrays.
Signature
ObjectLikeSequence.pairs = function() { /*...*/ }
ObjectLikeSequence.pairs = function pairs() { return this.map(function(v, k) { return [k, v]; }); }
Name | Type(s) | Description |
---|---|---|
returns | Sequence | An sequence of |
Examples
var colorCodes = { red: "#f00", green: "#0f0", blue: "#00f" }; Lazy(colorCodes).pairs() // sequence: [["red", "#f00"], ["green", "#0f0"], ["blue", "#00f"]]