@eastsideco/escshopify
Version:
WIP JS library for Shopify, containing a variety of useful functionality.
933 lines • 21.8 kB
JSON
{
"type": "File",
"start": 0,
"end": 413,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 18,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 413,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 18,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 108,
"end": 412,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 17,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 123,
"end": 412,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 17,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 129,
"end": 138,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 30
},
"identifierName": "Formatter"
},
"name": "Formatter",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 139,
"end": 412,
"loc": {
"start": {
"line": 6,
"column": 31
},
"end": {
"line": 17,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 320,
"end": 410,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 16,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 320,
"end": 326,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 10
},
"identifierName": "format"
},
"name": "format",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 327,
"end": 333,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 14,
"column": 17
},
"identifierName": "amount"
},
"name": "amount"
},
{
"type": "Identifier",
"start": 335,
"end": 343,
"loc": {
"start": {
"line": 14,
"column": 19
},
"end": {
"line": 14,
"column": 27
},
"identifierName": "currency"
},
"name": "currency"
}
],
"body": {
"type": "BlockStatement",
"start": 345,
"end": 410,
"loc": {
"start": {
"line": 14,
"column": 29
},
"end": {
"line": 16,
"column": 5
}
},
"body": [
{
"type": "ThrowStatement",
"start": 355,
"end": 404,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 57
}
},
"argument": {
"type": "CallExpression",
"start": 361,
"end": 403,
"loc": {
"start": {
"line": 15,
"column": 14
},
"end": {
"line": 15,
"column": 56
}
},
"callee": {
"type": "Identifier",
"start": 361,
"end": 366,
"loc": {
"start": {
"line": 15,
"column": 14
},
"end": {
"line": 15,
"column": 19
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 367,
"end": 402,
"loc": {
"start": {
"line": 15,
"column": 20
},
"end": {
"line": 15,
"column": 55
}
},
"extra": {
"rawValue": "Formatter should implement format",
"raw": "'Formatter should implement format'"
},
"value": "Formatter should implement format"
}
]
}
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Format a currency.\n * @param {type}\tamount - Amount in cents.\n * @param {type}\tcurrency - Currency code to convert to.\n * @return {String}\n ",
"start": 146,
"end": 315,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 13,
"column": 7
}
}
}
]
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Formats currencies.\n * This is an abstract class which formatters should extend from.\n * @public\n ",
"start": 0,
"end": 107,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
],
"trailingComments": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Formats currencies.\n * This is an abstract class which formatters should extend from.\n * @public\n ",
"start": 0,
"end": 107,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": "*\n * Formats currencies.\n * This is an abstract class which formatters should extend from.\n * @public\n ",
"start": 0,
"end": 107,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Format a currency.\n * @param {type}\tamount - Amount in cents.\n * @param {type}\tcurrency - Currency code to convert to.\n * @return {String}\n ",
"start": 146,
"end": 315,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 13,
"column": 7
}
}
}
],
"tokens": [
{
"type": "CommentBlock",
"value": "*\n * Formats currencies.\n * This is an abstract class which formatters should extend from.\n * @public\n ",
"start": 0,
"end": 107,
"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": 108,
"end": 114,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 6
}
}
},
{
"type": {
"label": "default",
"keyword": "default",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "default",
"start": 115,
"end": 122,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 14
}
}
},
{
"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": 123,
"end": 128,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 6,
"column": 20
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Formatter",
"start": 129,
"end": 138,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 30
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 139,
"end": 140,
"loc": {
"start": {
"line": 6,
"column": 31
},
"end": {
"line": 6,
"column": 32
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Format a currency.\n * @param {type}\tamount - Amount in cents.\n * @param {type}\tcurrency - Currency code to convert to.\n * @return {String}\n ",
"start": 146,
"end": 315,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 13,
"column": 7
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "format",
"start": 320,
"end": 326,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 10
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 326,
"end": 327,
"loc": {
"start": {
"line": 14,
"column": 10
},
"end": {
"line": 14,
"column": 11
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "amount",
"start": 327,
"end": 333,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 14,
"column": 17
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 333,
"end": 334,
"loc": {
"start": {
"line": 14,
"column": 17
},
"end": {
"line": 14,
"column": 18
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "currency",
"start": 335,
"end": 343,
"loc": {
"start": {
"line": 14,
"column": 19
},
"end": {
"line": 14,
"column": 27
}
}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 343,
"end": 344,
"loc": {
"start": {
"line": 14,
"column": 27
},
"end": {
"line": 14,
"column": 28
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 345,
"end": 346,
"loc": {
"start": {
"line": 14,
"column": 29
},
"end": {
"line": 14,
"column": 30
}
}
},
{
"type": {
"label": "throw",
"keyword": "throw",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "throw",
"start": 355,
"end": 360,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 13
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Error",
"start": 361,
"end": 366,
"loc": {
"start": {
"line": 15,
"column": 14
},
"end": {
"line": 15,
"column": 19
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 366,
"end": 367,
"loc": {
"start": {
"line": 15,
"column": 19
},
"end": {
"line": 15,
"column": 20
}
}
},
{
"type": {
"label": "string",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "Formatter should implement format",
"start": 367,
"end": 402,
"loc": {
"start": {
"line": 15,
"column": 20
},
"end": {
"line": 15,
"column": 55
}
}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 402,
"end": 403,
"loc": {
"start": {
"line": 15,
"column": 55
},
"end": {
"line": 15,
"column": 56
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 403,
"end": 404,
"loc": {
"start": {
"line": 15,
"column": 56
},
"end": {
"line": 15,
"column": 57
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 409,
"end": 410,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 5
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 411,
"end": 412,
"loc": {
"start": {
"line": 17,
"column": 0
},
"end": {
"line": 17,
"column": 1
}
}
},
{
"type": {
"label": "eof",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 413,
"end": 413,
"loc": {
"start": {
"line": 18,
"column": 0
},
"end": {
"line": 18,
"column": 0
}
}
}
]
}