当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

keys

优质
小牛编辑
139浏览
2023-12-01

Returns a Sequence whose elements are the keys of this object-like sequence.

Signature

ObjectLikeSequence.keys = function() { /*...*/ }
ObjectLikeSequence.keys = function keys() {
  return new KeySequence(this);
}
NameType(s)Description
returnsSequence

The sequence based on this sequence's keys.

Examples

var obj = { hello: "hola", goodbye: "hasta luego" };

Lazy(obj).keys() // sequence: ["hello", "goodbye"]
Lazy(obj).keys().map(function(v, i) { return [v, i]; }) // sequence: [["hello", 0], ["goodbye", 1]]