Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Series.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class Series {
constructor(public data: any[], public offset: number = 0) {}
constructor(public data: any[], public offset: number = 0) { }

public get(index: number): any {
const realIndex = this.data.length - 1 - (this.offset + index);
Expand Down Expand Up @@ -27,6 +27,7 @@ export class Series {
static from(source: any): Series {
if (source instanceof Series) return source;
if (Array.isArray(source)) return new Series(source);
if (typeof source === 'object' && '__value' in source && source.__value instanceof Series) return source.__value;
return new Series([source]); // Treat scalar as single-element array? Or handle differently?
// Ideally, scalar should be treated as a series where get(0) returns the value, and get(>0) might be undefined or NaN?
// But for now, let's wrap in array.
Expand Down