Comparing version 0.6.3 to 0.6.4
@@ -16,2 +16,6 @@ # Changelog | ||
# 0.6.4 | ||
- **New Feature** | ||
- add `between` and `surroundedBy` to Parser (@IMax153) | ||
# 0.6.3 | ||
@@ -18,0 +22,0 @@ |
@@ -184,2 +184,14 @@ /** | ||
/** | ||
* Matches the provided parser `p` that occurs between the provided `left` and `right` parsers. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
export declare function between<I, A>(left: Parser<I, A>, right: Parser<I, A>): (p: Parser<I, A>) => Parser<I, A>; | ||
/** | ||
* Matches the provided parser `p` that is surrounded by the `bound` parser. Shortcut for `between(bound, bound)`. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
export declare function surroundedBy<I, A>(bound: Parser<I, A>): (p: Parser<I, A>) => Parser<I, A>; | ||
/** | ||
* @since 0.6.0 | ||
@@ -186,0 +198,0 @@ */ |
@@ -237,2 +237,20 @@ var __assign = (this && this.__assign) || function () { | ||
/** | ||
* Matches the provided parser `p` that occurs between the provided `left` and `right` parsers. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
export function between(left, right) { | ||
return function (p) { | ||
return pipe(left, chain(function () { return p; }), chainFirst(function () { return right; })); | ||
}; | ||
} | ||
/** | ||
* Matches the provided parser `p` that is surrounded by the `bound` parser. Shortcut for `between(bound, bound)`. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
export function surroundedBy(bound) { | ||
return between(bound, bound); | ||
} | ||
/** | ||
* @since 0.6.0 | ||
@@ -239,0 +257,0 @@ */ |
@@ -100,4 +100,2 @@ import * as M from 'fp-ts/es6/Monoid'; | ||
*/ | ||
export var doubleQuotedString = pipe(C.char('"'), P.chain(function () { return many(P.either(string('\\"'), function () { return C.notChar('"'); })); }), P.chain(function (s) { | ||
return pipe(C.char('"'), P.chain(function () { return P.succeed(s); })); | ||
})); | ||
export var doubleQuotedString = P.surroundedBy(C.char('"'))(many(P.either(string('\\"'), function () { return C.notChar('"'); }))); |
@@ -184,2 +184,14 @@ /** | ||
/** | ||
* Matches the provided parser `p` that occurs between the provided `left` and `right` parsers. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
export declare function between<I, A>(left: Parser<I, A>, right: Parser<I, A>): (p: Parser<I, A>) => Parser<I, A>; | ||
/** | ||
* Matches the provided parser `p` that is surrounded by the `bound` parser. Shortcut for `between(bound, bound)`. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
export declare function surroundedBy<I, A>(bound: Parser<I, A>): (p: Parser<I, A>) => Parser<I, A>; | ||
/** | ||
* @since 0.6.0 | ||
@@ -186,0 +198,0 @@ */ |
@@ -257,2 +257,22 @@ "use strict"; | ||
/** | ||
* Matches the provided parser `p` that occurs between the provided `left` and `right` parsers. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
function between(left, right) { | ||
return function (p) { | ||
return pipeable_1.pipe(left, chain(function () { return p; }), chainFirst(function () { return right; })); | ||
}; | ||
} | ||
exports.between = between; | ||
/** | ||
* Matches the provided parser `p` that is surrounded by the `bound` parser. Shortcut for `between(bound, bound)`. | ||
* | ||
* @since 0.6.4 | ||
*/ | ||
function surroundedBy(bound) { | ||
return between(bound, bound); | ||
} | ||
exports.surroundedBy = surroundedBy; | ||
/** | ||
* @since 0.6.0 | ||
@@ -259,0 +279,0 @@ */ |
@@ -106,4 +106,2 @@ "use strict"; | ||
*/ | ||
exports.doubleQuotedString = pipeable_1.pipe(C.char('"'), P.chain(function () { return many(P.either(string('\\"'), function () { return C.notChar('"'); })); }), P.chain(function (s) { | ||
return pipeable_1.pipe(C.char('"'), P.chain(function () { return P.succeed(s); })); | ||
})); | ||
exports.doubleQuotedString = P.surroundedBy(C.char('"'))(many(P.either(string('\\"'), function () { return C.notChar('"'); }))); |
{ | ||
"name": "parser-ts", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"description": "String parser combinators for TypeScript", | ||
@@ -5,0 +5,0 @@ "files": [ |
77522
2601