Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parser-ts

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parser-ts - npm Package Compare versions

Comparing version 0.6.11 to 0.6.12

6

CHANGELOG.md

@@ -16,2 +16,8 @@ # Changelog

# 0.6.12
- **Bug Fix**
- fix `ChainRec` implementation for `Parser` (@IMax153)
- fix `string` parser exceeding recursion limit on long strings, closes #41 (@IMax153)
# 0.6.11

@@ -18,0 +24,0 @@

12

es6/Parser.js

@@ -422,9 +422,9 @@ var __assign = (this && this.__assign) || function () {

var chainRec_ = function (a, f) {
var split = function (result) {
var split = function (start) { return function (result) {
return E.isLeft(result.value)
? E.left({ value: result.value.left, stream: result.next })
: E.right(success(result.value.right, result.next, result.start));
};
return function (i) {
return tailRec({ value: a, stream: i }, function (state) {
: E.right(success(result.value.right, result.next, start));
}; };
return function (start) {
return tailRec({ value: a, stream: start }, function (state) {
var result = f(state.value)(state.stream);

@@ -434,3 +434,3 @@ if (E.isLeft(result)) {

}
return split(result.right);
return split(start)(result.right);
});

@@ -437,0 +437,0 @@ };

@@ -0,1 +1,2 @@

import * as E from 'fp-ts/Either';
import * as M from 'fp-ts/es6/Monoid';

@@ -16,8 +17,7 @@ import * as O from 'fp-ts/es6/Option';

export var string = function (s) {
var _string = function (s2) {
return pipe(charAt(0, s2), O.fold(function () { return P.succeed(''); }, function (c) {
return pipe(C.char(c), P.chain(function () { return _string(s2.slice(1)); }), P.chain(function () { return P.succeed(s); }));
return P.expected(P.ChainRec.chainRec(s, function (acc) {
return pipe(charAt(0, acc), O.fold(function () { return P.of(E.right(s)); }, function (c) {
return pipe(C.char(c), P.chain(function () { return P.of(E.left(acc.slice(1))); }));
}));
};
return P.expected(_string(s), JSON.stringify(s));
}), JSON.stringify(s));
};

@@ -24,0 +24,0 @@ export function oneOf(F) {

@@ -431,9 +431,9 @@ "use strict";

var chainRec_ = function (a, f) {
var split = function (result) {
var split = function (start) { return function (result) {
return E.isLeft(result.value)
? E.left({ value: result.value.left, stream: result.next })
: E.right(ParseResult_1.success(result.value.right, result.next, result.start));
};
return function (i) {
return ChainRec_1.tailRec({ value: a, stream: i }, function (state) {
: E.right(ParseResult_1.success(result.value.right, result.next, start));
}; };
return function (start) {
return ChainRec_1.tailRec({ value: a, stream: start }, function (state) {
var result = f(state.value)(state.stream);

@@ -443,3 +443,3 @@ if (E.isLeft(result)) {

}
return split(result.right);
return split(start)(result.right);
});

@@ -446,0 +446,0 @@ };

@@ -10,2 +10,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var E = __importStar(require("fp-ts/Either"));
var M = __importStar(require("fp-ts/lib/Monoid"));

@@ -26,8 +27,7 @@ var O = __importStar(require("fp-ts/lib/Option"));

exports.string = function (s) {
var _string = function (s2) {
return pipeable_1.pipe(charAt(0, s2), O.fold(function () { return P.succeed(''); }, function (c) {
return pipeable_1.pipe(C.char(c), P.chain(function () { return _string(s2.slice(1)); }), P.chain(function () { return P.succeed(s); }));
return P.expected(P.ChainRec.chainRec(s, function (acc) {
return pipeable_1.pipe(charAt(0, acc), O.fold(function () { return P.of(E.right(s)); }, function (c) {
return pipeable_1.pipe(C.char(c), P.chain(function () { return P.of(E.left(acc.slice(1))); }));
}));
};
return P.expected(_string(s), JSON.stringify(s));
}), JSON.stringify(s));
};

@@ -34,0 +34,0 @@ function oneOf(F) {

{
"name": "parser-ts",
"version": "0.6.11",
"version": "0.6.12",
"description": "String parser combinators for TypeScript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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