-
-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Description
Object.assign
is mutable- a common idiom is
Object.assign({}, foo, bar)
to create a new object
the Js.Obj
module could have a function that does this. e.g.:
external assignImm :
(_[@mel.as {json|{}|json}]) -> < .. > Js.t -> < .. > Js.t -> < .. > Js.t
= "Object.assign"
let () = Js.log (assignImm [%mel.obj { foo = 1 }] [%mel.obj { bar = 2 }])
$ melc -ppx melppx x.ml
// Generated by Melange
'use strict';
console.log(Object.assign({}, {
foo: 1
}, {
bar: 2
}));
/* Not a pure module */
johnhaley81
Metadata
Metadata
Assignees
Labels
No labels