@danielx/civet 0.4.19-pre.2 → 0.4.19-pre.4
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 +8 -8
- package/dist/browser.js +641 -386
- package/dist/main.js +641 -386
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ Things Kept from CoffeeScript
|
|
|
69
69
|
- Indentation based block syntax
|
|
70
70
|
- OptionalChain shorthand for index and function application `a?[b]` -> `a?.[b]`, `a?(b)` -> `a?.(b)`
|
|
71
71
|
- `?=` null-coalescing assignment shorthand
|
|
72
|
-
- `@` `this` shorthand `@` -> `this`, `@id` -> `this.id`
|
|
72
|
+
- `@` `this` shorthand `@` -> `this`, `@id` -> `this.id`, `{@id} -> {id: this.id}`
|
|
73
73
|
- Prototype shorthand `X::` -> `X.prototype`, `X::a` -> `X.prototype.a`
|
|
74
74
|
- Class static shorthand `@`
|
|
75
75
|
- Chained comparisons `a < b < c` -> `a < b && b < c`
|
|
@@ -83,6 +83,8 @@ Things Kept from CoffeeScript
|
|
|
83
83
|
- Array slices `list[0...2]` -> `list.slice(0, 2)`
|
|
84
84
|
- Slice assignment `numbers[3..6] = [-3, -4, -5, -6]` -> `numbers.splice(3, 4, ...[-3, -4, -5, -6])`
|
|
85
85
|
- Implicit returns
|
|
86
|
+
- Late assignment `x + y = z` -> `x + (y = z)`
|
|
87
|
+
- Braceless inline objects `x = coolStory: true`
|
|
86
88
|
- Simplified number method calls `1.toFixed()` -> `1..toFixed()`
|
|
87
89
|
- `if`/`switch` expressions
|
|
88
90
|
- Destructuring object assignment doesn't require being wrapped in parens at the statement level `{a, b} = c` -> `({a, b} = c)`
|
|
@@ -100,7 +102,6 @@ Civet.
|
|
|
100
102
|
- `isnt` (use `!==`, `"civet coffeeCompat"`, or `"civet coffeeIsnt"`)
|
|
101
103
|
- `not` (use `!`, `"civet coffeeCompat"`, or `"civet coffeeNot"`)
|
|
102
104
|
- `not instanceof` (use `!(a instanceof b)`)
|
|
103
|
-
- `not in`
|
|
104
105
|
- `not of`
|
|
105
106
|
- NOTE: CoffeeScript `not` precedence is dubious. `not a < b` should be equivalent to `!(a < b)` but it is in fact `!a < b`
|
|
106
107
|
- `do` keyword (replaced with JS `do`, invoke using existing `(-> ...)()` syntax, `"civet coffeeCompat"`, or `"civet coffeeDo"`)
|
|
@@ -108,7 +109,7 @@ Civet.
|
|
|
108
109
|
- `for own of` (use JS `for in` and check manually, switch to `Map#keys/values/entries`, or use `Object.create(null)`, or `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
|
|
109
110
|
- `for ... when <condition>` (use `continue if exp` inside loop, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
|
|
110
111
|
- `and=`, `or=` (don't mix and match words and symbols)
|
|
111
|
-
- `a ? b` (use `a ?? b`, though it doesn't check for undeclared variables)
|
|
112
|
+
- `a ? b` (use `a ?? b`, though it doesn't check for undeclared variables, `"civet coffeeCompat"`, or `"civet coffeeBinaryExistential"` enables this at the cost of losing JS ternary operator)
|
|
112
113
|
- `a of b` (use `a in b` matching JS, or `"civet coffeeCompat"`, or `"civet coffeeOf"`)
|
|
113
114
|
- Iteration expression results
|
|
114
115
|
- Backtick embedded JS (replaced by template literals)
|
|
@@ -117,7 +118,6 @@ Civet.
|
|
|
117
118
|
- Loop expressions (at least in compatibility mode)
|
|
118
119
|
- Conditional assignment `a?[x] = 3` -> `a ? a[x] = 3 : undefined`
|
|
119
120
|
- Might add later
|
|
120
|
-
- Braceless inline objects `x = coolStory: true`
|
|
121
121
|
- `///` Heregexp
|
|
122
122
|
- Rest parameter in any assignment position
|
|
123
123
|
- Multiple slice assignment `otherNumbers[0...] = numbers[3..6] = [-3, -4, -5, -6]`
|
|
@@ -235,11 +235,11 @@ coffeeBooleans (yes/no/on/off)
|
|
|
235
235
|
coffeeComment (# single line comments)
|
|
236
236
|
coffeeDo ( `do ->`, disables ES6 do/while)
|
|
237
237
|
coffeeEq (`==` -> `===`, `!=` -> `!==`)
|
|
238
|
-
coffeeForLoops (for in, of, from loops
|
|
239
|
-
coffeeInterpolation (`"a string with {myVar}"`)
|
|
238
|
+
coffeeForLoops (for in, of, from loops behave like they do in CoffeeScript)
|
|
239
|
+
coffeeInterpolation (`"a string with #{myVar}"`)
|
|
240
240
|
coffeeIsnt (`isnt` -> `!==`)
|
|
241
|
-
coffeeNot (`not` -> "!") (currently doesn't support `not instanceof`, `not
|
|
242
|
-
coffeeOf (`a of b` -> `a in b`)
|
|
241
|
+
coffeeNot (`not` -> "!") (currently doesn't support `not instanceof`, `not of`)
|
|
242
|
+
coffeeOf (`a of b` -> `a in b`, `a in b` -> `b.indexOf(a) >= 0`, `a not in b` -> `b.indexOf(a) < 0`)
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
You can use these with `"civet coffeeCompat"` to opt in to all or use them bit by bit with `"civet coffeeComment coffeeEq coffeeInterpolation"`.
|