Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

js-parser-combinators example 1

node v6.17.1
version: 5.0.0
endpointsharetweet
const { exhaustive, and, literal, param, optional } = require('js-parser-combinators') // A parser that can parse paths such as: // /user/1234 // /user/1234/details const parser = exhaustive( and( and( literal('/user/'), param('userid', /^\d+/, parseInt) ), optional(literal('/details')) ) ); parser({ input: '/user/1234/details' }).ast
Loading…

no comments

    sign in to comment