Socket
Socket
Sign inDemoInstall

@appliedblockchain/parser-combinators

Package Overview
Dependencies
Maintainers
15
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appliedblockchain/parser-combinators - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

test/while-char.test.js

4

exhaustive-result.js

@@ -5,3 +5,5 @@ // @flow

const exhaustiveResult /*: <R>(string => [string, R]) => R */ = /*:: <R> */
/*:: import type { Parser } from './types/parser' */
const exhaustiveResult /*: <R>(Parser<R>) => (string => R) */ = /*:: <R> */
(a) =>

@@ -8,0 +10,0 @@ input => {

{
"name": "@appliedblockchain/parser-combinators",
"version": "1.1.0",
"version": "2.0.0",
"description": "Monadic parser combinators.",

@@ -20,4 +20,4 @@ "main": "index.js",

"eslint": "6.8.0",
"flow-bin": "0.120.1",
"jest": "25.1.0"
"flow-bin": "0.122.0",
"jest": "25.2.7"
},

@@ -24,0 +24,0 @@ "eslintConfig": {

// @flow
/*:: import type { Parser as P } from './types/Parser' */
const { inspect } = require('util')
const Invalid = require('./invalid')
const whileChar /*: (string => boolean) => P<string> */ =
f =>
/*:: import type { Parser } from './types/parser' */
const whileChar /*: (string, min?: number) => Parser<string> */ =
(chars, min = 0) =>
input => {
let i
for (i = 0; i < input.length; i++) {
if (!f(input[0])) {
if (!chars.includes(input[i])) {
break
}
}
if (i < min) {
throw new Invalid(`Expected ${min} minimum characters passing predicate, character ${inspect(input[i])} didn't pass.`)
}
return [ input.slice(i), input.slice(0, i) ]

@@ -15,0 +21,0 @@ }

@@ -6,4 +6,4 @@ // @flow

const ws0 =
whileChar(_ => _ === '\x20' || _ === '\x0a' || _ === '\x0d' || _ === '\x09')
whileChar(' \t\r\n')
module.exports = ws0
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc