parsnip-ts
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

🌱 Parsnip-ts

Parser combinators written in and for TypeScript.

Getting Started

Installation

npm install parsnip-ts

Example

import { list, text } from 'parsnip-ts'
import { integer } from 'parsnip-ts/numbers'
import { ws } from 'parsnip-ts/whitespace'

const array = text('[')
  .and(list(integer, ws.and(text(',').and(ws)))
  .bind(integers =>
    text(']').map(() => integers)
  )

array.parseToEnd('[1, 2, 3]') // [1, 2, 3]

For a more thorough example, check out the examples folder.

Package Sidebar

Install

npm i parsnip-ts

Weekly Downloads

1

Version

1.2.1

License

MIT

Unpacked Size

64.2 kB

Total Files

42

Last publish

Collaborators

  • mcluck