@danielx/civet 0.4.6 → 0.4.8

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
@@ -26,7 +26,7 @@ Code Sample
26
26
  ---
27
27
 
28
28
  ```typescript
29
- import ts, {CompilerOptions} from "typescript"
29
+ ts, {CompilerOptions} from typescript
30
30
 
31
31
  DefaultCompilerOptions : CompilerOptions :=
32
32
  allowNonTsExtensions: true
@@ -94,7 +94,9 @@ Things Kept from CoffeeScript
94
94
  - Postfix `if/unless`
95
95
  - Block Strings `"""` / `'''`
96
96
  - `#{exp}` interpolation in `"""` strings
97
- - Multiple `case`/`when` expressions
97
+ - Multiple `,` separated `case`/`when` expressions
98
+ - `else` -> `default` in `switch`
99
+ - Implicit returns
98
100
  - JSX 😿
99
101
  - TODO
100
102
  - [ ] Chained comparisons
@@ -108,17 +110,17 @@ Things Removed from CoffeeScript
108
110
  - `do` keyword (replaced with JS `do`, invoke using existing `(-> ...)()` syntax)
109
111
  - `for from` (use JS `for of`)
110
112
  - `and=`, `or=` (don't mix and match words and symbols)
111
- - Array slices `list[0...2]` (use `list.slice(0, 2)`)
112
- - Slice assignment `numbers[3..6] = [-3, -4, -5, -6]` (use `numbers.splice(3, 4, -3, -4, -5, -6)`)
113
- - Ranges `[0...10]`
114
- - Comprensions (a case could be made for keeping them)
115
113
  - Iteration expression results
116
114
  - Implicit declarations
117
- - Implicit returns (will probably add later at least for single line functions)
118
- - Rest parameter in any assignment position (might add later)
119
115
  - Postfix `while/until`
120
116
  - `///` Heregexp
121
- - Embedded JS
117
+ - Backtick Embedded JS (replaced by template literals)
118
+ - Might add later
119
+ - Comprensions (a case could be made for keeping them)
120
+ - Array slices `list[0...2]` (use `list.slice(0, 2)`)
121
+ - Slice assignment `numbers[3..6] = [-3, -4, -5, -6]` (use `numbers.splice(3, 4, -3, -4, -5, -6)`)
122
+ - Ranges `[0...10]`
123
+ - Rest parameter in any assignment position
122
124
 
123
125
  Things Changed from CoffeeScript
124
126
  ---
@@ -135,7 +137,16 @@ Things Changed from CoffeeScript
135
137
  - `#{}` interpolation in `""` strings only when `"use coffee-compat"`
136
138
  - Civet tries to keep the transpiled output verbatim as much as possible.
137
139
  In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x);`.
138
- Also in Coffee `x + 3` -> `x + 3` but in Civet `x + 3` remains as is.
140
+ Also in Coffee
141
+ ```coffee
142
+ x + 3
143
+ ```
144
+ -> `x + 3` without the spacing
145
+ In Civet
146
+ ```typescript
147
+ x + 3
148
+ ```
149
+ remains as is.
139
150
 
140
151
  Things Added that CoffeeScript didn't
141
152
  ---
@@ -162,20 +173,20 @@ Things Added that CoffeeScript didn't
162
173
  - JS Comment Syntax `//` and `/* */`
163
174
  - `function` keyword
164
175
  - Braced Blocks
165
- - OptionalChain longhand
166
- - ConditionalExpression
176
+ - `f?.(x)` function application and `a?.[x]` index OptionalChain longhand
177
+ - `a ? b : c` ConditionalExpression
167
178
  - `case` statement
168
179
  - `do`, `do { ... } until condition`
169
- - Const assignment shorthand `a := b` -> `const a = b`; `{a, b} := c` -> `const {a, b} = c`
180
+ - `get`/`set` method definitions
181
+ - Private identifiers `#id`
170
182
  - Convenience for ES6+ Features
183
+ - Const assignment shorthand `a := b` -> `const a = b`; `{a, b} := c` -> `const {a, b} = c`
171
184
  - `<` as `extends` shorthand
172
185
  - `@#id` -> `this.#id` shorthand for private identifiers
173
186
  - `import` shorthand `x from ./x` -> `import x from "./x"`
174
187
  - `\`\`\`` Block Template Strings remove leading indentation for clarity
175
- - Class constructor shorthand `@( ... )`
176
- - ClassStaticBlock
177
- - `get`/`set` method definitions
178
- - Private identifiers `#id`
188
+ - Class constructor shorthand `@( ... )`
189
+ - ClassStaticBlock `@ { ... }`
179
190
  - Shebang line is kept unmodified in output
180
191
  ```civet
181
192
  #!./node_modules/.bin/ts-node