Skip to content

Commit c917a3c

Browse files
committed
fix(config): add object.entries polyfil
1 parent 9c7b0ca commit c917a3c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

core/src/global/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { entries } from '../utils/helpers';
12

23
export class Config {
34

45
private m: Map<string, any>;
56

67
constructor(configObj: {[key: string]: any}) {
7-
this.m = new Map<string, any>(Object.entries(configObj));
8+
this.m = new Map<string, any>(entries(configObj));
9+
810
}
911

1012
get(key: string, fallback?: any): any {

core/src/utils/helpers.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ export function pointerCoord(ev: any): {x: number, y: number} {
4141
}
4242
export type Side = 'start' | 'end';
4343

44+
export function entries(obj: {[s: string]: T}): [string, T][] {
45+
const ownProps = Object.keys( obj );
46+
let i = ownProps.length;
47+
const resArray = new Array(i);
48+
while (i--)
49+
resArray[i] = [ownProps[i], obj[ownProps[i]]];
50+
return resArray;
51+
}
52+
4453
/**
4554
* @hidden
4655
* Given a side, return if it should be on the right

0 commit comments

Comments
 (0)