UNPKG

@eastsideco/escshopify

Version:

WIP JS library for Shopify, containing a variety of useful functionality.

1,485 lines (1,484 loc) 230 kB
{ "type": "File", "start": 0, "end": 1945, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 83, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1945, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 83, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 30, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 30 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 13, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 13 } }, "local": { "type": "Identifier", "start": 7, "end": 13, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 13 }, "identifierName": "config" }, "name": "config" } } ], "source": { "type": "StringLiteral", "start": 19, "end": 29, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 29 } }, "extra": { "rawValue": "./config", "raw": "'./config'" }, "value": "./config" } }, { "type": "ImportDeclaration", "start": 31, "end": 60, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 29 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 38, "end": 43, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 12 } }, "local": { "type": "Identifier", "start": 38, "end": 43, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 12 }, "identifierName": "Money" }, "name": "Money" } } ], "source": { "type": "StringLiteral", "start": 49, "end": 59, "loc": { "start": { "line": 2, "column": 18 }, "end": { "line": 2, "column": 28 } }, "extra": { "rawValue": "js-money", "raw": "'js-money'" }, "value": "js-money" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Represents an element which renders a monetary value.\n ", "start": 62, "end": 126, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 127, "end": 1944, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 82, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 142, "end": 1944, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 82, "column": 1 } }, "id": { "type": "Identifier", "start": 148, "end": 157, "loc": { "start": { "line": 7, "column": 21 }, "end": { "line": 7, "column": 30 }, "identifierName": "MoneySpan" }, "name": "MoneySpan", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 158, "end": 1944, "loc": { "start": { "line": 7, "column": 31 }, "end": { "line": 82, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 373, "end": 647, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 20, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 373, "end": 384, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 385, "end": 390, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 21 }, "identifierName": "money" }, "name": "money" }, { "type": "Identifier", "start": 392, "end": 404, "loc": { "start": { "line": 13, "column": 23 }, "end": { "line": 13, "column": 35 }, "identifierName": "easyCurrency" }, "name": "easyCurrency" } ], "body": { "type": "BlockStatement", "start": 406, "end": 647, "loc": { "start": { "line": 13, "column": 37 }, "end": { "line": 20, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 447, "end": 468, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 447, "end": 467, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 447, "end": 460, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 21 } }, "object": { "type": "ThisExpression", "start": 447, "end": 451, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 452, "end": 460, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 21 }, "identifierName": "_element" }, "name": "_element" }, "computed": false, "leadingComments": null }, "right": { "type": "NullLiteral", "start": 463, "end": 467, "loc": { "start": { "line": 15, "column": 24 }, "end": { "line": 15, "column": 28 } } }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {DOMNode} ", "start": 416, "end": 438, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 30 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "* @type {js-money} ", "start": 477, "end": 500, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 31 } } } ] }, { "type": "ExpressionStatement", "start": 509, "end": 529, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 28 } }, "expression": { "type": "AssignmentExpression", "start": 509, "end": 528, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 27 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 509, "end": 520, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 19 } }, "object": { "type": "ThisExpression", "start": 509, "end": 513, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 514, "end": 520, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 19 }, "identifierName": "_money" }, "name": "_money" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 523, "end": 528, "loc": { "start": { "line": 17, "column": 22 }, "end": { "line": 17, "column": 27 }, "identifierName": "money" }, "name": "money" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {js-money} ", "start": 477, "end": 500, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 31 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "* @type {src/plugins/easycurrency/main.js~EasyCurrency} ", "start": 538, "end": 598, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 68 } } } ] }, { "type": "ExpressionStatement", "start": 607, "end": 641, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 42 } }, "expression": { "type": "AssignmentExpression", "start": 607, "end": 640, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 607, "end": 625, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 26 } }, "object": { "type": "ThisExpression", "start": 607, "end": 611, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 612, "end": 625, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 26 }, "identifierName": "_easyCurrency" }, "name": "_easyCurrency" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 628, "end": 640, "loc": { "start": { "line": 19, "column": 29 }, "end": { "line": 19, "column": 41 }, "identifierName": "easyCurrency" }, "name": "easyCurrency" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {src/plugins/easycurrency/main.js~EasyCurrency} ", "start": 538, "end": 598, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 68 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Create a new MoneySpan instance.\n * @param {js-money} money The initial value of the element.\n * @param {src/plugins/easycurrency/main.js~EasyCurrency} easyCurrency EasyCurrency\n ", "start": 164, "end": 368, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 12, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Retrieves the element this money span is attached to.\n * @return {DOMNode}\n ", "start": 654, "end": 751, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 26, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 756, "end": 806, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 29, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 756, "end": 766, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 14 }, "identifierName": "getElement" }, "name": "getElement", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 769, "end": 806, "loc": { "start": { "line": 27, "column": 17 }, "end": { "line": 29, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 779, "end": 800, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 29 } }, "argument": { "type": "MemberExpression", "start": 786, "end": 799, "loc": { "start": { "line": 28, "column": 15 }, "end": { "line": 28, "column": 28 } }, "object": { "type": "ThisExpression", "start": 786, "end": 790, "loc": { "start": { "line": 28, "column": 15 }, "end": { "line": 28, "column": 19 } } }, "property": { "type": "Identifier", "start": 791, "end": 799, "loc": { "start": { "line": 28, "column": 20 }, "end": { "line": 28, "column": 28 }, "identifierName": "_element" }, "name": "_element" }, "computed": false } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Retrieves the element this money span is attached to.\n * @return {DOMNode}\n ", "start": 654, "end": 751, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 26, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Attaches this money span to the given element.\n * @param {DOMNode}\tel - The element to attach to.\n ", "start": 813, "end": 933, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 35, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 938, "end": 988, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 38, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 938, "end": 948, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 14 }, "identifierName": "setElement" }, "name": "setElement", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 949, "end": 951, "loc": { "start": { "line": 36, "column": 15 }, "end": { "line": 36, "column": 17 }, "identifierName": "el" }, "name": "el" } ], "body": { "type": "BlockStatement", "start": 953, "end": 988, "loc": { "start": { "line": 36, "column": 19 }, "end": { "line": 38, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 963, "end": 982, "loc": { "start": { "line": 37, "column": 8 }, "end": { "line": 37, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 963, "end": 981, "loc": { "start": { "line": 37, "column": 8 }, "end": { "line": 37, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 963, "end": 976, "loc": { "start": { "line": 37, "column": 8 }, "end": { "line": 37, "column": 21 } }, "object": { "type": "ThisExpression", "start": 963, "end": 967, "loc": { "start": { "line": 37, "column": 8 }, "end": { "line": 37, "column": 12 } } }, "property": { "type": "Identifier", "start": 968, "end": 976, "loc": { "start": { "line": 37, "column": 13 }, "end": { "line": 37, "column": 21 }, "identifierName": "_element" }, "name": "_element" }, "computed": false }, "right": { "type": "Identifier", "start": 979, "end": 981, "loc": { "start": { "line": 37, "column": 24 }, "end": { "line": 37, "column": 26 }, "identifierName": "el" }, "name": "el" } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Attaches this money span to the given element.\n * @param {DOMNode}\tel - The element to attach to.\n ", "start": 813, "end": 933, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 35, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Destroys this MoneySpan.\n ", "start": 994, "end": 1037, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 42, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1042, "end": 1152, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 47, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1042, "end": 1049, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 11 }, "identifierName": "destroy" }, "name": "destroy", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1052, "end": 1152, "loc": { "start": { "line": 43, "column": 14 }, "end": { "line": 47, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 1062, "end": 1083, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 1062, "end": 1082, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1062, "end": 1075, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 21 } }, "object": { "type": "ThisExpression", "start": 1062, "end": 1066, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 12 } } }, "property": { "type": "Identifier", "start": 1067, "end": 1075, "loc": { "start": { "line": 44, "column": 13 }, "end": { "line": 44, "column": 21 }, "identifierName": "_element" }, "name": "_element" }, "computed": false }, "right": { "type": "NullLiteral", "start": 1078, "end": 1082, "loc": { "start": { "line": 44, "column": 24 }, "end": { "line": 44, "column": 28 } } } } }, { "type": "ExpressionStatement", "start": 1092, "end": 1118, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 1092, "end": 1117, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1092, "end": 1110, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 26 } }, "object": { "type": "ThisExpression", "start": 1092, "end": 1096, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 12 } } }, "property": { "type": "Identifier", "start": 1097, "end": 1110, "loc": { "start": { "line": 45, "column": 13 }, "end": { "line": 45, "column": 26 }, "identifierName": "_easyCurrency" }, "name": "_easyCurrency" }, "computed": false }, "right": { "type": "NullLiteral", "start": 1113, "end": 1117, "loc": { "start": { "line": 45, "column": 29 }, "end": { "line": 45, "column": 33 } } } } }, { "type": "ExpressionStatement", "start": 1127, "end": 1146, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 1127, "end": 1145, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1127, "end": 1138, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 19 } }, "object": { "type": "ThisExpression", "start": 1127, "end": 1131, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 12 } } }, "property": { "type": "Identifier", "start": 1132, "end": 1138, "loc": { "start": { "line": 46, "column": 13 }, "end": { "line": 46, "column": 19 }, "identifierName": "_money" }, "name": "_money" }, "computed": false }, "right": { "type": "NullLiteral", "start": 1141, "end": 1145, "loc": { "start": { "line": 46, "column": 22 }, "end": { "line": 46, "column": 26 } } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Destroys this MoneySpan.\n ", "start": 994, "end": 1037, "loc": { "start": { "line": 40, "column": 4