These macros are designed to provide a literal notation for immutable-js using sweetjs.
The most interesting being the Map literal
var map = im{"foo": "bar", "baz": "quux"};
This compiles to the 2d array version of Immutable.Map.
var map = Immutable.Map([
["foo", "bar"],
["baz", "quux"]
]);
This means that the following is also perfectly valid.
var user1 = {name: "John"};
var book1 = {name: "Cat in the Hat"};
var favoriteBooks = im{user1: book1};
It also means that strings must be quoted, so... use jshint with undef on :-)
Here's some other examples. I'd explain them, but if I need to then these macros have failed.
var map = im{"foo": "bar", "baz": "quux"};
var orderedMap = im:ordered{"foo": "bar", "baz": "quux"};
var list = im["foo", "bar", "baz"];
var stack = im:stack["foo", "bar", "baz"];
var set = im:set["foo", "bar", "baz"];
var record = im:record {"foo": "bar", "baz": "quux"};
// complex object
var person = im{
"name": "John Doe",
"hobbies": im:set[
"hiking",
"art"
],
"relationships": im{
people["Jane"]: "wife"
}
};
For stylistic variations feel free to put a space before 'im', and wrap keys like user1 in parentheses.