@eastsideco/escshopify
Version:
WIP JS library for Shopify, containing a variety of useful functionality.
1,518 lines • 92.6 kB
JSON
{
"type": "File",
"start": 0,
"end": 1011,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 40,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1011,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 40,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 57,
"end": 1010,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 39,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 72,
"end": 1010,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 39,
"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": 1010,
"loc": {
"start": {
"line": 4,
"column": 34
},
"end": {
"line": 39,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 150,
"end": 295,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 12,
"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": 295,
"loc": {
"start": {
"line": 8,
"column": 18
},
"end": {
"line": 12,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 223,
"end": 260,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 45
}
},
"expression": {
"type": "AssignmentExpression",
"start": 223,
"end": 259,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 44
}
},
"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": "NewExpression",
"start": 246,
"end": 259,
"loc": {
"start": {
"line": 10,
"column": 31
},
"end": {
"line": 10,
"column": 44
}
},
"callee": {
"type": "Identifier",
"start": 250,
"end": 257,
"loc": {
"start": {
"line": 10,
"column": 35
},
"end": {
"line": 10,
"column": 42
},
"identifierName": "WeakMap"
},
"name": "WeakMap"
},
"arguments": []
},
"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
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 269,
"end": 289,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 28
}
},
"expression": {
"type": "AssignmentExpression",
"start": 269,
"end": 288,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 27
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 269,
"end": 283,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 269,
"end": 273,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 274,
"end": 283,
"loc": {
"start": {
"line": 11,
"column": 13
},
"end": {
"line": 11,
"column": 22
},
"identifierName": "_allSpans"
},
"name": "_allSpans"
},
"computed": false
},
"right": {
"type": "ArrayExpression",
"start": 286,
"end": 288,
"loc": {
"start": {
"line": 11,
"column": 25
},
"end": {
"line": 11,
"column": 27
}
},
"elements": []
}
}
}
],
"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/plugins/easycurrency/MoneySpan.js~MoneySpan}\tmoneySpan - Span to add\n ",
"start": 301,
"end": 434,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 439,
"end": 571,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 21,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 439,
"end": 442,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 7
},
"identifierName": "add"
},
"name": "add",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 443,
"end": 452,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 17
},
"identifierName": "moneySpan"
},
"name": "moneySpan"
}
],
"body": {
"type": "BlockStatement",
"start": 454,
"end": 571,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 21,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 464,
"end": 525,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 69
}
},
"expression": {
"type": "CallExpression",
"start": 464,
"end": 524,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 68
}
},
"callee": {
"type": "MemberExpression",
"start": 464,
"end": 488,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 32
}
},
"object": {
"type": "MemberExpression",
"start": 464,
"end": 484,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 464,
"end": 468,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 469,
"end": 484,
"loc": {
"start": {
"line": 19,
"column": 13
},
"end": {
"line": 19,
"column": 28
},
"identifierName": "_spansByElement"
},
"name": "_spansByElement"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 485,
"end": 488,
"loc": {
"start": {
"line": 19,
"column": 29
},
"end": {
"line": 19,
"column": 32
},
"identifierName": "set"
},
"name": "set"
},
"computed": false
},
"arguments": [
{
"type": "CallExpression",
"start": 489,
"end": 511,
"loc": {
"start": {
"line": 19,
"column": 33
},
"end": {
"line": 19,
"column": 55
}
},
"callee": {
"type": "MemberExpression",
"start": 489,
"end": 509,
"loc": {
"start": {
"line": 19,
"column": 33
},
"end": {
"line": 19,
"column": 53
}
},
"object": {
"type": "Identifier",
"start": 489,
"end": 498,
"loc": {
"start": {
"line": 19,
"column": 33
},
"end": {
"line": 19,
"column": 42
},
"identifierName": "moneySpan"
},
"name": "moneySpan"
},
"property": {
"type": "Identifier",
"start": 499,
"end": 509,
"loc": {
"start": {
"line": 19,
"column": 43
},
"end": {
"line": 19,
"column": 53
},
"identifierName": "getElement"
},
"name": "getElement"
},
"computed": false
},
"arguments": []
},
{
"type": "Identifier",
"start": 514,
"end": 523,
"loc": {
"start": {
"line": 19,
"column": 58
},
"end": {
"line": 19,
"column": 67
},
"identifierName": "moneySpan"
},
"name": "moneySpan"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 534,
"end": 565,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 39
}
},
"expression": {
"type": "CallExpression",
"start": 534,
"end": 564,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 38
}
},
"callee": {
"type": "MemberExpression",
"start": 534,
"end": 553,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 27
}
},
"object": {
"type": "MemberExpression",
"start": 534,
"end": 548,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 534,
"end": 538,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 539,
"end": 548,
"loc": {
"start": {
"line": 20,
"column": 13
},
"end": {
"line": 20,
"column": 22
},
"identifierName": "_allSpans"
},
"name": "_allSpans"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 549,
"end": 553,
"loc": {
"start": {
"line": 20,
"column": 23
},
"end": {
"line": 20,
"column": 27
},
"identifierName": "push"
},
"name": "push"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 554,
"end": 563,
"loc": {
"start": {
"line": 20,
"column": 28
},
"end": {
"line": 20,
"column": 37
},
"identifierName": "moneySpan"
},
"name": "moneySpan"
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Add a new span to the set.\n * @param {src/plugins/easycurrency/MoneySpan.js~MoneySpan}\tmoneySpan - Span to add\n ",
"start": 301,
"end": 434,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 17,
"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/plugins/easycurrency/MoneySpan.js~MoneySpan}\n ",
"start": 577,
"end": 776,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 781,
"end": 861,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 30,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 781,
"end": 794,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 28,
"column": 17
},
"identifierName": "findByElement"
},
"name": "findByElement",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 795,
"end": 802,
"loc": {
"start": {
"line": 28,
"column": 18
},
"end": {
"line": 28,
"column": 25
},
"identifierName": "element"
},
"name": "element"
}
],
"body": {
"type": "BlockStatement",
"start": 804,
"end": 861,
"loc": {
"start": {
"line": 28,
"column": 27
},
"end": {
"line": 30,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 814,
"end": 855,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 49
}
},
"argument": {
"type": "CallExpression",
"start": 821,
"end": 854,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 48
}
},
"callee": {
"type": "MemberExpression",
"start": 821,
"end": 845,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 39
}
},
"object": {
"type": "MemberExpression",
"start": 821,
"end": 841,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 35
}
},
"object": {
"type": "ThisExpression",
"start": 821,
"end": 825,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 826,
"end": 841,
"loc": {
"start": {
"line": 29,
"column": 20
},
"end": {
"line": 29,
"column": 35
},
"identifierName": "_spansByElement"
},
"name": "_spansByElement"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 842,
"end": 845,
"loc": {
"start": {
"line": 29,
"column": 36
},
"end": {
"line": 29,
"column": 39
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 846,
"end": 853,
"loc": {
"start": {
"line": 29,
"column": 40
},
"end": {
"line": 29,
"column": 47
},
"identifierName": "element"
},
"name": "element"
}
]
}
}
],
"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/plugins/easycurrency/MoneySpan.js~MoneySpan}\n ",
"start": 577,
"end": 776,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Returns a list of all the spans in the set.\n * @return {MoneySpan[]}\n ",
"start": 867,
"end": 958,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 35,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 963,
"end": 1008,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 38,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 963,
"end": 967,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 8
},
"identifierName": "list"
},
"name": "list",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 970,
"end": 1008,
"loc": {
"start": {
"line": 36,
"column": 11
},
"end": {
"line": 38,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 980,
"end": 1002,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 30
}
},
"argument": {
"type": "MemberExpression",
"start": 987,
"end": 1001,
"loc": {
"start": {
"line": 37,
"column": 15
},
"end": {
"line": 37,
"column": 29
}
},
"object": {
"type": "ThisExpression",
"start": 987,
"end": 991,
"loc": {
"start": {
"line": 37,
"column": 15
},
"end": {
"line": 37,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 992,
"end": 1001,
"loc": {
"start": {
"line": 37,
"column": 20
},
"end": {
"line": 37,
"column": 29
},
"identifierName": "_allSpans"
},
"name": "_allSpans"
},
"computed": false
}
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Returns a list of all the spans in the set.\n * @return {MoneySpan[]}\n ",
"start": 867,
"end": 958,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 35,
"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/plugins/easycurrency/MoneySpan.js~MoneySpan}\tmoneySpan - Span to add\n ",
"start": 301,
"end": 434,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 17,
"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/plugins/easycurrency/MoneySpan.js~MoneySpan}\n ",
"start": 577,
"end": 776,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Returns a list of all the spans in the set.\n * @return {MoneySpan[]}\n ",
"start": 867,
"end": 958,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 35,
"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,
"pre