Skip to content

Commit b82256d

Browse files
committed
[WIP] Fable support update
1 parent 7179c92 commit b82256d

File tree

1 file changed

+5
-5
lines changed
  • src/netcore/Fable.Client.Browser/demo

1 file changed

+5
-5
lines changed

src/netcore/Fable.Client.Browser/demo/repl.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,16 @@
325325
function isObject(x) {
326326
return x !== null && typeof x === "object" && !(x instanceof Number) && !(x instanceof String) && !(x instanceof Boolean);
327327
}
328-
let mkArray = function (k, v) {
328+
let fixValue = function (k, v) {
329329
return v && v[Symbol.iterator] && !Array.isArray(v) && isObject(v) ? Array.from(v)
330330
: v && v.Case && v.Fields && Array.isArray(v.Fields) ?
331331
v.Fields.length == 1 ? v.Fields[0] : v.Fields.length > 1 ? v.Fields : v.Case
332332
: (k.startsWith("directives@") || k.startsWith("specifiers@")) && !v ? [] : v;
333333
};
334-
let astJson = JSON.stringify(ast, mkArray)
335-
.replace(/"typ"/g, '"type"')
336-
.replace(/@[0-9]+/g, '')
337-
.replace(/"arguments":/g, '"params":');
334+
let astJson = JSON.stringify(ast, fixValue)
335+
.replace(/"typ":/g, '"type":')
336+
.replace(/@[0-9]+"/g, '"')
337+
.replace(/"args":/g, '"params":');
338338
let newAst = JSON.parse(astJson);
339339
return newAst;
340340
}

0 commit comments

Comments
 (0)