@danielx/civet 0.4.20 → 0.4.22

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.
Files changed (4) hide show
  1. package/README.md +20 -16
  2. package/dist/browser.js +866 -571
  3. package/dist/main.js +866 -571
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -90,7 +90,9 @@ Things Kept from CoffeeScript
90
90
  - Simplified number method calls `1.toFixed()` -> `1..toFixed()`
91
91
  - `if`/`switch`/`for`/`loop`/`while`/`throw` expressions
92
92
  - Destructuring object assignment doesn't require being wrapped in parens at the statement level `{a, b} = c` -> `({a, b} = c)`
93
- - Prefix or postfix splats `[...a]`, `x = [a...]`
93
+ - Prefix or postfix rest/splats `[...a]`, `x = [a...]`
94
+ - RestProperty in any position `{a, ...b, c} = d` -> `{a, c, ...b} = d`
95
+ - RestElement/RestParameter in any position `(first, ...midle, last) ->` -> `function(first, ...middle) { let [last] = middle.splice(-1)}`
94
96
  - `///` Heregexp
95
97
  - With some [changes](#things-changed-from-coffeescript).
96
98
  - JSX 😿
@@ -106,8 +108,8 @@ Civet.
106
108
  - `on/yes/off/no` (use `true/false`, `"civet coffeeCompat"`, or `"civet coffeeBooleans"` to add them back)
107
109
  - `isnt` (use `!==`, `"civet coffeeCompat"`, or `"civet coffeeIsnt"`)
108
110
  - `not` (use `!`, `"civet coffeeCompat"`, or `"civet coffeeNot"`)
109
- - `not instanceof` (use `!(a instanceof b)`)
110
- - `not of`
111
+ - `not instanceof` (use `!(a instanceof b)`, `"civet coffeeCompat"`, or `"civet coffeeNot"`)
112
+ - `not of` use (`"civet coffeeCompat"`, or `"civet coffeeNot"`)
111
113
  - NOTE: CoffeeScript `not` precedence is dubious. `not a < b` should be equivalent to `!(a < b)` but it is in fact `!a < b`
112
114
  - `do` keyword (replaced with JS `do`, invoke using existing `(-> ...)()` syntax, `"civet coffeeCompat"`, or `"civet coffeeDo"`)
113
115
  - `for from` (use JS `for of`, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
@@ -196,7 +198,8 @@ Things Added that CoffeeScript didn't
196
198
  - Convenience for ES6+ Features
197
199
  - Const assignment shorthand `a := b` -> `const a = b`; `{a, b} := c` -> `const {a, b} = c`
198
200
  - `@#id` -> `this.#id` shorthand for private identifiers
199
- - `import` shorthand `x from ./x` -> `import x from "./x"`
201
+ - `import` shorthand: `x from ./x` -> `import x from "./x"`
202
+ - `export` shorthand: `export x, y` -> `export {x, y}`
200
203
  - Triple backtick Template Strings remove leading indentation for clarity
201
204
  - Class constructor shorthand `@( ... )`
202
205
  - ClassStaticBlock `@ { ... }`
@@ -239,18 +242,19 @@ CoffeeScript Compatibility
239
242
 
240
243
  Civet provides a compatability prologue directive that aims to be 97+% compatible with existing CoffeeScript2 code (still a work in progress).
241
244
 
242
- ```
243
- autoVar (declare implicit vars based on assignment to undeclared identifiers)
244
- coffeeBooleans (yes/no/on/off)
245
- coffeeComment (# single line comments)
246
- coffeeDo ( `do ->`, disables ES6 do/while)
247
- coffeeEq (`==` -> `===`, `!=` -> `!==`)
248
- coffeeForLoops (for in, of, from loops behave like they do in CoffeeScript)
249
- coffeeInterpolation (`"a string with #{myVar}"`)
250
- coffeeIsnt (`isnt` -> `!==`)
251
- coffeeNot (`not` -> "!") (currently doesn't support `not instanceof`, `not of`)
252
- coffeeOf (`a of b` -> `a in b`, `a in b` -> `b.indexOf(a) >= 0`, `a not in b` -> `b.indexOf(a) < 0`)
253
- ```
245
+ | Configuration | What it enables |
246
+ |---------------------|---------------------------------------------------------------------|
247
+ | autoVar | declare implicit vars based on assignment to undeclared identifiers |
248
+ | coffeeBooleans | `yes`, `no`, `on`, `off` |
249
+ | coffeeComment | `# single line comments` |
250
+ | coffeeDo | `do ->`, disables ES6 do/while |
251
+ | coffeeEq | `==` -> `===`, `!=` -> `!==` |
252
+ | coffeeForLoops | for in, of, from loops behave like they do in CoffeeScript |
253
+ | coffeeInterpolation | `"a string with #{myVar}"` |
254
+ | coffeeIsnt | `isnt` -> `!==` |
255
+ | coffeeNot | `not` -> `!`, `a not instanceof b` -> `!(a instanceof b)`, `a not of b` -> `!(a in b)` |
256
+ | coffeeOf | `a of b` -> `a in b`, `a in b` -> `b.indexOf(a) >= 0`, `a not in b` -> `b.indexOf(a) < 0` |
257
+
254
258
 
255
259
  You can use these with `"civet coffeeCompat"` to opt in to all or use them bit by bit with `"civet coffeeComment coffeeEq coffeeInterpolation"`.
256
260
  Another possibility is to slowly remove them to provide a way to migrate files a little at a time `"civet coffeeCompat -coffeeBooleans -coffeeComment -coffeeEq"`.