UNPKG

@eastsideco/escshopify

Version:

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

1,736 lines 75 kB
{ "type": "File", "start": 0, "end": 928, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 38, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 928, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 38, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 57, "end": 927, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 37, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 72, "end": 927, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 37, "column": 1 } }, "id": { "type": "Identifier", "start": 78, "end": 90, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 33 }, "identifierName": "MoneySpanSet" }, "name": "MoneySpanSet", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 91, "end": 927, "loc": { "start": { "line": 4, "column": 34 }, "end": { "line": 37, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 150, "end": 255, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 11, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 150, "end": 161, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 164, "end": 255, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 11, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 223, "end": 249, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 223, "end": 248, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 223, "end": 243, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 28 } }, "object": { "type": "ThisExpression", "start": 223, "end": 227, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 228, "end": 243, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 28 }, "identifierName": "_spansByElement" }, "name": "_spansByElement" }, "computed": false, "leadingComments": null }, "right": { "type": "ObjectExpression", "start": 246, "end": 248, "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 10, "column": 33 } }, "properties": [] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {Object<String, MoneySpan>} ", "start": 174, "end": 214, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 48 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Create an empty MoneySpanSet.\n ", "start": 97, "end": 145, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Add a new span to the set.\n * @param {src/easycurrency/MoneySpan.js~MoneySpan}\tmoneySpan - Span to add\n ", "start": 261, "end": 386, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 16, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 391, "end": 479, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 19, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 391, "end": 394, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 7 }, "identifierName": "add" }, "name": "add", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 395, "end": 404, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 17 }, "identifierName": "moneySpan" }, "name": "moneySpan" } ], "body": { "type": "BlockStatement", "start": 406, "end": 479, "loc": { "start": { "line": 17, "column": 19 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 416, "end": 473, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 65 } }, "expression": { "type": "AssignmentExpression", "start": 416, "end": 472, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 64 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 416, "end": 460, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 52 } }, "object": { "type": "MemberExpression", "start": 416, "end": 436, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 28 } }, "object": { "type": "ThisExpression", "start": 416, "end": 420, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } } }, "property": { "type": "Identifier", "start": 421, "end": 436, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 28 }, "identifierName": "_spansByElement" }, "name": "_spansByElement" }, "computed": false }, "property": { "type": "CallExpression", "start": 437, "end": 459, "loc": { "start": { "line": 18, "column": 29 }, "end": { "line": 18, "column": 51 } }, "callee": { "type": "MemberExpression", "start": 437, "end": 457, "loc": { "start": { "line": 18, "column": 29 }, "end": { "line": 18, "column": 49 } }, "object": { "type": "Identifier", "start": 437, "end": 446, "loc": { "start": { "line": 18, "column": 29 }, "end": { "line": 18, "column": 38 }, "identifierName": "moneySpan" }, "name": "moneySpan" }, "property": { "type": "Identifier", "start": 447, "end": 457, "loc": { "start": { "line": 18, "column": 39 }, "end": { "line": 18, "column": 49 }, "identifierName": "getElement" }, "name": "getElement" }, "computed": false }, "arguments": [] }, "computed": true }, "right": { "type": "Identifier", "start": 463, "end": 472, "loc": { "start": { "line": 18, "column": 55 }, "end": { "line": 18, "column": 64 }, "identifierName": "moneySpan" }, "name": "moneySpan" } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Add a new span to the set.\n * @param {src/easycurrency/MoneySpan.js~MoneySpan}\tmoneySpan - Span to add\n ", "start": 261, "end": 386, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 16, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Find a span by the element it renders to.\n * @param {type}\telement - The element the span renders to.\n * @return {undefined|src/easycurrency/MoneySpan.js~MoneySpan}\n ", "start": 485, "end": 676, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 25, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 681, "end": 757, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 28, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 681, "end": 694, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 17 }, "identifierName": "findByElement" }, "name": "findByElement", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 695, "end": 702, "loc": { "start": { "line": 26, "column": 18 }, "end": { "line": 26, "column": 25 }, "identifierName": "element" }, "name": "element" } ], "body": { "type": "BlockStatement", "start": 704, "end": 757, "loc": { "start": { "line": 26, "column": 27 }, "end": { "line": 28, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 714, "end": 751, "loc": { "start": { "line": 27, "column": 8 }, "end": { "line": 27, "column": 45 } }, "argument": { "type": "MemberExpression", "start": 721, "end": 750, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 44 } }, "object": { "type": "MemberExpression", "start": 721, "end": 741, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 35 } }, "object": { "type": "ThisExpression", "start": 721, "end": 725, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 19 } } }, "property": { "type": "Identifier", "start": 726, "end": 741, "loc": { "start": { "line": 27, "column": 20 }, "end": { "line": 27, "column": 35 }, "identifierName": "_spansByElement" }, "name": "_spansByElement" }, "computed": false }, "property": { "type": "Identifier", "start": 742, "end": 749, "loc": { "start": { "line": 27, "column": 36 }, "end": { "line": 27, "column": 43 }, "identifierName": "element" }, "name": "element" }, "computed": true } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Find a span by the element it renders to.\n * @param {type}\telement - The element the span renders to.\n * @return {undefined|src/easycurrency/MoneySpan.js~MoneySpan}\n ", "start": 485, "end": 676, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 25, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Returns a list of all the spans in the set.\n * @return {MoneySpan[]}\n ", "start": 763, "end": 854, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 33, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 859, "end": 925, "loc": { "start": { "line": 34, "column": 4 }, "end": { "line": 36, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 859, "end": 863, "loc": { "start": { "line": 34, "column": 4 }, "end": { "line": 34, "column": 8 }, "identifierName": "list" }, "name": "list", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 866, "end": 925, "loc": { "start": { "line": 34, "column": 11 }, "end": { "line": 36, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 876, "end": 919, "loc": { "start": { "line": 35, "column": 8 }, "end": { "line": 35, "column": 51 } }, "argument": { "type": "CallExpression", "start": 883, "end": 918, "loc": { "start": { "line": 35, "column": 15 }, "end": { "line": 35, "column": 50 } }, "callee": { "type": "MemberExpression", "start": 883, "end": 896, "loc": { "start": { "line": 35, "column": 15 }, "end": { "line": 35, "column": 28 } }, "object": { "type": "Identifier", "start": 883, "end": 889, "loc": { "start": { "line": 35, "column": 15 }, "end": { "line": 35, "column": 21 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 890, "end": 896, "loc": { "start": { "line": 35, "column": 22 }, "end": { "line": 35, "column": 28 }, "identifierName": "values" }, "name": "values" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 897, "end": 917, "loc": { "start": { "line": 35, "column": 29 }, "end": { "line": 35, "column": 49 } }, "object": { "type": "ThisExpression", "start": 897, "end": 901, "loc": { "start": { "line": 35, "column": 29 }, "end": { "line": 35, "column": 33 } } }, "property": { "type": "Identifier", "start": 902, "end": 917, "loc": { "start": { "line": 35, "column": 34 }, "end": { "line": 35, "column": 49 }, "identifierName": "_spansByElement" }, "name": "_spansByElement" }, "computed": false } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Returns a list of all the spans in the set.\n * @return {MoneySpan[]}\n ", "start": 763, "end": 854, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 33, "column": 7 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Represents a unique set of MoneySpan objects.\n ", "start": 0, "end": 56, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Represents a unique set of MoneySpan objects.\n ", "start": 0, "end": 56, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Represents a unique set of MoneySpan objects.\n ", "start": 0, "end": 56, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * Create an empty MoneySpanSet.\n ", "start": 97, "end": 145, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 7 } } }, { "type": "CommentBlock", "value": "* @type {Object<String, MoneySpan>} ", "start": 174, "end": 214, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 48 } } }, { "type": "CommentBlock", "value": "*\n * Add a new span to the set.\n * @param {src/easycurrency/MoneySpan.js~MoneySpan}\tmoneySpan - Span to add\n ", "start": 261, "end": 386, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 16, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Find a span by the element it renders to.\n * @param {type}\telement - The element the span renders to.\n * @return {undefined|src/easycurrency/MoneySpan.js~MoneySpan}\n ", "start": 485, "end": 676, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 25, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Returns a list of all the spans in the set.\n * @return {MoneySpan[]}\n ", "start": 763, "end": 854, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 33, "column": 7 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * Represents a unique set of MoneySpan objects.\n ", "start": 0, "end": 56, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "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": 57, "end": 63, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "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": 64, "end": 71, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "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": 72, "end": 77, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "MoneySpanSet", "start": 78, "end": 90, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 33 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 91, "end": 92, "loc": { "start": { "line": 4, "column": 34 }, "end": { "line": 4, "column": 35 } } }, { "type": "CommentBlock", "value": "*\n * Create an empty MoneySpanSet.\n ", "start": 97, "end": 145, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "constructor", "start": 150, "end": 161, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 15 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 161, "end": 162, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 16 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 162, "end": 163, "loc": { "start": { "line": 8, "column": 16 }, "end": { "line": 8, "column": 17 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 164, "end": 165, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 8, "column": 19 } } }, { "type": "CommentBlock", "value": "* @type {Object<String, MoneySpan>} ", "start": 174, "end": 214, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 48 } } }, { "type": { "label": "this", "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "this", "start": 223, "end": 227, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 12 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 227, "end": 228, "loc": { "start": { "line": 10, "column": 12 }, "end": { "line": 10, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "_spansByElement", "start": 228, "end": 243, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 28 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 244, "end": 245, "loc": { "start": { "line": 10, "column": 29 }, "end": { "line": 10, "column": 30 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 246, "end": 247, "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 10, "column": 32 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 247, "end": 248, "loc": { "start": { "line": 10, "column": 32 }, "end": { "line": 10, "column": 33 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 248, "end": 249, "loc": { "start": { "line": 10, "column": 33 }, "end": { "line": 10, "column": 34 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 254, "end": 255, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 5 } } }, { "type": "CommentBlock", "value": "*\n * Add a new span to the set.\n * @param {src/easycurrency/MoneySpan.js~MoneySpan}\tmoneySpan - Span to add\n ", "start": 261, "end": 386, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 16, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "add", "start": 391, "end": 394, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 7 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 394, "end": 395, "loc": { "start": { "line": 17, "column": 7 }, "end": { "line": 17, "column": 8 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "moneySpan", "start": 395, "end": 404, "loc": { "start": { "line": 17, "column": 8 }, "