Skip to content

spaces

spaces(): Parser

Parses zero or more ASCII whitespace characters and discards them.

ASCII whitespace characters include any ASCII newline (\r, \n, or \r\n) along with a space () or a horizontal tab (\t).

Example

const parser = spaces()

const s = parse(parser, '   abc')
console.log(status(s))  // "ok"
console.log(success(s)) // null

Success

  • Always succeeds. All ASCII whitespace characters until the next non-whitespace character are consumed and discarded.

See Also