Sequence.from( srcValue as Array | Object, [options as Function | Object], [thisValue as Object] ) as Sequence
Create a Sequence object from an array-like or iterable object.
// Create a Sequence from an array. Sequence.from([1,2]); // Returns a Sequence containing of 2 items with values 1 and 2.
// Create a Sequence from an array-like object and a map function. Sequence.from({length:5},(v,k)=>k); // => A Sequence containing 0,1,2,3,4.
// Create a Sequence from an array-like object and a map function with sequenceLimit. Sequence.from({length:5},{"mapFn":(v,k)=>k, "sequenceLimit":"10000"}); // => A Sequence containing 0,1,2,3,4.
// Create a Sequence from a generator function* gen() { for (let i = 0; i < 5; i++) yield i; } Sequence.from(gen()); // => A Sequence containing 0,1,2,3,4.
// Create a Sequence from a generator with sequenceLimit function* gen() { for (let i = 0; i < 10; i++) yield i; } Sequence.from(gen(),{"sequenceLimit":"10000"}); // => A Sequence containing 0,1,2,3,4.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.