@jdeighan/coffee-utils 7.0.62 → 7.0.63

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "7.0.62",
4
+ "version": "7.0.63",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -21,6 +21,13 @@ export isComment = (line) ->
21
21
 
22
22
  # ---------------------------------------------------------------------------
23
23
 
24
+ export eval_expr = (str) ->
25
+
26
+ str = str.replace(/\bundef\b/g, 'undefined')
27
+ return Function('"use strict";return (' + str + ')')();
28
+
29
+ # ---------------------------------------------------------------------------
30
+
24
31
  export haltOnError = () ->
25
32
 
26
33
  doHaltOnError = true
@@ -23,6 +23,12 @@ export var isComment = function(line) {
23
23
  return defined(lMatches);
24
24
  };
25
25
 
26
+ // ---------------------------------------------------------------------------
27
+ export var eval_expr = function(str) {
28
+ str = str.replace(/\bundef\b/g, 'undefined');
29
+ return Function('"use strict";return (' + str + ')')();
30
+ };
31
+
26
32
  // ---------------------------------------------------------------------------
27
33
  export var haltOnError = function() {
28
34
  return doHaltOnError = true;