diff --git a/core/src/global/config.ts b/core/src/global/config.ts index 79f0c5c6aa..bbc51ebb79 100644 --- a/core/src/global/config.ts +++ b/core/src/global/config.ts @@ -1,10 +1,12 @@ +import { entries } from '../utils/helpers'; export class Config { private m: Map; constructor(configObj: {[key: string]: any}) { - this.m = new Map(Object.entries(configObj)); + this.m = new Map(entries(configObj)); + } get(key: string, fallback?: any): any { diff --git a/core/src/utils/helpers.ts b/core/src/utils/helpers.ts index c703c3ee18..eb1c3e0a6d 100644 --- a/core/src/utils/helpers.ts +++ b/core/src/utils/helpers.ts @@ -41,6 +41,15 @@ export function pointerCoord(ev: any): {x: number, y: number} { } export type Side = 'start' | 'end'; +export function entries(obj: {[s: string]: T}): [string, T][] { + const ownProps = Object.keys( obj ); + let i = ownProps.length; + const resArray = new Array(i); + while (i--) + resArray[i] = [ownProps[i], obj[ownProps[i]]]; + return resArray; +} + /** * @hidden * Given a side, return if it should be on the right