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,346 lines (1,345 loc) • 321 kB
JSON
{
"type": "File",
"start": 0,
"end": 3752,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 112,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3752,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 112,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 2235,
"end": 3302,
"loc": {
"start": {
"line": 64,
"column": 0
},
"end": {
"line": 97,
"column": 1
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "FunctionDeclaration",
"start": 2242,
"end": 3302,
"loc": {
"start": {
"line": 64,
"column": 7
},
"end": {
"line": 97,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 2251,
"end": 2259,
"loc": {
"start": {
"line": 64,
"column": 16
},
"end": {
"line": 64,
"column": 24
},
"identifierName": "equality"
},
"name": "equality",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 2260,
"end": 2261,
"loc": {
"start": {
"line": 64,
"column": 25
},
"end": {
"line": 64,
"column": 26
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 2263,
"end": 2264,
"loc": {
"start": {
"line": 64,
"column": 28
},
"end": {
"line": 64,
"column": 29
},
"identifierName": "y"
},
"name": "y"
}
],
"body": {
"type": "BlockStatement",
"start": 2266,
"end": 3302,
"loc": {
"start": {
"line": 64,
"column": 31
},
"end": {
"line": 97,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 2273,
"end": 2300,
"loc": {
"start": {
"line": 65,
"column": 4
},
"end": {
"line": 65,
"column": 31
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 2279,
"end": 2299,
"loc": {
"start": {
"line": 65,
"column": 10
},
"end": {
"line": 65,
"column": 30
}
},
"id": {
"type": "Identifier",
"start": 2279,
"end": 2283,
"loc": {
"start": {
"line": 65,
"column": 10
},
"end": {
"line": 65,
"column": 14
},
"identifierName": "isXO"
},
"name": "isXO"
},
"init": {
"type": "NewExpression",
"start": 2286,
"end": 2299,
"loc": {
"start": {
"line": 65,
"column": 17
},
"end": {
"line": 65,
"column": 30
}
},
"callee": {
"type": "Identifier",
"start": 2290,
"end": 2296,
"loc": {
"start": {
"line": 65,
"column": 21
},
"end": {
"line": 65,
"column": 27
},
"identifierName": "Object"
},
"name": "Object"
},
"arguments": [
{
"type": "Identifier",
"start": 2297,
"end": 2298,
"loc": {
"start": {
"line": 65,
"column": 28
},
"end": {
"line": 65,
"column": 29
},
"identifierName": "x"
},
"name": "x"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 2306,
"end": 2333,
"loc": {
"start": {
"line": 66,
"column": 4
},
"end": {
"line": 66,
"column": 31
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 2312,
"end": 2332,
"loc": {
"start": {
"line": 66,
"column": 10
},
"end": {
"line": 66,
"column": 30
}
},
"id": {
"type": "Identifier",
"start": 2312,
"end": 2316,
"loc": {
"start": {
"line": 66,
"column": 10
},
"end": {
"line": 66,
"column": 14
},
"identifierName": "isYO"
},
"name": "isYO"
},
"init": {
"type": "NewExpression",
"start": 2319,
"end": 2332,
"loc": {
"start": {
"line": 66,
"column": 17
},
"end": {
"line": 66,
"column": 30
}
},
"callee": {
"type": "Identifier",
"start": 2323,
"end": 2329,
"loc": {
"start": {
"line": 66,
"column": 21
},
"end": {
"line": 66,
"column": 27
},
"identifierName": "Object"
},
"name": "Object"
},
"arguments": [
{
"type": "Identifier",
"start": 2330,
"end": 2331,
"loc": {
"start": {
"line": 66,
"column": 28
},
"end": {
"line": 66,
"column": 29
},
"identifierName": "y"
},
"name": "y"
}
]
}
}
],
"kind": "const"
},
{
"type": "IfStatement",
"start": 2339,
"end": 2410,
"loc": {
"start": {
"line": 67,
"column": 4
},
"end": {
"line": 69,
"column": 5
}
},
"test": {
"type": "LogicalExpression",
"start": 2343,
"end": 2367,
"loc": {
"start": {
"line": 67,
"column": 8
},
"end": {
"line": 67,
"column": 32
}
},
"left": {
"type": "BinaryExpression",
"start": 2343,
"end": 2353,
"loc": {
"start": {
"line": 67,
"column": 8
},
"end": {
"line": 67,
"column": 18
}
},
"left": {
"type": "Identifier",
"start": 2343,
"end": 2347,
"loc": {
"start": {
"line": 67,
"column": 8
},
"end": {
"line": 67,
"column": 12
},
"identifierName": "isXO"
},
"name": "isXO"
},
"operator": "!==",
"right": {
"type": "Identifier",
"start": 2352,
"end": 2353,
"loc": {
"start": {
"line": 67,
"column": 17
},
"end": {
"line": 67,
"column": 18
},
"identifierName": "x"
},
"name": "x"
}
},
"operator": "&&",
"right": {
"type": "BinaryExpression",
"start": 2357,
"end": 2367,
"loc": {
"start": {
"line": 67,
"column": 22
},
"end": {
"line": 67,
"column": 32
}
},
"left": {
"type": "Identifier",
"start": 2357,
"end": 2361,
"loc": {
"start": {
"line": 67,
"column": 22
},
"end": {
"line": 67,
"column": 26
},
"identifierName": "isYO"
},
"name": "isYO"
},
"operator": "!==",
"right": {
"type": "Identifier",
"start": 2366,
"end": 2367,
"loc": {
"start": {
"line": 67,
"column": 31
},
"end": {
"line": 67,
"column": 32
},
"identifierName": "y"
},
"name": "y"
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 2369,
"end": 2410,
"loc": {
"start": {
"line": 67,
"column": 34
},
"end": {
"line": 69,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 2380,
"end": 2403,
"loc": {
"start": {
"line": 68,
"column": 8
},
"end": {
"line": 68,
"column": 31
}
},
"argument": {
"type": "CallExpression",
"start": 2387,
"end": 2402,
"loc": {
"start": {
"line": 68,
"column": 15
},
"end": {
"line": 68,
"column": 30
}
},
"callee": {
"type": "MemberExpression",
"start": 2387,
"end": 2396,
"loc": {
"start": {
"line": 68,
"column": 15
},
"end": {
"line": 68,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 2387,
"end": 2393,
"loc": {
"start": {
"line": 68,
"column": 15
},
"end": {
"line": 68,
"column": 21
},
"identifierName": "Object"
},
"name": "Object"
},
"property": {
"type": "Identifier",
"start": 2394,
"end": 2396,
"loc": {
"start": {
"line": 68,
"column": 22
},
"end": {
"line": 68,
"column": 24
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 2397,
"end": 2398,
"loc": {
"start": {
"line": 68,
"column": 25
},
"end": {
"line": 68,
"column": 26
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 2400,
"end": 2401,
"loc": {
"start": {
"line": 68,
"column": 28
},
"end": {
"line": 68,
"column": 29
},
"identifierName": "y"
},
"name": "y"
}
]
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "IfStatement",
"start": 2416,
"end": 3299,
"loc": {
"start": {
"line": 70,
"column": 4
},
"end": {
"line": 96,
"column": 5
}
},
"test": {
"type": "LogicalExpression",
"start": 2420,
"end": 2444,
"loc": {
"start": {
"line": 70,
"column": 8
},
"end": {
"line": 70,
"column": 32
}
},
"left": {
"type": "BinaryExpression",
"start": 2420,
"end": 2430,
"loc": {
"start": {
"line": 70,
"column": 8
},
"end": {
"line": 70,
"column": 18
}
},
"left": {
"type": "Identifier",
"start": 2420,
"end": 2424,
"loc": {
"start": {
"line": 70,
"column": 8
},
"end": {
"line": 70,
"column": 12
},
"identifierName": "isXO"
},
"name": "isXO"
},
"operator": "===",
"right": {
"type": "Identifier",
"start": 2429,
"end": 2430,
"loc": {
"start": {
"line": 70,
"column": 17
},
"end": {
"line": 70,
"column": 18
},
"identifierName": "x"
},
"name": "x"
}
},
"operator": "&&",
"right": {
"type": "BinaryExpression",
"start": 2434,
"end": 2444,
"loc": {
"start": {
"line": 70,
"column": 22
},
"end": {
"line": 70,
"column": 32
}
},
"left": {
"type": "Identifier",
"start": 2434,
"end": 2438,
"loc": {
"start": {
"line": 70,
"column": 22
},
"end": {
"line": 70,
"column": 26
},
"identifierName": "isYO"
},
"name": "isYO"
},
"operator": "===",
"right": {
"type": "Identifier",
"start": 2443,
"end": 2444,
"loc": {
"start": {
"line": 70,
"column": 31
},
"end": {
"line": 70,
"column": 32
},
"identifierName": "y"
},
"name": "y"
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 2446,
"end": 3257,
"loc": {
"start": {
"line": 70,
"column": 34
},
"end": {
"line": 93,
"column": 5
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 2457,
"end": 2482,
"loc": {
"start": {
"line": 71,
"column": 8
},
"end": {
"line": 71,
"column": 33
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 2463,
"end": 2481,
"loc": {
"start": {
"line": 71,
"column": 14
},
"end": {
"line": 71,
"column": 32
}
},
"id": {
"type": "Identifier",
"start": 2463,
"end": 2465,
"loc": {
"start": {
"line": 71,
"column": 14
},
"end": {
"line": 71,
"column": 16
},
"identifierName": "xN"
},
"name": "xN"
},
"init": {
"type": "MemberExpression",
"start": 2468,
"end": 2481,
"loc": {
"start": {
"line": 71,
"column": 19
},
"end": {
"line": 71,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 2468,
"end": 2469,
"loc": {
"start": {
"line": 71,
"column": 19
},
"end": {
"line": 71,
"column": 20
},
"identifierName": "x"
},
"name": "x"
},
"property": {
"type": "Identifier",
"start": 2470,
"end": 2481,
"loc": {
"start": {
"line": 71,
"column": 21
},
"end": {
"line": 71,
"column": 32
},
"identifierName": "constructor"
},
"name": "constructor"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 2492,
"end": 2517,
"loc": {
"start": {
"line": 72,
"column": 8
},
"end": {
"line": 72,
"column": 33
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 2498,
"end": 2516,
"loc": {
"start": {
"line": 72,
"column": 14
},
"end": {
"line": 72,
"column": 32
}
},
"id": {
"type": "Identifier",
"start": 2498,
"end": 2500,
"loc": {
"start": {
"line": 72,
"column": 14
},
"end": {
"line": 72,
"column": 16
},
"identifierName": "yN"
},
"name": "yN"
},
"init": {
"type": "MemberExpression",
"start": 2503,
"end": 2516,
"loc": {
"start": {
"line": 72,
"column": 19
},
"end": {
"line": 72,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 2503,
"end": 2504,
"loc": {
"start": {
"line": 72,
"column": 19
},
"end": {
"line": 72,
"column": 20
},
"identifierName": "y"
},
"name": "y"
},
"property": {
"type": "Identifier",
"start": 2505,
"end": 2516,
"loc": {
"start": {
"line": 72,
"column": 21
},
"end": {
"line": 72,
"column": 32
},
"identifierName": "constructor"
},
"name": "constructor"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "IfStatement",
"start": 2527,
"end": 3250,
"loc": {
"start": {
"line": 73,
"column": 8
},
"end": {
"line": 92,
"column": 9
}
},
"test": {
"type": "BinaryExpression",
"start": 2531,
"end": 2540,
"loc": {
"start": {
"line": 73,
"column": 12
},
"end": {
"line": 73,
"column": 21
}
},
"left": {
"type": "Identifier",
"start": 2531,
"end": 2533,
"loc": {
"start": {
"line": 73,
"column": 12
},
"end": {
"line": 73,
"column": 14
},
"identifierName": "xN"
},
"name": "xN"
},
"operator": "===",
"right": {
"type": "Identifier",
"start": 2538,
"end": 2540,
"loc": {
"start": {
"line": 73,
"column": 19
},
"end": {
"line": 73,
"column": 21
},
"identifierName": "yN"
},
"name": "yN"
}
},
"consequent": {
"type": "BlockStatement",
"start": 2542,
"end": 3196,
"loc": {
"start": {
"line": 73,
"column": 23
},
"end": {
"line": 89,
"column": 9
}
},
"body": [
{
"type": "IfStatement",
"start": 2557,
"end": 3185,
"loc": {
"start": {
"line": 74,
"column": 12
},
"end": {
"line": 88,
"column": 13
}
},
"test": {
"type": "LogicalExpression",
"start": 2561,
"end": 2589,
"loc": {
"start": {
"line": 74,
"column": 16
},
"end": {
"line": 74,
"column": 44
}
},
"left": {
"type": "BinaryExpression",
"start": 2561,
"end": 2573,
"loc": {
"start": {
"line": 74,
"column": 16
},
"end": {
"line": 74,
"column": 28
}
},
"left": {
"type": "Identifier",
"start": 2561,
"end": 2563,
"loc": {
"start": {
"line": 74,
"column": 16
},
"end": {
"line": 74,
"column": 18
},
"identifierName": "xN"
},
"name": "xN"
},
"operator": "===",
"right": {
"type": "Identifier",
"start": 2568,
"end": 2573,
"loc": {
"start": {
"line": 74,
"column": 23
},
"end": {
"line": 74,
"column": 28
},
"identifierName": "Array"
},
"name": "Array"
}
},
"operator": "&&",
"right": {
"type": "BinaryExpression",
"start": 2577,
"end": 2589,
"loc": {
"start": {
"line": 74,
"column": 32
},
"end": {
"line": 74,
"column": 44
}
},
"left": {
"type": "Identifier",
"start": 2577,
"end": 2579,
"loc": {
"start": {
"line": 74,
"column": 32
},
"end": {
"line": 74,
"column": 34
},
"identifierName": "yN"
},
"name": "yN"
},
"operator": "===",
"right": {
"type": "Identifier",
"start": 2584,
"end": 2589,
"loc": {
"start": {
"line": 74,
"column": 39
},
"end": {
"line": 74,
"column": 44
},
"identifierName": "Array"
},
"name": "Array"
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 2591,
"end": 2685,
"loc": {
"start": {
"line": 74,
"column": 46
},
"end": {
"line": 76,
"column": 13
}
},
"body": [
{
"type": "ReturnStatement",
"start": 2610,
"end": 2670,
"loc": {
"start": {
"line": 75,
"column": 16
},
"end": {
"line": 75,
"column": 76
}
},
"argument": {
"type": "ConditionalExpression",
"start": 2617,
"end": 2669,
"loc": {
"start": {
"line": 75,
"column": 23
},
"end": {
"line": 75,
"column": 75
}
},
"test": {
"type": "BinaryExpression",
"start": 2617,
"end": 2638,
"loc": {
"start": {
"line": 75,
"column": 23
},
"end": {
"line": 75,
"column": 44
}
},
"left": {
"type": "MemberExpression",
"start": 2617,
"end": 2625,
"loc": {
"start": {
"line": 75,
"column": 23
},
"end": {
"line": 75,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 2617,
"end": 2618,
"loc": {
"start": {
"line": 75,
"column": 23
},
"end": {
"line": 75,
"column": 24
},
"identifierName": "x"
},
"name": "x"
},
"property": {
"type": "Identifier",
"start": 2619,
"end": 2625,
"loc": {
"start": {
"line": 75,
"column": 25
},
"end": {
"line": 75,
"column": 31
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
},
"operator": "!==",
"right": {
"type": "MemberExpression",
"start": 2630,
"end": 2638,
"loc": {
"start": {
"line": 75,
"column": 36
},
"end": {
"line": 75,
"column": 44
}
},
"object": {
"type": "Identifier",
"start": 2630,
"end": 2631,
"loc": {
"start": {
"line": 75,
"column": 36
},
"end": {
"line": 75,
"column": 37
},
"identifierName": "y"
},
"name": "y"
},
"property": {
"type": "Identifier",
"start": 2632,
"end": 2638,
"loc": {
"start": {
"line": 75,
"column": 38
},
"end": {
"line": 75,
"column": 44
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
}
},
"consequent": {
"type": "BooleanLiteral",
"start": 2641,
"end": 2646,
"loc": {
"start": {
"line": 75,
"column": 47
},
"end": {
"line": 75,
"column": 52
}
},
"value": false
},
"alternate": {
"type": "CallExpression",
"start": 2649,
"end": 2669,
"loc": {
"start": {
"line": 75,
"column": 55
},
"end": {
"line": 75,
"column": 75
}
},
"callee": {
"type": "Identifier",