roc
Version:
Build modern web applications easily
1,550 lines (1,549 loc) • 316 kB
JSON
{
"type": "Program",
"start": 0,
"end": 6066,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 230,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 37
}
},
"specifiers": [],
"source": {
"type": "Literal",
"start": 7,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 36
}
},
"value": "source-map-support/register",
"rawValue": "source-map-support/register",
"raw": "'source-map-support/register'"
}
},
{
"type": "ImportDeclaration",
"start": 39,
"end": 227,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 9,
"column": 16
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 50,
"end": 74,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 26
}
},
"imported": {
"type": "Identifier",
"start": 50,
"end": 57,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 9
}
},
"name": "isArray"
},
"local": {
"type": "Identifier",
"start": 61,
"end": 74,
"loc": {
"start": {
"line": 4,
"column": 13
},
"end": {
"line": 4,
"column": 26
}
},
"name": "lodashIsArray"
}
},
{
"type": "ImportSpecifier",
"start": 78,
"end": 104,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 28
}
},
"imported": {
"type": "Identifier",
"start": 78,
"end": 86,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 10
}
},
"name": "isString"
},
"local": {
"type": "Identifier",
"start": 90,
"end": 104,
"loc": {
"start": {
"line": 5,
"column": 14
},
"end": {
"line": 5,
"column": 28
}
},
"name": "lodashIsString"
}
},
{
"type": "ImportSpecifier",
"start": 108,
"end": 136,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 30
}
},
"imported": {
"type": "Identifier",
"start": 108,
"end": 117,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 11
}
},
"name": "isBoolean"
},
"local": {
"type": "Identifier",
"start": 121,
"end": 136,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 6,
"column": 30
}
},
"name": "lodashIsBoolean"
}
},
{
"type": "ImportSpecifier",
"start": 140,
"end": 176,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 38
}
},
"imported": {
"type": "Identifier",
"start": 140,
"end": 153,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 15
}
},
"name": "isPlainObject"
},
"local": {
"type": "Identifier",
"start": 157,
"end": 176,
"loc": {
"start": {
"line": 7,
"column": 19
},
"end": {
"line": 7,
"column": 38
}
},
"name": "lodashIsPlainObject"
}
},
{
"type": "ImportSpecifier",
"start": 180,
"end": 210,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 32
}
},
"imported": {
"type": "Identifier",
"start": 180,
"end": 190,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 12
}
},
"name": "isFunction"
},
"local": {
"type": "Identifier",
"start": 194,
"end": 210,
"loc": {
"start": {
"line": 8,
"column": 16
},
"end": {
"line": 8,
"column": 32
}
},
"name": "lodashIsFunction"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 218,
"end": 226,
"loc": {
"start": {
"line": 9,
"column": 7
},
"end": {
"line": 9,
"column": 15
}
},
"value": "lodash",
"rawValue": "lodash",
"raw": "'lodash'"
}
},
{
"type": "ImportDeclaration",
"start": 229,
"end": 266,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 11,
"column": 37
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 238,
"end": 245,
"loc": {
"start": {
"line": 11,
"column": 9
},
"end": {
"line": 11,
"column": 16
}
},
"imported": {
"type": "Identifier",
"start": 238,
"end": 245,
"loc": {
"start": {
"line": 11,
"column": 9
},
"end": {
"line": 11,
"column": 16
}
},
"name": "isValid"
},
"local": {
"type": "Identifier",
"start": 238,
"end": 245,
"loc": {
"start": {
"line": 11,
"column": 9
},
"end": {
"line": 11,
"column": 16
}
},
"name": "isValid"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 253,
"end": 265,
"loc": {
"start": {
"line": 11,
"column": 24
},
"end": {
"line": 11,
"column": 36
}
},
"value": "./index.js",
"rawValue": "./index.js",
"raw": "'./index.js'"
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Validates an array using a validator.\n *\n * @param {function|RegExp} validator - The validator to use on the elements in the array.\n * @return {function} - A function that takes a value and that returns true or false if valid or not.\n ",
"start": 268,
"end": 512,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 18,
"column": 3
}
},
"range": [
268,
512
]
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 513,
"end": 826,
"loc": {
"start": {
"line": 19,
"column": 0
},
"end": {
"line": 31,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 520,
"end": 826,
"loc": {
"start": {
"line": 19,
"column": 7
},
"end": {
"line": 31,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 529,
"end": 536,
"loc": {
"start": {
"line": 19,
"column": 16
},
"end": {
"line": 19,
"column": 23
}
},
"name": "isArray",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 537,
"end": 546,
"loc": {
"start": {
"line": 19,
"column": 24
},
"end": {
"line": 19,
"column": 33
}
},
"name": "validator"
}
],
"body": {
"type": "BlockStatement",
"start": 548,
"end": 826,
"loc": {
"start": {
"line": 19,
"column": 35
},
"end": {
"line": 31,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 554,
"end": 824,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 30,
"column": 6
}
},
"argument": {
"type": "ArrowFunctionExpression",
"start": 561,
"end": 823,
"loc": {
"start": {
"line": 20,
"column": 11
},
"end": {
"line": 30,
"column": 5
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 562,
"end": 567,
"loc": {
"start": {
"line": 20,
"column": 12
},
"end": {
"line": 20,
"column": 17
}
},
"name": "input"
},
{
"type": "Identifier",
"start": 569,
"end": 573,
"loc": {
"start": {
"line": 20,
"column": 19
},
"end": {
"line": 20,
"column": 23
}
},
"name": "info"
}
],
"body": {
"type": "BlockStatement",
"start": 578,
"end": 823,
"loc": {
"start": {
"line": 20,
"column": 28
},
"end": {
"line": 30,
"column": 5
}
},
"body": [
{
"type": "IfStatement",
"start": 588,
"end": 678,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 23,
"column": 9
}
},
"test": {
"type": "Identifier",
"start": 592,
"end": 596,
"loc": {
"start": {
"line": 21,
"column": 12
},
"end": {
"line": 21,
"column": 16
}
},
"name": "info"
},
"consequent": {
"type": "BlockStatement",
"start": 598,
"end": 678,
"loc": {
"start": {
"line": 21,
"column": 18
},
"end": {
"line": 23,
"column": 9
}
},
"body": [
{
"type": "ReturnStatement",
"start": 612,
"end": 668,
"loc": {
"start": {
"line": 22,
"column": 12
},
"end": {
"line": 22,
"column": 68
}
},
"argument": {
"type": "CallExpression",
"start": 619,
"end": 667,
"loc": {
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 67
}
},
"callee": {
"type": "Identifier",
"start": 619,
"end": 629,
"loc": {
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 29
}
},
"name": "infoObject"
},
"arguments": [
{
"type": "Identifier",
"start": 630,
"end": 639,
"loc": {
"start": {
"line": 22,
"column": 30
},
"end": {
"line": 22,
"column": 39
}
},
"name": "validator"
},
{
"type": "ArrowFunctionExpression",
"start": 641,
"end": 666,
"loc": {
"start": {
"line": 22,
"column": 41
},
"end": {
"line": 22,
"column": 66
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 642,
"end": 646,
"loc": {
"start": {
"line": 22,
"column": 42
},
"end": {
"line": 22,
"column": 46
}
},
"name": "wrap"
}
],
"body": {
"type": "TemplateLiteral",
"start": 652,
"end": 665,
"loc": {
"start": {
"line": 22,
"column": 52
},
"end": {
"line": 22,
"column": 65
}
},
"expressions": [
{
"type": "Identifier",
"start": 657,
"end": 661,
"loc": {
"start": {
"line": 22,
"column": 57
},
"end": {
"line": 22,
"column": 61
}
},
"name": "wrap"
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 653,
"end": 655,
"loc": {
"start": {
"line": 22,
"column": 53
},
"end": {
"line": 22,
"column": 55
}
},
"value": {
"raw": "[ ",
"cooked": "[ "
},
"tail": false
},
{
"type": "TemplateElement",
"start": 662,
"end": 664,
"loc": {
"start": {
"line": 22,
"column": 62
},
"end": {
"line": 22,
"column": 64
}
},
"value": {
"raw": " ]",
"cooked": " ]"
},
"tail": true
}
],
"parenthesizedExpression": true
}
}
]
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"start": 688,
"end": 766,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 27,
"column": 9
}
},
"test": {
"type": "UnaryExpression",
"start": 692,
"end": 713,
"loc": {
"start": {
"line": 25,
"column": 12
},
"end": {
"line": 25,
"column": 33
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "CallExpression",
"start": 693,
"end": 713,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 33
}
},
"callee": {
"type": "Identifier",
"start": 693,
"end": 706,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 26
}
},
"name": "lodashIsArray"
},
"arguments": [
{
"type": "Identifier",
"start": 707,
"end": 712,
"loc": {
"start": {
"line": 25,
"column": 27
},
"end": {
"line": 25,
"column": 32
}
},
"name": "input"
}
]
}
},
"consequent": {
"type": "BlockStatement",
"start": 715,
"end": 766,
"loc": {
"start": {
"line": 25,
"column": 35
},
"end": {
"line": 27,
"column": 9
}
},
"body": [
{
"type": "ReturnStatement",
"start": 729,
"end": 756,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 39
}
},
"argument": {
"type": "Literal",
"start": 736,
"end": 755,
"loc": {
"start": {
"line": 26,
"column": 19
},
"end": {
"line": 26,
"column": 38
}
},
"value": "Was not an array!",
"rawValue": "Was not an array!",
"raw": "'Was not an array!'"
}
}
]
},
"alternate": null
},
{
"type": "ReturnStatement",
"start": 776,
"end": 817,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 49
}
},
"argument": {
"type": "CallExpression",
"start": 783,
"end": 816,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 48
}
},
"callee": {
"type": "CallExpression",
"start": 783,
"end": 809,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 41
}
},
"callee": {
"type": "Identifier",
"start": 783,
"end": 798,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 30
}
},
"name": "isArrayOrSingle"
},
"arguments": [
{
"type": "Identifier",
"start": 799,
"end": 808,
"loc": {
"start": {
"line": 29,
"column": 31
},
"end": {
"line": 29,
"column": 40
}
},
"name": "validator"
}
]
},
"arguments": [
{
"type": "Identifier",
"start": 810,
"end": 815,
"loc": {
"start": {
"line": 29,
"column": 42
},
"end": {
"line": 29,
"column": 47
}
},
"name": "input"
}
]
}
}
]
}
}
}
],
"trailingComments": null
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Validates an array using a validator.\n *\n * @param {function|RegExp} validator - The validator to use on the elements in the array.\n * @return {function} - A function that takes a value and that returns true or false if valid or not.\n ",
"start": 268,
"end": 512,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 18,
"column": 3
}
},
"range": [
268,
512
]
}
],
"trailingComments": [
{
"type": "Block",
"value": "*\n * Validates an object using a validator.\n *\n * @param {function|RegExp} validator - The validator to use on the elements in the object\n * @return {function} - A function that takes a value and that returns true or false if valid or not.\n ",
"start": 828,
"end": 1073,
"loc": {
"start": {
"line": 33,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
},
"range": [
828,
1073
]
}
]
},
"specifiers": [],
"source": null,
"leadingComments": [
{
"type": "Block",
"value": "*\n * Validates an array using a validator.\n *\n * @param {function|RegExp} validator - The validator to use on the elements in the array.\n * @return {function} - A function that takes a value and that returns true or false if valid or not.\n ",
"start": 268,
"end": 512,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 18,
"column": 3
}
},
"range": [
268,
512
]
}
],
"trailingComments": [
{
"type": "Block",
"value": "*\n * Validates an object using a validator.\n *\n * @param {function|RegExp} validator - The validator to use on the elements in the object\n * @return {function} - A function that takes a value and that returns true or false if valid or not.\n ",
"start": 828,
"end": 1073,
"loc": {
"start": {
"line": 33,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
},
"range": [
828,
1073
]
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 1074,
"end": 1547,
"loc": {
"start": {
"line": 39,
"column": 0
},
"end": {
"line": 56,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 1081,
"end": 1547,
"loc": {
"start": {
"line": 39,
"column": 7
},
"end": {
"line": 56,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 1090,
"end": 1098,
"loc": {
"start": {
"line": 39,
"column": 16
},
"end": {
"line": 39,
"column": 24
}
},
"name": "isObject",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1099,
"end": 1108,
"loc": {
"start": {
"line": 39,
"column": 25
},
"end": {
"line": 39,
"column": 34
}
},
"name": "validator"
}
],
"body": {
"type": "BlockStatement",
"start": 1110,
"end": 1547,
"loc": {
"start": {
"line": 39,
"column": 36
},
"end": {
"line": 56,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1116,
"end": 1545,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 55,
"column": 6
}
},
"argument": {
"type": "ArrowFunctionExpression",
"start": 1123,
"end": 1544,
"loc": {
"start": {
"line": 40,
"column": 11
},
"end": {
"line": 55,
"column": 5
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1124,
"end": 1129,
"loc": {
"start": {
"line": 40,
"column": 12
},
"end": {
"line": 40,
"column": 17
}
},
"name": "input"
},
{
"type": "Identifier",
"start": 1131,
"end": 1135,
"loc": {
"start": {
"line": 40,
"column": 19
},
"end": {
"line": 40,
"column": 23
}
},
"name": "info"
}
],
"body": {
"type": "BlockStatement",
"start": 1140,
"end": 1544,
"loc": {
"start": {
"line": 40,
"column": 28
},
"end": {
"line": 55,
"column": 5
}
},
"body": [
{
"type": "IfStatement",
"start": 1150,
"end": 1238,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 43,
"column": 9
}
},
"test": {
"type": "Identifier",
"start": 1154,
"end": 1158,
"loc": {
"start": {
"line": 41,
"column": 12
},
"end": {
"line": 41,
"column": 16
}
},
"name": "info"
},
"consequent": {
"type": "BlockStatement",
"start": 1160,
"end": 1238,
"loc": {
"start": {
"line": 41,
"column": 18
},
"end": {
"line": 43,
"column": 9
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1174,
"end": 1228,
"loc": {
"start": {
"line": 42,
"column": 12
},
"end": {
"line": 42,
"column": 66
}
},
"argument": {
"type": "CallExpression",
"start": 1181,
"end": 1227,
"loc": {
"start": {
"line": 42,
"column": 19
},
"end": {
"line": 42,
"column": 65
}
},
"callee": {
"type": "Identifier",
"start": 1181,
"end": 1191,
"loc": {
"start": {
"line": 42,
"column": 19
},
"end": {
"line": 42,
"column": 29
}
},
"name": "infoObject"
},
"arguments": [
{
"type": "Identifier",
"start": 1192,
"end": 1201,
"loc": {
"start": {
"line": 42,
"column": 30
},
"end": {
"line": 42,
"column": 39
}
},
"name": "validator"
},
{
"type": "ArrowFunctionExpression",
"start": 1203,
"end": 1226,
"loc": {
"start": {
"line": 42,
"column": 41
},
"end": {
"line": 42,
"column": 64
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1204,
"end": 1208,
"loc": {
"start": {
"line": 42,
"column": 42
},
"end": {
"line": 42,
"column": 46
}
},
"name": "wrap"
}
],
"body": {
"type": "TemplateLiteral",
"start": 1213,
"end": 1226,
"loc": {
"start": {
"line": 42,
"column": 51
},
"end": {
"line": 42,
"column": 64
}
},
"expressions": [
{
"type": "Identifier",
"start": 1218,
"end": 1222,
"loc": {
"start": {
"line": 42,
"column": 56
},
"end": {
"line": 42,
"column": 60
}
},
"name": "wrap"
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 1214,
"end": 1216,
"loc": {
"start": {
"line": 42,
"column": 52
},
"end": {
"line": 42,
"column": 54
}
},
"value": {
"raw": "{ ",
"cooked": "{ "
},
"tail": false
},
{
"type": "TemplateElement",
"start": 1223,
"end": 1225,
"loc": {
"start": {
"line": 42,
"column": 61
},
"end": {
"line": 42,
"column": 63
}
},
"value": {
"raw": " }",
"cooked": " }"
},
"tail": true
}
]
}
}
]
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"start": 1248,
"end": 1333,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 47,
"column": 9
}
},
"test": {
"type": "UnaryExpression",
"start": 1252,
"end": 1279,
"loc": {
"start": {