@danielx/civet 0.4.19-pre.11 → 0.4.19-pre.13

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 CHANGED
@@ -88,6 +88,9 @@ Things Kept from CoffeeScript
88
88
  - Simplified number method calls `1.toFixed()` -> `1..toFixed()`
89
89
  - `if`/`switch`/`for`/`loop`/`while`/`throw` expressions
90
90
  - Destructuring object assignment doesn't require being wrapped in parens at the statement level `{a, b} = c` -> `({a, b} = c)`
91
+ - Prefix or postfix splats `[...a]`, `x = [a...]`
92
+ - `///` Heregexp
93
+ - With some [changes](#things-changed-from-coffeescript).
91
94
  - JSX 😿
92
95
 
93
96
  Things Removed from CoffeeScript
@@ -108,7 +111,7 @@ Civet.
108
111
  - `for from` (use JS `for of`, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
109
112
  - `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"`)
110
113
  - `for ... when <condition>` (use `continue if exp` inside loop, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
111
- - `and=`, `or=` (don't mix and match words and symbols)
114
+ - `and=`, `or=` (don't mix and match words and symbols, or use `"civet coffeeCompat"`, or `"civet coffeeWordAssignment"`)
112
115
  - `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)
113
116
  - `a of b` (use `a in b` matching JS, or `"civet coffeeCompat"`, or `"civet coffeeOf"`)
114
117
  - Iteration expression results
@@ -117,7 +120,6 @@ Civet.
117
120
  - Optional assignment `x?.y = 3` -> `x != null ? x.y = 3 : undefined`
118
121
  - Conditional assignment `a?[x] = 3` -> `a ? a[x] = 3 : undefined`
119
122
  - Might add later
120
- - `///` Heregexp
121
123
  - Rest parameter in any assignment position
122
124
  - Multiple slice assignment `otherNumbers[0...] = numbers[3..6] = [-3, -4, -5, -6]`
123
125
 
@@ -127,7 +129,6 @@ Things Changed from CoffeeScript
127
129
  - `==` -> `==` rather than `===` (can be kept with `"civet coffeeCompat"` or `"civet coffeeEq"`)
128
130
  - `!=` -> `!=` rather than `!==` (can be kept with `"civet coffeeCompat"` or `"civet coffeeEq"`)
129
131
  - `for in` and `for of` are no longer swapped and become their JS equivalents.
130
- - `a...` is now `...a` just like JS
131
132
  - `a in b` is now `a in b` rather than `b.indexOf(a) >= 0`
132
133
  - `x?.y` now compiles to `x?.y` rather than the `if typeof x !== 'undefined' && x !== null` if check
133
134
  - Existential `x?` -> `(x != null)` no longer checks for undeclared variables.
@@ -150,6 +151,15 @@ Things Changed from CoffeeScript
150
151
  x + 3
151
152
  ```
152
153
  remains as is.
154
+ - Heregex
155
+ - Allows both kinds of substitutions `#{..}`, `${..}`.
156
+ - Also allows both kinds of single line comments `//`, `#`.
157
+ - Keeps non-newline whitespace inside of character classes.
158
+ - Doesn't require escaping `#` after space inside of character classes.
159
+ - `#` is always the start of a comment outside of character classes regardless of leading space (CoffeeScript treats
160
+ `\s+#` as comment starts inside and outside of character classes).
161
+ - Might later add a compat flag to get more CoffeeScript compatibility.
162
+ - Might also later add a compat flag to only use ES interpolations and comments inside Heregexes.
153
163
 
154
164
  Things Added that CoffeeScript didn't
155
165
  ---
@@ -239,6 +249,7 @@ coffeeInterpolation (`"a string with #{myVar}"`)
239
249
  coffeeIsnt (`isnt` -> `!==`)
240
250
  coffeeNot (`not` -> "!") (currently doesn't support `not instanceof`, `not of`)
241
251
  coffeeOf (`a of b` -> `a in b`, `a in b` -> `b.indexOf(a) >= 0`, `a not in b` -> `b.indexOf(a) < 0`)
252
+ coffeeWordAssignment (Allow `and=`, `or=`)
242
253
  ```
243
254
 
244
255
  You can use these with `"civet coffeeCompat"` to opt in to all or use them bit by bit with `"civet coffeeComment coffeeEq coffeeInterpolation"`.