@danielx/civet 0.5.23 → 0.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/dist/browser.js +314 -286
- package/dist/main.js +314 -286
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,6 +67,7 @@ Things Kept from CoffeeScript
|
|
|
67
67
|
- `is` → `===`
|
|
68
68
|
- `or`, `or=` → `||`, `||=`
|
|
69
69
|
- `and`, `and=` → `&&`, `&&=`
|
|
70
|
+
- `a %% b` → `(a % b + b) % b`
|
|
70
71
|
- `loop` → `while(true)`
|
|
71
72
|
- `unless exp` → `if(!exp)`
|
|
72
73
|
- `until condition` → `while(!condition)`
|
|
@@ -118,7 +119,6 @@ Civet.
|
|
|
118
119
|
|
|
119
120
|
- Implicit `var` declarations (use `"civet coffeeCompat"` or `"civet autoVar"`)
|
|
120
121
|
- `on/yes/off/no` (use `true/false`, `"civet coffeeCompat"`, or `"civet coffeeBooleans"` to add them back)
|
|
121
|
-
- `isnt` (use `!==`, `"civet coffeeCompat"`, or `"civet coffeeIsnt"`)
|
|
122
122
|
- `not` (use `!`, `"civet coffeeCompat"`, or `"civet coffeeNot"`)
|
|
123
123
|
- `not instanceof` (use `!(a instanceof b)`, `"civet coffeeCompat"`, or `"civet coffeeNot"`)
|
|
124
124
|
- `not of` use (`"civet coffeeCompat"`, or `"civet coffeeNot"`)
|
|
@@ -131,7 +131,6 @@ Civet.
|
|
|
131
131
|
- `a of b` (use `a in b` as in JS, or `"civet coffeeCompat"`, or `"civet coffeeOf"`)
|
|
132
132
|
- Backtick embedded JS (replaced by template literals)
|
|
133
133
|
- Will add later
|
|
134
|
-
- `a %% b` → `(a % b + b) % b`
|
|
135
134
|
- Conditional assignment `a?[x] = 3` → `a ? a[x] = 3 : undefined`
|
|
136
135
|
- Multiple slice assignment `otherNumbers[0...] = numbers[3..6] = [-3, -4, -5, -6]`
|
|
137
136
|
|
|
@@ -140,8 +139,15 @@ Things Changed from CoffeeScript
|
|
|
140
139
|
|
|
141
140
|
- `==` → `==` rather than `===` (unless you specify `"civet coffeeCompat"` or `"civet coffeeEq"`)
|
|
142
141
|
- `!=` → `!=` rather than `!==` (unless you specify `"civet coffeeCompat"` or `"civet coffeeEq"`)
|
|
142
|
+
- `is not` → `!==`
|
|
143
|
+
(unless you specify `"civet coffeeCompat"` or `"civet coffeeNot"`),
|
|
144
|
+
instead of `isnt`
|
|
145
|
+
(unless you specify `"civet coffeeCompat"` or `"civet coffeeIsnt"`)
|
|
143
146
|
- `for in` and `for of` are no longer swapped and become their JS equivalents (unless you specify `"civet coffeeCompat"` or `"civet CoffeeOf"`)
|
|
144
|
-
- `a
|
|
147
|
+
- `a is in b` → `b.indexOf(a) >= 0` and
|
|
148
|
+
`a is not in b` → `b.indexOf(a) < 0` instead of `a in b` and `a not in b`;
|
|
149
|
+
`a in b` remains `a in b` as in JS, and `a not in b` → `!(a in b)`
|
|
150
|
+
(unless you specify `"civet coffeeCompat"` or `"civet coffeeOf"`)
|
|
145
151
|
- `x?.y` now compiles to `x?.y` rather than the `if typeof x !== 'undefined' && x !== null` if check
|
|
146
152
|
- Existential `x?` → `(x != null)` no longer checks for undeclared variables.
|
|
147
153
|
- `x?()` → `x?.()` instead of `if (typeof x === 'function') { x() }`
|
|
@@ -270,8 +276,8 @@ Things Changed from ES6
|
|
|
270
276
|
---
|
|
271
277
|
|
|
272
278
|
- Implicit returns, even for multi-statement functions
|
|
273
|
-
(avoid by
|
|
274
|
-
via the directive `"civet -implicitReturns"`)
|
|
279
|
+
(avoid by specifying a `void` return type, adding a trailing `;` or
|
|
280
|
+
explicit `return`, or via the directive `"civet -implicitReturns"`)
|
|
275
281
|
- Disallow no parens on single argument arrow function. `x => ...` must become `(x) => ...`
|
|
276
282
|
The reasoning is `x -> ...` => `x(function() ...)` in CoffeeScript and having `->` and `=>`
|
|
277
283
|
behave more differently than they already do is bad. Passing an anonymous function to an
|