You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2019/12/18 18:00:00 UTC

[couchdb-escodegen] 01/01: fix: create regexp literal if possible

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to reference refs/pull/308/head
in repository https://gitbox.apache.org/repos/asf/couchdb-escodegen.git

commit 19dfe4658232f2a6f919394d6c36526ff35cdb8c
Author: Markus Wolf <ma...@markus-wolf.de>
AuthorDate: Thu Aug 11 08:45:38 2016 +0200

    fix: create regexp literal if possible
    
    to get around not serializable regexp the raw literal value should be used instead of the value
    
    FIX ISSUE #294
---
 escodegen.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/escodegen.js b/escodegen.js
index 6202819..42c05ae 100644
--- a/escodegen.js
+++ b/escodegen.js
@@ -2331,6 +2331,9 @@
                 return expr.value ? 'true' : 'false';
             }
 
+            if (expr.regex) {
+              return '/' + expr.regex.pattern + '/' + expr.regex.flags;
+            }
             return generateRegExp(expr.value);
         },