How to use the pegjs.util function in pegjs

To help you get started, we’ve selected a few pegjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pegjs / pegjs / test / api / pegjs-util.spec.js View on Github external
it( "should iterate over an objects properties", function () {

            const size = Object.keys( util ).length;
            const entries = [];

            util.each( util, ( value, key ) => {

                entries.push( { key, value } );

            } );

            expect( entries.length ).to.equal( size );

            entries.forEach( entry => {

                expect( util )
                    .to.have.ownProperty( entry.key )
                    .which.equals( entry.value );
github pegjs / pegjs / test / api / pegjs-util.spec.js View on Github external
it( "cloned properties refrence same value", function () {

            expect( util.clone( meta ) )
                .to.haveOwnProperty( "util" )
                .that.is.a( "object" )
                .which.equals( util );

        } );