Skip to content

Commit 41c6452

Browse files
committed
fix(bug): fixes an issue with ArrayLiteralExpressions and iterables.
1 parent 95e492d commit 41c6452

13 files changed

Lines changed: 416 additions & 96 deletions

CODE_OF_CONDUCT.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ Our Standards
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
31+
- Other conduct which could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
Our Responsibilities
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting any of the code of conduct enforcers: [Frederik Wessberg](mailto:[email protected]).
58+
reported by contacting any of the code of conduct enforcers: [Frederik Wessberg](mailto:[email protected]) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg)).
5959
All complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.
@@ -68,4 +68,4 @@ members of the project's leadership.
6868
Attribution
6969

7070
This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
71-
available at http://contributor-covenant.org/version/1/4/
71+
available at http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ You are more than welcome to contribute to `@wessberg/ts-evaluator` in any way y
66
- Fixing issues and suggesting new features
77
- Blogging, tweeting, and creating tutorials about `@wessberg/ts-evaluator`
88
- Reaching out to [@FredWessberg](https://twitter.com/FredWessberg) on Twitter
9-
- Submit an issue or a Pull Request
9+
- Submit an issue or a Pull Request

LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright © 2018 Frederik Wessberg <[email protected]>
3+
Copyright © 2019 [Frederik Wessberg](mailto:[email protected]) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg))
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE
21+
SOFTWARE

README.md

Lines changed: 108 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1-
<img alt="Logo for @wessberg/ts-evaluator" src="https://raw.githubusercontent.com/wessberg/ts-evaluator/master/documentation/asset/ts-evaluator-logo.png" height="120"></img><br>
2-
<a href="https://npmcharts.com/compare/@wessberg/ts-evaluator?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/%40wessberg%2Fts-evaluator.svg" height="20"></img></a>
3-
<a href="https://david-dm.org/wessberg/ts-evaluator"><img alt="Dependencies" src="https://img.shields.io/david/wessberg/ts-evaluator.svg" height="20"></img></a>
4-
<a href="https://www.npmjs.com/package/@wessberg/ts-evaluator"><img alt="NPM Version" src="https://badge.fury.io/js/%40wessberg%2Fts-evaluator.svg" height="20"></img></a>
5-
<a href="https://github.com/wessberg/ts-evaluator/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/wessberg%2Fts-evaluator.svg" height="20"></img></a>
6-
<a href="https://opensource.org/licenses/MIT"><img alt="MIT License" src="https://img.shields.io/badge/License-MIT-yellow.svg" height="20"></img></a>
7-
<a href="https://www.patreon.com/bePatron?u=11315442"><img alt="Support on Patreon" src="https://c5.patreon.com/external/logo/[email protected]" height="20"></img></a>
1+
<!-- SHADOW_SECTION_LOGO_START -->
2+
3+
<div><img alt="Logo" src="https://raw.githubusercontent.com/wessberg/ts-evaluator/master/documentation/asset/ts-evaluator-logo.png" height="120" /></div>
4+
5+
<!-- SHADOW_SECTION_LOGO_END -->
6+
7+
<!-- SHADOW_SECTION_DESCRIPTION_SHORT_START -->
88

99
> An interpreter for Typescript that can evaluate an arbitrary Node within a Typescript AST
1010
11+
<!-- SHADOW_SECTION_DESCRIPTION_SHORT_END -->
12+
13+
<!-- SHADOW_SECTION_BADGES_START -->
14+
15+
<a href="https://npmcharts.com/compare/%40wessberg%2Fts-evaluator?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/%40wessberg%2Fts-evaluator.svg" /></a>
16+
<a href="https://www.npmjs.com/package/%40wessberg%2Fts-evaluator"><img alt="NPM version" src="https://badge.fury.io/js/%40wessberg%2Fts-evaluator.svg" /></a>
17+
<a href="https://david-dm.org/wessberg/ts-evaluator"><img alt="Dependencies" src="https://img.shields.io/david/wessberg%2Fts-evaluator.svg" /></a>
18+
<a href="https://github.com/wessberg/ts-evaluator/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/wessberg%2Fts-evaluator.svg" /></a>
19+
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square" /></a>
20+
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" /></a>
21+
<a href="https://www.patreon.com/bePatron?u=11315442"><img alt="Support on Patreon" src="https://img.shields.io/badge/patreon-donate-green.svg" /></a>
22+
23+
<!-- SHADOW_SECTION_BADGES_END -->
24+
25+
<!-- SHADOW_SECTION_DESCRIPTION_LONG_START -->
26+
1127
## Description
1228

29+
<!-- SHADOW_SECTION_DESCRIPTION_LONG_END -->
30+
1331
This library is an implementation of an interpreter for Typescript that can evaluate any `Expression`, `ExpressionStatement` or `Declaration` within a Typescript AST.
1432
Rather than interpreting a _program_, or a sequence of `Statement`s, this library takes a Node within an existing AST and evaluates it based on its' lexical environment.
1533

@@ -24,6 +42,44 @@ Additionally, `ts-evaluator` supports both a Browser environment, a Node environ
2442

2543
If you are looking for a Typescript REPL, or a way to _execute_ a full Typescript program, you're looking for something like [ts-node](https://github.com/TypeStrong/ts-node) instead.
2644

