Comparing version
@@ -15,2 +15,7 @@ # Changelog | ||
# 0.4.0 | ||
- **Breaking Change** | ||
- upgrade to latest `fp-ts` (0.6.0) (@gcanti) | ||
# 0.3.0 | ||
@@ -17,0 +22,0 @@ |
@@ -36,3 +36,3 @@ import { Monoid } from 'fp-ts/lib/Monoid'; | ||
export declare const chain: <A, B>(f: (a: A) => Parser<B>, fa: Parser<A>) => Parser<B>; | ||
export declare const alt: <A>(fx: Parser<A>) => (fy: Parser<A>) => Parser<A>; | ||
export declare const alt: <A>(fx: Parser<A>, fy: Parser<A>) => Parser<A>; | ||
export declare const zero: <A>() => Parser<A>; | ||
@@ -90,3 +90,3 @@ export declare const emptyString: Parser<string>; | ||
*/ | ||
export declare const either: <A>(fx: Parser<A>) => (fy: Parser<A>) => Parser<A>; | ||
export declare const either: <A>(fx: Parser<A>, fy: Parser<A>) => Parser<A>; | ||
/** | ||
@@ -93,0 +93,0 @@ * The `sat` parser constructor takes a predicate function, and will consume |
@@ -49,3 +49,3 @@ "use strict"; | ||
exports.chain = function (f, fa) { return fa.chain(f); }; | ||
exports.alt = function (fx) { return function (fy) { return fx.alt(fy); }; }; | ||
exports.alt = function (fx, fy) { return fx.alt(fy); }; | ||
exports.zero = function () { return exports.fail; }; | ||
@@ -164,3 +164,3 @@ exports.emptyString = exports.of(''); | ||
*/ | ||
exports.many = function (parser) { return exports.alt(exports.many1(parser).map(function (a) { return a.toArray(); }))(exports.of([])); }; | ||
exports.many = function (parser) { return exports.alt(exports.many1(parser).map(function (a) { return a.toArray(); }), exports.of([])); }; | ||
/** | ||
@@ -180,3 +180,3 @@ * The `many1` combinator is just like the `many` combinator, except it | ||
exports.sepBy = function (sep, parser) { | ||
return exports.alt(exports.sepBy1(sep, parser).map(function (a) { return a.toArray(); }))(exports.alt(parser.map(function (a) { return [a]; }))(exports.of([]))); | ||
return exports.alt(exports.sepBy1(sep, parser).map(function (a) { return a.toArray(); }), exports.alt(parser.map(function (a) { return [a]; }), exports.of([]))); | ||
}; | ||
@@ -193,3 +193,3 @@ /** Matches both parsers and return the value of the second */ | ||
exports.sepBy1 = function (sep, parser) { | ||
return parser.chain(function (head) { return exports.alt(exports.many(exports.second(sep)(parser)))(exports.of([])).chain(function (tail) { return exports.of(new NonEmptyArray_1.NonEmptyArray(head, tail)); }); }); | ||
return parser.chain(function (head) { return exports.alt(exports.many(exports.second(sep)(parser)), exports.of([])).chain(function (tail) { return exports.of(new NonEmptyArray_1.NonEmptyArray(head, tail)); }); }); | ||
}; | ||
@@ -196,0 +196,0 @@ exports.parser = { |
@@ -71,4 +71,4 @@ "use strict"; | ||
exports.doubleQuotedString = exports.doubleQuote | ||
.chain(function () { return many(p.either(string('\\"'))(c.notChar('"'))); }) | ||
.chain(function () { return many(p.either(string('\\"'), c.notChar('"'))); }) | ||
.chain(function (s) { return exports.doubleQuote.chain(function () { return p.of(s); }); }); | ||
//# sourceMappingURL=string.js.map |
{ | ||
"name": "parser-ts", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "String parser combinators for TypeScript", | ||
@@ -13,2 +13,3 @@ "files": ["lib"], | ||
"prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"", | ||
"fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test}/**/*.ts\"", | ||
"test": "npm run lint && npm run prettier && npm run typings-checker && npm run mocha", | ||
@@ -29,3 +30,3 @@ "clean": "rm -rf lib/*", | ||
"dependencies": { | ||
"fp-ts": "^0.5.1" | ||
"fp-ts": "^0.6.0" | ||
}, | ||
@@ -40,3 +41,3 @@ "devDependencies": { | ||
"tslint-config-standard": "4.0.0", | ||
"typescript": "^2.5.2", | ||
"typescript": "2.6.0-rc", | ||
"typings-checker": "1.1.2" | ||
@@ -43,0 +44,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
42657
0.45%+ Added
- Removed
Updated