@eastsideco/escshopify
Version:
WIP JS library for Shopify, containing a variety of useful functionality.
1,486 lines (1,485 loc) • 230 kB
JSON
{
"type": "File",
"start": 0,
"end": 1929,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 83,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1929,
"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": 1928,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 82,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 142,
"end": 1928,
"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": 1928,
"loc": {
"start": {
"line": 7,
"column": 31
},
"end": {
"line": 82,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 365,
"end": 631,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 20,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 365,
"end": 376,
"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": 377,
"end": 382,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 21
},
"identifierName": "money"
},
"name": "money"
},
{
"type": "Identifier",
"start": 384,
"end": 396,
"loc": {
"start": {
"line": 13,
"column": 23
},
"end": {
"line": 13,
"column": 35
},
"identifierName": "easyCurrency"
},
"name": "easyCurrency"
}
],
"body": {
"type": "BlockStatement",
"start": 398,
"end": 631,
"loc": {
"start": {
"line": 13,
"column": 37
},
"end": {
"line": 20,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 439,
"end": 460,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 439,
"end": 459,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 439,
"end": 452,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 439,
"end": 443,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 444,
"end": 452,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 21
},
"identifierName": "_element"
},
"name": "_element"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "NullLiteral",
"start": 455,
"end": 459,
"loc": {
"start": {
"line": 15,
"column": 24
},
"end": {
"line": 15,
"column": 28
}
}
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {DOMNode} ",
"start": 408,
"end": 430,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 30
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {js-money} ",
"start": 469,
"end": 492,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 31
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 501,
"end": 521,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 28
}
},
"expression": {
"type": "AssignmentExpression",
"start": 501,
"end": 520,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 27
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 501,
"end": 512,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 501,
"end": 505,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 506,
"end": 512,
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 19
},
"identifierName": "_money"
},
"name": "_money"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 515,
"end": 520,
"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": 469,
"end": 492,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 31
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {src/easycurrency/main.js~EasyCurrency} ",
"start": 530,
"end": 582,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 60
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 591,
"end": 625,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 42
}
},
"expression": {
"type": "AssignmentExpression",
"start": 591,
"end": 624,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 41
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 591,
"end": 609,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 26
}
},
"object": {
"type": "ThisExpression",
"start": 591,
"end": 595,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 596,
"end": 609,
"loc": {
"start": {
"line": 19,
"column": 13
},
"end": {
"line": 19,
"column": 26
},
"identifierName": "_easyCurrency"
},
"name": "_easyCurrency"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 612,
"end": 624,
"loc": {
"start": {
"line": 19,
"column": 29
},
"end": {
"line": 19,
"column": 41
},
"identifierName": "easyCurrency"
},
"name": "easyCurrency"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {src/easycurrency/main.js~EasyCurrency} ",
"start": 530,
"end": 582,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 60
}
}
}
]
}
],
"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/easycurrency/main.js~EasyCurrency} easyCurrency EasyCurrency\n ",
"start": 164,
"end": 360,
"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": 638,
"end": 735,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 26,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 740,
"end": 790,
"loc": {
"start": {
"line": 27,
"column": 4
},
"end": {
"line": 29,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 740,
"end": 750,
"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": 753,
"end": 790,
"loc": {
"start": {
"line": 27,
"column": 17
},
"end": {
"line": 29,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 763,
"end": 784,
"loc": {
"start": {
"line": 28,
"column": 8
},
"end": {
"line": 28,
"column": 29
}
},
"argument": {
"type": "MemberExpression",
"start": 770,
"end": 783,
"loc": {
"start": {
"line": 28,
"column": 15
},
"end": {
"line": 28,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 770,
"end": 774,
"loc": {
"start": {
"line": 28,
"column": 15
},
"end": {
"line": 28,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 775,
"end": 783,
"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": 638,
"end": 735,
"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": 797,
"end": 917,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 35,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 922,
"end": 972,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 38,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 922,
"end": 932,
"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": 933,
"end": 935,
"loc": {
"start": {
"line": 36,
"column": 15
},
"end": {
"line": 36,
"column": 17
},
"identifierName": "el"
},
"name": "el"
}
],
"body": {
"type": "BlockStatement",
"start": 937,
"end": 972,
"loc": {
"start": {
"line": 36,
"column": 19
},
"end": {
"line": 38,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 947,
"end": 966,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 947,
"end": 965,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 26
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 947,
"end": 960,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 947,
"end": 951,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 952,
"end": 960,
"loc": {
"start": {
"line": 37,
"column": 13
},
"end": {
"line": 37,
"column": 21
},
"identifierName": "_element"
},
"name": "_element"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 963,
"end": 965,
"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": 797,
"end": 917,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 35,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Destroys this MoneySpan.\n ",
"start": 978,
"end": 1021,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 42,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1026,
"end": 1136,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 47,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1026,
"end": 1033,
"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": 1036,
"end": 1136,
"loc": {
"start": {
"line": 43,
"column": 14
},
"end": {
"line": 47,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1046,
"end": 1067,
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1046,
"end": 1066,
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1046,
"end": 1059,
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 1046,
"end": 1050,
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1051,
"end": 1059,
"loc": {
"start": {
"line": 44,
"column": 13
},
"end": {
"line": 44,
"column": 21
},
"identifierName": "_element"
},
"name": "_element"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 1062,
"end": 1066,
"loc": {
"start": {
"line": 44,
"column": 24
},
"end": {
"line": 44,
"column": 28
}
}
}
}
},
{
"type": "ExpressionStatement",
"start": 1076,
"end": 1102,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 34
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1076,
"end": 1101,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 33
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1076,
"end": 1094,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 26
}
},
"object": {
"type": "ThisExpression",
"start": 1076,
"end": 1080,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1081,
"end": 1094,
"loc": {
"start": {
"line": 45,
"column": 13
},
"end": {
"line": 45,
"column": 26
},
"identifierName": "_easyCurrency"
},
"name": "_easyCurrency"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 1097,
"end": 1101,
"loc": {
"start": {
"line": 45,
"column": 29
},
"end": {
"line": 45,
"column": 33
}
}
}
}
},
{
"type": "ExpressionStatement",
"start": 1111,
"end": 1130,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1111,
"end": 1129,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 26
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1111,
"end": 1122,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 1111,
"end": 1115,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1116,
"end": 1122,
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 46,
"column": 19
},
"identifierName": "_money"
},
"name": "_money"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 1125,
"end": 1129,
"loc": {
"start": {
"line": 46,
"column": 22
},
"end": {
"line": 46,
"column": 26
}
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Destroys this MoneySpan.\n ",
"start": 978,
"end": 1021,
"loc": {
"start": {
"line": 40,
"column": 4
},