Full-featured .scad text editor w/ autocomplete
This commit is contained in:
parent
6486d698d4
commit
186049b215
14 changed files with 930 additions and 13 deletions
12
src/utils.ts
Normal file
12
src/utils.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||
|
||||
export function mapObject(o: any, f: (key: string, value: any) => any, ifPred: (key: string) => boolean) {
|
||||
const ret = [];
|
||||
for (const key of Object.keys(o)) {
|
||||
if (ifPred && !ifPred(key)) {
|
||||
continue;
|
||||
}
|
||||
ret.push(f(key, o[key]));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
Loading…
Reference in a new issue