@danielx/civet 0.4.5 → 0.4.7

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
  ---
@@ -132,9 +134,19 @@ Things Changed from CoffeeScript
132
134
  - Embedded JS `\`\`` has been replaced with JS template literals.
133
135
  - No longer allowing multiple postfix `if/unless` on the same line.
134
136
  - No `else` block on `unless` (negate condition and use `if`)
137
+ - `#{}` interpolation in `""` strings only when `"use coffee-compat"`
135
138
  - Civet tries to keep the transpiled output verbatim as much as possible.
136
139
  In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x);`.
137
- 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.
138
150
 
139
151
  Things Added that CoffeeScript didn't
140
152
  ---
@@ -159,21 +171,22 @@ Things Added that CoffeeScript didn't
159
171
  - JS Compatability
160
172
  - `var`, `let`, `const`
161
173
  - JS Comment Syntax `//` and `/* */`
174
+ - `function` keyword
162
175
  - Braced Blocks
163
- - OptionalChain longhand
164
- - ConditionalExpression
176
+ - `f?.(x)` function application and `a?.[x]` index OptionalChain longhand
177
+ - `a ? b : c` ConditionalExpression
165
178
  - `case` statement
166
179
  - `do`, `do { ... } until condition`
167
- - Const assignment shorthand `a := b` -> `const a = b`; `{a, b} := c` -> `const {a, b} = c`
180
+ - `get`/`set` method definitions
181
+ - Private identifiers `#id`
168
182
  - Convenience for ES6+ Features
183
+ - Const assignment shorthand `a := b` -> `const a = b`; `{a, b} := c` -> `const {a, b} = c`
169
184
  - `<` as `extends` shorthand
170
185
  - `@#id` -> `this.#id` shorthand for private identifiers
171
186
  - `import` shorthand `x from ./x` -> `import x from "./x"`
172
- - `\`\`\`` Block Template Strings
173
- - Class constructor shorthand `@( ... )`
174
- - ClassStaticBlock
175
- - `get`/`set` method definitions
176
- - Private identifiers `#id`
187
+ - `\`\`\`` Block Template Strings remove leading indentation for clarity
188
+ - Class constructor shorthand `@( ... )`
189
+ - ClassStaticBlock `@ { ... }`
177
190
  - Shebang line is kept unmodified in output
178
191
  ```civet
179
192
  #!./node_modules/.bin/ts-node