From 1d51f240157b901a5f917859868cbc41d07eac5c Mon Sep 17 00:00:00 2001 From: Benjamin Reed Date: Tue, 6 Jun 2017 09:29:52 -0400 Subject: [PATCH] feat(enum): add a toJSON() representation --- src/internal/OnmsEnum.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/internal/OnmsEnum.ts b/src/internal/OnmsEnum.ts index 01f351fee..7b9dfc937 100644 --- a/src/internal/OnmsEnum.ts +++ b/src/internal/OnmsEnum.ts @@ -31,4 +31,12 @@ export class OnmsEnum { this.l = label; Object.freeze(this); } + + /** convert to the JSON representation */ + public toJSON() { + return { + id: this.i, + label: this.l, + }; + } }