melf-share
v0.1.12
Published
(A)Synchronous remote references based on http://npmjs.com/melf
Maintainers
Readme
MelfShare
(A)Synchronous remote references based on melf.
{serialize, instantiate, reflect, ownerof, discard} = require("melf-share")(melf, {synchronous, namespace})
melf :: melf.Melfsynchronous :: boolean | undefinednamespace :: string | undefineddata = serialize(value, hint)value :: *hint :: Hintdata :: JSON
value = instantiate(data)data :: JSONvalue :: *
reflect :: objectalias = ownerof(value)value :: object | symbolalias :: string
success = discard(value)value :: object | symbolsuccess :: boolean
Hints
"number","string"or"default": Will try to transform the given value into a primitive using the standard steps.- Array of hint: Will try to serialize the elements of the given value using the elements of the hint. The instantiation will result to a new local array if successful else a remote array.
- Object of hint: Will try to serialize the enumerable properties of the given value using the properties of the hint. The instantiation will result to a new local object if successful else a remote object.
- Others:
Others hint values are ignored and can be used for documentation purpose.
After instantiation:
- Non-symbolic primitives will refer to the same value (
undefined,NaN,+Infinity,-Infinity,-0are supported). - Well-known and global symbol will refer the local corresponding well-known/global symbol.
- Other symbols will refer to a dedicated symbol with the same string representation.
- Arrays will refer to a remote array.
- Non-constructors will refer to a remote arrow.
- Constructors will refer to a remote function.
- Objects will refer to a remote object.
- Non-symbolic primitives will refer to the same value (
