@danielx/civet 0.5.72 → 0.5.74
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 +15 -5
- package/dist/browser.js +601 -80
- package/dist/civet +0 -0
- package/dist/main.js +601 -80
- package/dist/main.mjs +601 -80
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,11 @@ Civet is essentially a tasteful superset of TypeScript.
|
|
|
74
74
|
|
|
75
75
|
### Implementations of New and Proposed ES Features
|
|
76
76
|
|
|
77
|
+
See the [documentation](https://civet.dev/) for examples of these
|
|
78
|
+
and other features.
|
|
79
|
+
|
|
80
|
+
- Pattern matching (based on [TC39 proposal](https://github.com/tc39/proposal-pattern-matching))
|
|
81
|
+
- `switch` can match patterns like `[{type: "text", name}, ...rest]`
|
|
77
82
|
- Pipe operator (based on [F# pipes](https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/symbol-and-operator-reference/#function-symbols-and-operators), [Hack pipes](https://docs.hhvm.com/hack/expressions-and-operators/pipe) and the [TC39 proposal](https://github.com/tc39/proposal-pipeline-operator))
|
|
78
83
|
- `data |> Object.keys |> console.log` equivalent to
|
|
79
84
|
`console.log(Object.keys(data))`
|
|
@@ -82,14 +87,19 @@ Civet is essentially a tasteful superset of TypeScript.
|
|
|
82
87
|
- `|> await`, `|> yield`, and `|> return` (at end)
|
|
83
88
|
for wrapping left-hand side with that operation
|
|
84
89
|
- Short function block syntax like [Ruby symbol to proc](https://ruby-doc.org/core-3.1.2/Symbol.html#method-i-to_proc), [Crystal](https://crystal-lang.org/reference/1.6/syntax_and_semantics/blocks_and_procs.html#short-one-parameter-syntax), [Elm record access](https://elm-lang.org/docs/records#access)
|
|
85
|
-
- Access: `x.map &.name` → `x.map(a => a.name)`
|
|
90
|
+
- Access: `x.map &.name` or `x.map .name` → `x.map(a => a.name)`
|
|
86
91
|
- Nested access + slices: `x.map &.profile?.name[0...3]` → `x.map(a => a.profile?.name.slice(0, 3))`
|
|
87
92
|
- Function call: `x.map &.callback a, b` → `x.map($ => $.callback(a, b))`
|
|
88
93
|
- Unary operators: `x.map !!&` → `x.map($ => !!$)`
|
|
89
94
|
- Binary operators: `x.map &+1` → `x.map($ => $+1)`
|
|
90
|
-
-
|
|
91
|
-
`{
|
|
92
|
-
|
|
95
|
+
- Object literal shorthand
|
|
96
|
+
- `{foo()}` → `{foo: foo()}`, `{props.foo}` → `{foo: props.foo}`
|
|
97
|
+
- ``{`${x}${y}`: z}`` → ``{[`${x}${y}`]: z}``
|
|
98
|
+
- `data.{x,y}` or `data{x,y}` → `{x: data.x, y: data.y}`
|
|
99
|
+
- Flagging shorthand based on [from LiveScript](https://livescript.net/#literals-objects):
|
|
100
|
+
`{+debug, -live, !verbose}` → `{debug: true, live: false, verbose: false}`
|
|
101
|
+
- Custom infix operators from any two-argument function
|
|
102
|
+
- `do` expressions, `if` expressions, `for` expressions
|
|
93
103
|
|
|
94
104
|
### Convenience for ES6+ Features
|
|
95
105
|
|
|
@@ -194,7 +204,7 @@ could be a valid property `1.e10` → `1..e10`. The workaround is to add a trail
|
|
|
194
204
|
- `when` inside switch automatically breaks and adds block scope.
|
|
195
205
|
- `else` inside switch adds block scope.
|
|
196
206
|
- No whitespace between unary operators and operands. Mandatory whitespace between condition and ternary `?` ex. `x ? a : b` since `x?` is the unary existential operator.
|
|
197
|
-
-
|
|
207
|
+
- Labels written `:label` (except for special case `$:` for Svelte)
|
|
198
208
|
|
|
199
209
|
### Scripting Improvements
|
|
200
210
|
|