better-eval
Advanced tools
Comparing version 1.2.6 to 1.2.7
{ | ||
"name": "better-eval", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "🔧 An alternative to the 'eval' function in JavaScript that is faster, easier/better to use, and has less security issues.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,3 +5,3 @@ # 🔧 better-eval | ||
The eval function in JavaScript sucks, and there lacks alternatives that provide the same simplicity that the original eval function had. **better-eval** solves this problem by adressing the security and speed issues, while delivering the same easy-to-use API. | ||
The eval function sucks, and there lacks alternatives that provide the same simplicity of the original eval function. **better-eval** solves this problem by adressing the security and speed issues, while delivering a sensible API. | ||
@@ -31,3 +31,3 @@ <a href="https://www.producthunt.com/posts/better-eval?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-better-eval" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=327967&theme=light" alt="better-eval - 🔧 An alternative to 'eval' that is just better! | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a> | ||
First, import the package. | ||
First, import the package: | ||
@@ -41,6 +41,6 @@ ```js | ||
```js | ||
betterEval("1+1"); // returns 2! | ||
betterEval("1+1"); // returns 2 | ||
``` | ||
And its as simple as that! No variables from your context will be leaked to the function. | ||
And its as simple as that! Any code will not be able to access variables you define unless explicitly passed. | ||
@@ -54,3 +54,3 @@ ## Passing Variables | ||
betterEval("`Hey ${name}`", { name }); //returns 'Hey Sam' | ||
betterEval("`Hey ${name}`", { name }); // returns 'Hey Sam' | ||
``` | ||
@@ -63,3 +63,3 @@ | ||
betterEval("`Hey ${returnName()}`", { returnName }); | ||
betterEval("`Hey ${returnName()}`", { returnName }); // returns 'Hey Bob' | ||
``` | ||
@@ -66,0 +66,0 @@ |
9330