Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion packages/pond/lib/event.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions packages/pond/lib/rate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 21 additions & 17 deletions packages/pond/lib/timerange.js

Large diffs are not rendered by default.

110 changes: 46 additions & 64 deletions packages/pond/lib/timeseries.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/pond/src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ export class Event<T extends Key = Time> extends Base {
* Note: the default `field` is "value".
*/
public get(field: string | string[] = "value"): any {
if (_.isString(field) && this.data.has(field)) {
return this.getData().get(field);
}
const f = util.fieldAsArray(field);
return this.getData().getIn(f);
}
Expand Down
10 changes: 10 additions & 0 deletions packages/pond/tests/event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ describe("Time Events", () => {
const eventValue = event1.get(["NorthRoute", "in"]);
expect(eventValue).toBe(123);
});

it("can check get values when field has a dot notation", () => {
const timestamp = time(new Date("2015-04-22T03:30:00Z"));
const event1 = event(
timestamp,
Immutable.fromJS({ "not.fieldpath": { in: 789, out: 223 } })
);
const eventValue = event1.get("not.fieldpath");
expect(eventValue.toJS()).toEqual({ in: 789, out: 223 });
});
});

describe("Indexed Events", () => {
Expand Down