-
Notifications
You must be signed in to change notification settings - Fork 10
Member Accessor Operators
refractalize edited this page Feb 5, 2013
·
3 revisions
Normal member access is done with the dot .
operator:
joe = {
name = 'Joe'
}
joe.name == 'Joe'
To map an array of objects to an array of their members, use the *.
operator:
joe = {name = 'Joe'}
jenny = {name = 'Jenny'}
john = {name = 'John'}
contacts = [joe, jenny, john]
contacts*.name == ['Joe', 'John', 'Jenny']
To return the member if the object is not nil, or otherwise to return nil, use the ?.
operator:
joe = {name = 'Joe'}
nobody = nil
joe?.name == 'Joe'
nobody?.name == nil
According to the documentation, you can have Closure Compiler add the sourceMappingURL to the bottom of the script with something like this:
--output_wrapper "%output%
//# sourceMappingURL=output.js.map"
being added to your call. Not that you cannot use "\n" here, and you need a newline literal. On a Linux shell this works just fine (if you're inside of quotes when you press enter, the command doesn't get executed).