invert
优质
小牛编辑
130浏览
2023-12-01
Returns an ObjectLikeSequence whose values are this sequence's keys, and whose keys are this sequence's values.
Signature
ObjectLikeSequence.invert = function() { /*...*/ }
ObjectLikeSequence.invert = function invert() { return new InvertedSequence(this); }
Name | Type(s) | Description |
---|---|---|
returns | ObjectLikeSequence | A new sequence comprising the inverted keys and values from this sequence. |
Examples
Lazy({ first: "Dan", last: "Tao" }).invert() // sequence: { Dan: "first", Tao: "last" }