node-json-criteria icon indicating copy to clipboard operation
node-json-criteria copied to clipboard

Doesn't blend well with nodejs

Open mbell8903 opened this issue 9 years ago • 7 comments

I have a fairly complex nodejs script that i am trying to integrate this into, however I cannot get this to work at all in it. I added the require('babel/register') as the first line of my script, but my node script pretty much dies after that. I tried removing that line and i get the following error: [ReferenceError: regeneratorRuntime is not defined]. Any idea as to what is going on? Is there a version of this that is pure JS for use with Node v0.12?

mbell8903 avatar Jun 16 '15 20:06 mbell8903

Have you tried require("babel/polyfill"); instead at entry point of your script?

mirek avatar Jun 17 '15 00:06 mirek

I was using this just now and this is what is required to have it run.

npm install --save babel-polyfill
npm install --save babel-register
npm install --save json-criteria
require("babel-polyfill");
require("babel-register");
var jc = require('json-criteria');

Very helpful library, by the way.

dremekie avatar May 18 '16 19:05 dremekie

Might also be worth looking at the https://github.com/bebraw/grunt-umd so the module plays nice without babel. Happy to PR this as well

kav avatar Aug 01 '18 22:08 kav

Yes, I'd like to modernize it a bit. I think we could drop babel completely now.

mirek avatar Aug 01 '18 22:08 mirek

Modernizing this (dropping babel) would make this awesome library much more easier to install & use. 👍

shomali11 avatar Mar 30 '21 21:03 shomali11

Modernizing this (dropping babel) would make this awesome library much more easier to install & use. 👍

True, for now you may be interested in alternative https://github.com/appliedblockchain/assert-combinators - it works very well with typescript providing runtime type assertion, good for test assertions and normal code to bring untyped data into typed on the IO boundaries (whenever things like JSON.parse appear).

mirek avatar Mar 31 '21 05:03 mirek

One of the fork already remove Babel: https://github.com/Manny27nyc/node-couchdb-query-engine/commit/cbe121bf1bcb1716f0a4e47ee346af8bbfc7980e

Abdillah avatar May 07 '23 12:05 Abdillah