-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rostaminikoo
authored and
Rostaminikoo
committed
Aug 15, 2023
1 parent
eda210a
commit 3677fe4
Showing
6 changed files
with
37 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
test | ||
src | ||
public | ||
|
||
webpack.config.js | ||
tsconfig.json | ||
jest.config.js |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import ts from "typescript"; | ||
|
||
export class Writer { | ||
|
||
private _printer: ts.Printer; | ||
private _nodes: Array<ts.Node> = []; | ||
|
||
constructor(...nodes: Array<ts.Node>) { | ||
this._nodes = nodes || this._nodes; | ||
this._printer = ts.createPrinter({ newLine: ts.NewLineKind.CarriageReturnLineFeed }); | ||
} | ||
|
||
setNodes(...nodes: Array<ts.Node>) { | ||
this._nodes = nodes || this._nodes; | ||
} | ||
|
||
print(): string { | ||
const result: Array<string> = []; | ||
this._nodes.forEach(n => | ||
result.push(this._printer.printNode(ts.EmitHint.Unspecified, n, undefined)) | ||
) | ||
return result.join("\n\n") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters