Skip to content

Commit

Permalink
when validating couchdb view, give the function a name (2600hz#6518)
Browse files Browse the repository at this point in the history
* when validating couchdb view, give the function a name

We use CouchDB `couchjs` to validate that view are a valid Javascript code
and has no syntax error. Start with CouchDB 3, `couchjs` is changed now
it really require that we pass it a valid function statement with name.

This adds a name to function before writing it to file for validation.
  • Loading branch information
icehess authored May 1, 2020
1 parent 41e500d commit 561a208
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/validate-js.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def fmap(F, data):

def couchjs(field_js):
(field, js) = field_js
JS = ''.join(js) + '\n'
JS = ''.join(js).replace('function', 'function arent_you_funny_couch') + '\n'
if 'Object.keys' in JS:
print(field, 'contains "Object.keys" which is not available until ECMA2015')
exit(1)
Expand Down

0 comments on commit 561a208

Please sign in to comment.