UNPKG

monad-ts

Version:

Monad-ts is a small library implements some of key monads and way to chain them in a pipe (flow) in JavaScript and TypeScript. Angular 2+ compatible.

1,962 lines (1,961 loc) 56.6 kB
{ "type": "File", "start": 0, "end": 1111, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1111, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportNamedDeclaration", "start": 83, "end": 1049, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 40, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 90, "end": 1049, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 40, "column": 1 } }, "id": { "type": "Identifier", "start": 96, "end": 101, "loc": { "start": { "line": 6, "column": 13 }, "end": { "line": 6, "column": 18 }, "identifierName": "Monad" }, "name": "Monad", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 102, "end": 1049, "loc": { "start": { "line": 6, "column": 19 }, "end": { "line": 40, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 401, "end": 444, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 401, "end": 405, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 8 }, "identifierName": "bind" }, "name": "bind", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 406, "end": 407, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 10 }, "identifierName": "f" }, "name": "f" }, { "type": "Identifier", "start": 409, "end": 410, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 13 }, "identifierName": "v" }, "name": "v" } ], "body": { "type": "BlockStatement", "start": 412, "end": 444, "loc": { "start": { "line": 15, "column": 15 }, "end": { "line": 17, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 423, "end": 437, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 22 } }, "argument": { "type": "UnaryExpression", "start": 430, "end": 436, "loc": { "start": { "line": 16, "column": 15 }, "end": { "line": 16, "column": 21 } }, "operator": "void", "prefix": true, "argument": { "type": "NumericLiteral", "start": 435, "end": 436, "loc": { "start": { "line": 16, "column": 20 }, "end": { "line": 16, "column": 21 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, "extra": { "parenthesizedArgument": false } } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Binds transformation function and underlying value to the monad.\r\n * @method bind\r\n * @param {MF<T, U> | D<T>} f - transformation function.\r\n * @param v - underlying value.\r\n * @return {Promise<U> | Pr<U> | Error | boolean | void}\r\n * @abstract\r\n ", "start": 109, "end": 395, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 14, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 641, "end": 712, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 28, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 641, "end": 645, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 8 }, "identifierName": "fail" }, "name": "fail", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 646, "end": 647, "loc": { "start": { "line": 26, "column": 9 }, "end": { "line": 26, "column": 10 }, "identifierName": "e" }, "name": "e" } ], "body": { "type": "BlockStatement", "start": 649, "end": 712, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 28, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 660, "end": 705, "loc": { "start": { "line": 27, "column": 8 }, "end": { "line": 27, "column": 53 } }, "argument": { "type": "ConditionalExpression", "start": 667, "end": 704, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 52 } }, "test": { "type": "BinaryExpression", "start": 667, "end": 685, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 33 } }, "left": { "type": "Identifier", "start": 667, "end": 668, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 16 }, "identifierName": "e" }, "name": "e" }, "operator": "instanceof", "right": { "type": "Identifier", "start": 680, "end": 685, "loc": { "start": { "line": 27, "column": 28 }, "end": { "line": 27, "column": 33 }, "identifierName": "Error" }, "name": "Error" } }, "consequent": { "type": "Identifier", "start": 688, "end": 689, "loc": { "start": { "line": 27, "column": 36 }, "end": { "line": 27, "column": 37 }, "identifierName": "e" }, "name": "e" }, "alternate": { "type": "NewExpression", "start": 692, "end": 704, "loc": { "start": { "line": 27, "column": 40 }, "end": { "line": 27, "column": 52 } }, "callee": { "type": "Identifier", "start": 696, "end": 701, "loc": { "start": { "line": 27, "column": 44 }, "end": { "line": 27, "column": 49 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "Identifier", "start": 702, "end": 703, "loc": { "start": { "line": 27, "column": 50 }, "end": { "line": 27, "column": 51 }, "identifierName": "e" }, "name": "e" } ] } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Takes Error or string return Error.\r\n * @method fail\r\n * @param {Error | string} e - Error obj. or string.\r\n * @return {Error}\r\n * @protected\r\n ", "start": 457, "end": 635, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 25, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Produces result after execution f(v).\r\n * @method just\r\n * @param {function(v: T) => Pr<U>} f - transformation function for a monad.\r\n * @param {T} v - underlying value.\r\n * @return {Pr<U>} extracts transformed value by f(v).\r\n * @protected\r\n ", "start": 718, "end": 999, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 36, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1005, "end": 1046, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 39, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1005, "end": 1009, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 37, "column": 8 }, "identifierName": "just" }, "name": "just", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1010, "end": 1011, "loc": { "start": { "line": 37, "column": 9 }, "end": { "line": 37, "column": 10 }, "identifierName": "f" }, "name": "f" }, { "type": "Identifier", "start": 1013, "end": 1014, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 13 }, "identifierName": "v" }, "name": "v" } ], "body": { "type": "BlockStatement", "start": 1016, "end": 1046, "loc": { "start": { "line": 37, "column": 15 }, "end": { "line": 39, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1027, "end": 1039, "loc": { "start": { "line": 38, "column": 8 }, "end": { "line": 38, "column": 20 } }, "argument": { "type": "CallExpression", "start": 1034, "end": 1038, "loc": { "start": { "line": 38, "column": 15 }, "end": { "line": 38, "column": 19 } }, "callee": { "type": "Identifier", "start": 1034, "end": 1035, "loc": { "start": { "line": 38, "column": 15 }, "end": { "line": 38, "column": 16 }, "identifierName": "f" }, "name": "f" }, "arguments": [ { "type": "Identifier", "start": 1036, "end": 1037, "loc": { "start": { "line": 38, "column": 17 }, "end": { "line": 38, "column": 18 }, "identifierName": "v" }, "name": "v" } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Produces result after execution f(v).\r\n * @method just\r\n * @param {function(v: T) => Pr<U>} f - transformation function for a monad.\r\n * @param {T} v - underlying value.\r\n * @return {Pr<U>} extracts transformed value by f(v).\r\n * @protected\r\n ", "start": 718, "end": 999, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 36, "column": 7 } } } ] } ], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Class Monad - Base abstract class.\r\n * @implements {M}\r\n * @abstract\r\n ", "start": 0, "end": 81, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ], "trailingComments": [ { "type": "CommentLine", "value": "Copyright (c) 2017 Alex Tranchenko. All rights reserved.", "start": 1051, "end": 1109, "loc": { "start": { "line": 41, "column": 0 }, "end": { "line": 41, "column": 58 } } } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Class Monad - Base abstract class.\r\n * @implements {M}\r\n * @abstract\r\n ", "start": 0, "end": 81, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ], "trailingComments": [ { "type": "CommentLine", "value": "Copyright (c) 2017 Alex Tranchenko. All rights reserved.", "start": 1051, "end": 1109, "loc": { "start": { "line": 41, "column": 0 }, "end": { "line": 41, "column": 58 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\r\n * Class Monad - Base abstract class.\r\n * @implements {M}\r\n * @abstract\r\n ", "start": 0, "end": 81, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": "CommentBlock", "value": "*\r\n * Binds transformation function and underlying value to the monad.\r\n * @method bind\r\n * @param {MF<T, U> | D<T>} f - transformation function.\r\n * @param v - underlying value.\r\n * @return {Promise<U> | Pr<U> | Error | boolean | void}\r\n * @abstract\r\n ", "start": 109, "end": 395, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 14, "column": 7 } } }, { "type": "CommentBlock", "value": "*\r\n * Takes Error or string return Error.\r\n * @method fail\r\n * @param {Error | string} e - Error obj. or string.\r\n * @return {Error}\r\n * @protected\r\n ", "start": 457, "end": 635, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 25, "column": 7 } } }, { "type": "CommentBlock", "value": "*\r\n * Produces result after execution f(v).\r\n * @method just\r\n * @param {function(v: T) => Pr<U>} f - transformation function for a monad.\r\n * @param {T} v - underlying value.\r\n * @return {Pr<U>} extracts transformed value by f(v).\r\n * @protected\r\n ", "start": 718, "end": 999, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 36, "column": 7 } } }, { "type": "CommentLine", "value": "Copyright (c) 2017 Alex Tranchenko. All rights reserved.", "start": 1051, "end": 1109, "loc": { "start": { "line": 41, "column": 0 }, "end": { "line": 41, "column": 58 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\r\n * Class Monad - Base abstract class.\r\n * @implements {M}\r\n * @abstract\r\n ", "start": 0, "end": 81, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 83, "end": 89, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 6 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 90, "end": 95, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 12 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Monad", "start": 96, "end": 101, "loc": { "start": { "line": 6, "column": 13 }, "end": { "line": 6, "column": 18 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 102, "end": 103, "loc": { "start": { "line": 6, "column": 19 }, "end": { "line": 6, "column": 20 } } }, { "type": "CommentBlock", "value": "*\r\n * Binds transformation function and underlying value to the monad.\r\n * @method bind\r\n * @param {MF<T, U> | D<T>} f - transformation function.\r\n * @param v - underlying value.\r\n * @return {Promise<U> | Pr<U> | Error | boolean | void}\r\n * @abstract\r\n ", "start": 109, "end": 395, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 14, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "bind", "start": 401, "end": 405, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 8 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 405, "end": 406, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "f", "start": 406, "end": 407, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 10 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 407, "end": 408, "loc": { "start": { "line": 15, "column": 10 }, "end": { "line": 15, "column": 11 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "v", "start": 409, "end": 410, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 13 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 410, "end": 411, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 14 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 412, "end": 413, "loc": { "start": { "line": 15, "column": 15 }, "end": { "line": 15, "column": 16 } } }, { "type": { "label": "return", "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "return", "start": 423, "end": 429, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 14 } } }, { "type": { "label": "void", "keyword": "void", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": true, "postfix": false, "binop": null, "updateContext": null }, "value": "void", "start": 430, "end": 434, "loc": { "start": { "line": 16, "column": 15 }, "end": { "line": 16, "column": 19 } } }, { "type": { "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": 0, "start": 435, "end": 436, "loc": { "start": { "line": 16, "column": 20 }, "end": { "line": 16, "column": 21 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 436, "end": 437, "loc": { "start": { "line": 16, "column": 21 }, "end": { "line": 16, "column": 22 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 443, "end": 444, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 5 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 450, "end": 451, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 5 } } }, { "type": "CommentBlock", "value": "*\r\n * Takes Error or string return Error.\r\n * @method fail\r\n * @param {Error | string} e - Error obj. or string.\r\n * @return {Error}\r\n * @protected\r\n ", "start": 457, "end": 635, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 25, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "fail", "start": 641, "end": 645, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 8 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 645, "end": 646, "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "e", "start": 646, "end": 647, "loc": { "start": { "line": 26, "column": 9 }, "end": { "line": 26, "column": 10 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 647, "end": 648, "loc": { "start": { "line": 26, "column": 10 }, "end": { "line": 26, "column": 11 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 649, "end": 650, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 13 } } }, { "type": { "label": "return", "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "return", "start": 660, "end": 666, "loc": { "start": { "line": 27, "column": 8 }, "end": { "line": 27, "column": 14 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "e", "start": 667, "end": 668, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 16 } } }, { "type": { "label": "instanceof", "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": 7, "updateContext": null }, "value": "instanceof", "start": 669, "end": 679, "loc": { "start": { "line": 27, "column": 17 }, "end": { "line": 27, "column": 27 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Error", "start": 680, "end": 685, "loc": { "start": { "line": 27, "column": 28 }, "end": { "line": 27, "column": 33 } } }, { "type": { "label": "?", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 686, "end": 687, "loc": { "start": { "line": 27, "column": 34 }, "end": { "line": 27, "column": 35 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "e", "start": 688, "end": 689, "loc": { "start": { "line": 27, "column": 36 }, "end": { "line": 27, "column": 37 } } }, { "type": { "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 690, "end": 691, "loc": { "start": { "line": 27, "column": 38 }, "end": { "line": 27, "column": 39 } } }, { "type": { "label": "new", "keyword": "new", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "new", "start": 692, "end": 695, "loc": { "start": { "line": 27, "column": 40 }, "end": { "line": 27, "column": 43 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Error", "start": 696, "end": 701, "loc": { "start": { "line": 27, "column": 44 }, "end": { "line": 27, "column": 49 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 701, "end": 702, "loc": { "start": { "line": 27, "column": 49 }, "end": { "line": 27, "column": 50 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "e", "start": 702, "end": 703, "loc": { "start": { "line": 27, "column": 50 }, "end": { "line": 27, "column": 51 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 703, "end": 704, "loc": { "start": { "line": 27, "column": 51 }, "end": { "line": 27, "column": 52 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 704, "end": 705, "loc": { "start": { "line": 27, "column": 52 }, "end": { "line": 27, "column": 53 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 711, "end": 712, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 5 } } }, { "type": "CommentBlock", "value": "*\r\n * Produces result after execution f(v).\r\n * @method just\r\n * @param {function(v: T) => Pr<U>} f - transformation function for a monad.\r\n * @param {T} v - underlying value.\r\n * @return {Pr<U>} extracts transformed value by f(v).\r\n * @protected\r\n ", "start": 718, "end": 999, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 36, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "just", "start": 1005, "end": 1009, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 37, "column": 8 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 1009, "end": 1010, "loc": { "start": { "line": 37, "column": 8 }, "end": { "line": 37, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "f", "start": 1010, "end": 1011, "loc": { "start": { "line": 37, "column": 9 }, "end": { "line": 37, "column": 10 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 1011, "end": 1012, "loc": {