From 2b94849429770a377dc9f80bc0ac84931c0a42f9 Mon Sep 17 00:00:00 2001
From: Jeremy Ashkenas
+ You can use not as an alias for !. +
As in YAML, on and yes are the same as boolean true, while off and no are boolean false. diff --git a/examples/code.cs b/examples/code.cs index f6d58537..ad520571 100644 --- a/examples/code.cs +++ b/examples/code.cs @@ -99,7 +99,7 @@ while true continue if continuing. # Unary operators. -!!true +!true # Lexical scoping. a: 5 diff --git a/examples/underscore.cs b/examples/underscore.cs index 56abbb53..754d1842 100644 --- a/examples/underscore.cs +++ b/examples/underscore.cs @@ -78,28 +78,24 @@ _.reduceRight: obj, memo, iterator, context => _.each(reversed, reverser) memo. -# # Return the first value which passes a truth test. -# _.detect = function(obj, iterator, context) { -# var result; -# _.each(obj, function(value, index, list) { -# if (iterator.call(context, value, index, list)) { -# result = value; -# _.breakLoop(); -# } -# }); -# return result; -# }; -# -# # Return all the elements that pass a truth test. Use JavaScript 1.6's -# # filter(), if it exists. -# _.select = function(obj, iterator, context) { -# if (obj && _.isFunction(obj.filter)) return obj.filter(iterator, context); -# var results = []; -# _.each(obj, function(value, index, list) { -# iterator.call(context, value, index, list) && results.push(value); -# }); -# return results; -# }; + # Return the first value which passes a truth test. + _.detect: obj, iterator, context => + result: null + _.each(obj, (value, index, list => + if iterator.call(context, value, index, list) + result: value + _.breakLoop()..)) + result. + + # Return all the elements that pass a truth test. Use JavaScript 1.6's + # filter(), if it exists. + _.select: obj, iterator, context => + if obj and _.isFunction(obj.filter) then return obj.filter(iterator, context). + results: [] + _.each(obj, (value, index, list => + iterator.call(context, value, index, list) and results.push(value).)) + results. + # # # Return all the elements for which a truth test fails. # _.reject = function(obj, iterator, context) { diff --git a/index.html b/index.html index 71df7c15..f71b6add 100644 --- a/index.html +++ b/index.html @@ -612,6 +612,9 @@ return [document.title, "Hello JavaScript"].join(": "); In addition, is compiles into ===, and aint into !==.
++ You can use not as an alias for !. +
As in YAML, on and yes are the same as boolean true, while off and no are boolean false.