forked from Technigo/js-project-recipe-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.js
More file actions
51 lines (49 loc) · 1.1 KB
/
input.js
File metadata and controls
51 lines (49 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using handlerSync = openSync();
await using handlerAsync = await openAsync();
import data from "./data.json" with { type: "json" };
// matches Aa and aa
const regex = /(?i:a)a/
// matches aa, a\naa, etc. but not a\na
const regex = /(?m:^a)a/
// matches \na and aa, but not \n\n
const regex = /(?s:.)./
// replace this expression to `globalThis.foo = "top"`
this.foo = "top";
() => {
// replace
this.foo = "top"
}
function Foo() {
// don't replace
this.foo = "inner";
}
class Bar {
method() {
// don't replace
this.foo = "inner";
}
}
class Bar {
// replace
[this.foo = "outer"]() {
// don't replace
this.foo = "inner";
}
}
{
"type": "ClassMethod", // skipped
"key": { "type": "AssignmentExpression" }, // [this.foo = "outer"]
"body": { "type": "BlockStatement" }, // { this.foo = "inner"; }
"params": [], // should visit too if there are any
"computed": true
}
class Bar {
// replace
[this.foo = "outer"] =
// don't replace
this.foo
}
class Foo {
// replaced to `@globalThis.log`
@(this.log) foo = 1;
}