45+
<!-- SHADOW_SECTION_FEATURES_START -->
46+
47+
### Features
48+
49+
<!-- SHADOW_SECTION_FEATURES_END -->
50+
51+
- Evaluate _any_ Node within a Typescript AST and get an actual value back
52+
- Supports browser-, node, and ECMA environments.
53+
- Supports several reporting- and diagnostic hooks you can use use
54+
- Is a full-featured JavaScript virtual machine
55+
- Supports policy restrictions and sandboxing
56+
57+
<!-- SHADOW_SECTION_FEATURE_IMAGE_START -->
58+
59+
<!-- SHADOW_SECTION_FEATURE_IMAGE_END -->
60+
61+
<!-- SHADOW_SECTION_TOC_START -->
62+
63+
## Table of Contents
64+
65+
- [Description](#description)
66+
- [Features](#features)
67+
- [Table of Contents](#table-of-contents)
68+
- [Install](#install)
69+
- [NPM](#npm)
70+
- [Yarn](#yarn)
71+
- [Usage](#usage)
72+
- [Contributing](#contributing)
73+
- [Maintainers](#maintainers)
74+
- [Backers](#backers)
75+
- [Patreon](#patreon)
76+
- [FAQ](#faq)
77+
- [License](#license)
78+
79+
<!-- SHADOW_SECTION_TOC_END -->
80+
81+
<!-- SHADOW_SECTION_INSTALL_START -->
82+
2783
## Install
2884

2985
### NPM
@@ -38,8 +94,14 @@ $ npm install @wessberg/ts-evaluator
3894
$ yarn add @wessberg/ts-evaluator
3995
```
4096

97+
<!-- SHADOW_SECTION_INSTALL_END -->
98+
99+
<!-- SHADOW_SECTION_USAGE_START -->
100+
41101
## Usage
42102

103+
<!-- SHADOW_SECTION_USAGE_END -->
104+
43105
Let's start off with a very basic example:
44106

45107
```typescript
@@ -178,18 +240,52 @@ Here's an explainer of the different reporting hooks:
178240
- `reportIntermediateResults(entry: IIntermediateResultReportEntry) => void|(Promise<void>)` - Will be invoked for each intermediate result that has been evaluated before producing a final result. This allows you to work programmatically with all expression values during code execution.
179241
- `reportErrors(entry: IErrorReportEntry) => void|(Promise<void>)` - Will be invoked for each error that is thrown, both when evaluating a result, and for subsequent invocations on, for example, returned function instances. Holds a reference to the error, as well ast the AST node that threw or caused the Error.
180242

243+
<!-- SHADOW_SECTION_CONTRIBUTING_START -->
244+
181245
## Contributing
182246

183247
Do you want to contribute? Awesome! Please follow [these recommendations](./CONTRIBUTING.md).
184248

249+
<!-- SHADOW_SECTION_CONTRIBUTING_END -->
250+
251+
<!-- SHADOW_SECTION_MAINTAINERS_START -->
252+
185253
## Maintainers
186254

187-
- <a href="https://github.com/wessberg"><img alt="Frederik Wessberg" src="https://avatars2.githubusercontent.com/u/20454213?s=460&v=4" height="11"></img></a> [Frederik Wessberg](https://github.com/wessberg): _Maintainer_
255+
| <img alt="Frederik Wessberg" src="https://avatars2.githubusercontent.com/u/20454213?s=460&v=4" height="70" /> |
256+
| --------------------------------------------------------------------------------------------------------------------------------- |
257+
| [Frederik Wessberg](mailto:[email protected])<br>[@FredWessberg](https://twitter.com/FredWessberg)<br>_Lead Developer_ |
258+
259+
<!-- SHADOW_SECTION_MAINTAINERS_END -->
260+
261+
<!-- SHADOW_SECTION_BACKERS_START -->
262+
263+
## Backers
264+
265+
### Patreon
266+
267+
[Become a backer](https://www.patreon.com/bePatron?u=11315442) and get your name, avatar, and Twitter handle listed here.
268+
269+
<a href="https://www.patreon.com/bePatron?u=11315442"><img alt="Backers on Patreon" src="https://patreon-badge.herokuapp.com/11315442.png" width="500" /></a>
270+
271+
<!-- SHADOW_SECTION_BACKERS_END -->
272+
273+
<!-- SHADOW_SECTION_FAQ_START -->
274+
275+
## FAQ
276+
277+
<!-- SHADOW_SECTION_FAQ_END -->
278+
279+
### How fast is this?
280+
281+
This is, after all, a virtual machine written on top of another virtual machine (V8), which is built in a dynamically typed high-level language (EcmaScript). This library is _not_ built to be
282+
comparable in performance to raw V8 execution speed. However, since `ts-evaluator` doesn't require a compile-step and works directly on an AST, for small operations it will most likely be several magnitudes faster than
283+
both `ts-node` and compiling to JavaScript with `tsc` and executing directly.
188284

189-
## Backers 🏅
285+
<!-- SHADOW_SECTION_LICENSE_START -->
190286

191-
[Become a backer](https://www.patreon.com/bePatron?u=11315442) and get your name, logo, and link to your site listed here.
287+
## License
192288

193-
## License 📄
289+
MIT © [Frederik Wessberg](mailto:[email protected]) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg))
194290

195-
MIT © [Frederik Wessberg](https://github.com/wessberg)
291+
<!-- SHADOW_SECTION_LICENSE_END -->

0 commit comments

Comments
 (0)