@eastsideco/escshopify
Version:
WIP JS library for Shopify, containing a variety of useful functionality.
1,094 lines (1,093 loc) • 285 kB
JSON
{
"type": "File",
"start": 0,
"end": 1500,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 39,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1500,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 39,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "Money"
},
"name": "Money"
}
}
],
"source": {
"type": "StringLiteral",
"start": 18,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 28
}
},
"extra": {
"rawValue": "js-money",
"raw": "'js-money'"
},
"value": "js-money"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "* Config",
"start": 31,
"end": 43,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 12
}
}
}
]
},
{
"type": "Identifier",
"start": 44,
"end": 1454,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 35,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 50,
"end": 56,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 12
},
"identifierName": "Config"
},
"name": "Config",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 57,
"end": 1454,
"loc": {
"start": {
"line": 4,
"column": 13
},
"end": {
"line": 35,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 178,
"end": 1452,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 34,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 178,
"end": 189,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 190,
"end": 197,
"loc": {
"start": {
"line": 9,
"column": 16
},
"end": {
"line": 9,
"column": 23
},
"identifierName": "options"
},
"name": "options"
}
],
"body": {
"type": "BlockStatement",
"start": 199,
"end": 1452,
"loc": {
"start": {
"line": 9,
"column": 25
},
"end": {
"line": 34,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 209,
"end": 808,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 24,
"column": 20
}
},
"expression": {
"type": "AssignmentExpression",
"start": 209,
"end": 807,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 24,
"column": 19
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 209,
"end": 216,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 15
},
"identifierName": "options"
},
"name": "options"
},
"right": {
"type": "CallExpression",
"start": 219,
"end": 807,
"loc": {
"start": {
"line": 10,
"column": 18
},
"end": {
"line": 24,
"column": 19
}
},
"callee": {
"type": "MemberExpression",
"start": 219,
"end": 232,
"loc": {
"start": {
"line": 10,
"column": 18
},
"end": {
"line": 10,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 219,
"end": 225,
"loc": {
"start": {
"line": 10,
"column": 18
},
"end": {
"line": 10,
"column": 24
},
"identifierName": "Object"
},
"name": "Object"
},
"property": {
"type": "Identifier",
"start": 226,
"end": 232,
"loc": {
"start": {
"line": 10,
"column": 25
},
"end": {
"line": 10,
"column": 31
},
"identifierName": "assign"
},
"name": "assign"
},
"computed": false
},
"arguments": [
{
"type": "ObjectExpression",
"start": 233,
"end": 235,
"loc": {
"start": {
"line": 10,
"column": 32
},
"end": {
"line": 10,
"column": 34
}
},
"properties": []
},
{
"type": "ObjectExpression",
"start": 237,
"end": 797,
"loc": {
"start": {
"line": 10,
"column": 36
},
"end": {
"line": 24,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 251,
"end": 273,
"loc": {
"start": {
"line": 11,
"column": 12
},
"end": {
"line": 11,
"column": 34
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 251,
"end": 266,
"loc": {
"start": {
"line": 11,
"column": 12
},
"end": {
"line": 11,
"column": 27
},
"identifierName": "defaultCurrency"
},
"name": "defaultCurrency"
},
"value": {
"type": "StringLiteral",
"start": 268,
"end": 273,
"loc": {
"start": {
"line": 11,
"column": 29
},
"end": {
"line": 11,
"column": 34
}
},
"extra": {
"rawValue": "USD",
"raw": "'USD'"
},
"value": "USD"
}
},
{
"type": "ObjectProperty",
"start": 287,
"end": 310,
"loc": {
"start": {
"line": 12,
"column": 12
},
"end": {
"line": 12,
"column": 35
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 287,
"end": 304,
"loc": {
"start": {
"line": 12,
"column": 12
},
"end": {
"line": 12,
"column": 29
},
"identifierName": "useGeoForCurrency"
},
"name": "useGeoForCurrency"
},
"value": {
"type": "BooleanLiteral",
"start": 306,
"end": 310,
"loc": {
"start": {
"line": 12,
"column": 31
},
"end": {
"line": 12,
"column": 35
}
},
"value": true
}
},
{
"type": "ObjectProperty",
"start": 324,
"end": 390,
"loc": {
"start": {
"line": 13,
"column": 12
},
"end": {
"line": 15,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 324,
"end": 342,
"loc": {
"start": {
"line": 13,
"column": 12
},
"end": {
"line": 13,
"column": 30
},
"identifierName": "moneySpanSelectors"
},
"name": "moneySpanSelectors"
},
"value": {
"type": "ArrayExpression",
"start": 344,
"end": 390,
"loc": {
"start": {
"line": 13,
"column": 32
},
"end": {
"line": 15,
"column": 13
}
},
"elements": [
{
"type": "StringLiteral",
"start": 362,
"end": 376,
"loc": {
"start": {
"line": 14,
"column": 16
},
"end": {
"line": 14,
"column": 30
}
},
"extra": {
"rawValue": "[data-money]",
"raw": "'[data-money]'"
},
"value": "[data-money]"
}
]
}
},
{
"type": "ObjectProperty",
"start": 404,
"end": 786,
"loc": {
"start": {
"line": 16,
"column": 12
},
"end": {
"line": 23,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 404,
"end": 419,
"loc": {
"start": {
"line": 16,
"column": 12
},
"end": {
"line": 16,
"column": 27
},
"identifierName": "moneySpanParser"
},
"name": "moneySpanParser"
},
"value": {
"type": "FunctionExpression",
"start": 421,
"end": 786,
"loc": {
"start": {
"line": 16,
"column": 29
},
"end": {
"line": 23,
"column": 13
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 430,
"end": 432,
"loc": {
"start": {
"line": 16,
"column": 38
},
"end": {
"line": 16,
"column": 40
},
"identifierName": "el"
},
"name": "el"
},
{
"type": "Identifier",
"start": 434,
"end": 446,
"loc": {
"start": {
"line": 16,
"column": 42
},
"end": {
"line": 16,
"column": 54
},
"identifierName": "easyCurrency"
},
"name": "easyCurrency"
}
],
"body": {
"type": "BlockStatement",
"start": 448,
"end": 786,
"loc": {
"start": {
"line": 16,
"column": 56
},
"end": {
"line": 23,
"column": 13
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 466,
"end": 496,
"loc": {
"start": {
"line": 17,
"column": 16
},
"end": {
"line": 17,
"column": 46
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 470,
"end": 495,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 45
}
},
"id": {
"type": "Identifier",
"start": 470,
"end": 476,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 26
},
"identifierName": "amount"
},
"name": "amount"
},
"init": {
"type": "MemberExpression",
"start": 479,
"end": 495,
"loc": {
"start": {
"line": 17,
"column": 29
},
"end": {
"line": 17,
"column": 45
}
},
"object": {
"type": "MemberExpression",
"start": 479,
"end": 489,
"loc": {
"start": {
"line": 17,
"column": 29
},
"end": {
"line": 17,
"column": 39
}
},
"object": {
"type": "Identifier",
"start": 479,
"end": 481,
"loc": {
"start": {
"line": 17,
"column": 29
},
"end": {
"line": 17,
"column": 31
},
"identifierName": "el"
},
"name": "el"
},
"property": {
"type": "Identifier",
"start": 482,
"end": 489,
"loc": {
"start": {
"line": 17,
"column": 32
},
"end": {
"line": 17,
"column": 39
},
"identifierName": "dataset"
},
"name": "dataset"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 490,
"end": 495,
"loc": {
"start": {
"line": 17,
"column": 40
},
"end": {
"line": 17,
"column": 45
},
"identifierName": "money"
},
"name": "money"
},
"computed": false
}
}
],
"kind": "var"
},
{
"type": "VariableDeclaration",
"start": 513,
"end": 589,
"loc": {
"start": {
"line": 18,
"column": 16
},
"end": {
"line": 18,
"column": 92
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 517,
"end": 588,
"loc": {
"start": {
"line": 18,
"column": 20
},
"end": {
"line": 18,
"column": 91
}
},
"id": {
"type": "Identifier",
"start": 517,
"end": 525,
"loc": {
"start": {
"line": 18,
"column": 20
},
"end": {
"line": 18,
"column": 28
},
"identifierName": "currency"
},
"name": "currency"
},
"init": {
"type": "LogicalExpression",
"start": 528,
"end": 588,
"loc": {
"start": {
"line": 18,
"column": 31
},
"end": {
"line": 18,
"column": 91
}
},
"left": {
"type": "MemberExpression",
"start": 528,
"end": 552,
"loc": {
"start": {
"line": 18,
"column": 31
},
"end": {
"line": 18,
"column": 55
}
},
"object": {
"type": "MemberExpression",
"start": 528,
"end": 538,
"loc": {
"start": {
"line": 18,
"column": 31
},
"end": {
"line": 18,
"column": 41
}
},
"object": {
"type": "Identifier",
"start": 528,
"end": 530,
"loc": {
"start": {
"line": 18,
"column": 31
},
"end": {
"line": 18,
"column": 33
},
"identifierName": "el"
},
"name": "el"
},
"property": {
"type": "Identifier",
"start": 531,
"end": 538,
"loc": {
"start": {
"line": 18,
"column": 34
},
"end": {
"line": 18,
"column": 41
},
"identifierName": "dataset"
},
"name": "dataset"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 539,
"end": 552,
"loc": {
"start": {
"line": 18,
"column": 42
},
"end": {
"line": 18,
"column": 55
},
"identifierName": "moneyCurrency"
},
"name": "moneyCurrency"
},
"computed": false
},
"operator": "||",
"right": {
"type": "MemberExpression",
"start": 556,
"end": 588,
"loc": {
"start": {
"line": 18,
"column": 59
},
"end": {
"line": 18,
"column": 91
}
},
"object": {
"type": "CallExpression",
"start": 556,
"end": 579,
"loc": {
"start": {
"line": 18,
"column": 59
},
"end": {
"line": 18,
"column": 82
}
},
"callee": {
"type": "MemberExpression",
"start": 556,
"end": 577,
"loc": {
"start": {
"line": 18,
"column": 59
},
"end": {
"line": 18,
"column": 80
}
},
"object": {
"type": "Identifier",
"start": 556,
"end": 568,
"loc": {
"start": {
"line": 18,
"column": 59
},
"end": {
"line": 18,
"column": 71
},
"identifierName": "easyCurrency"
},
"name": "easyCurrency"
},
"property": {
"type": "Identifier",
"start": 569,
"end": 577,
"loc": {
"start": {
"line": 18,
"column": 72
},
"end": {
"line": 18,
"column": 80
},
"identifierName": "getState"
},
"name": "getState"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 580,
"end": 588,
"loc": {
"start": {
"line": 18,
"column": 83
},
"end": {
"line": 18,
"column": 91
},
"identifierName": "currency"
},
"name": "currency"
},
"computed": false
}
}
}
],
"kind": "var"
},
{
"type": "ExpressionStatement",
"start": 606,
"end": 630,
"loc": {
"start": {
"line": 19,
"column": 16
},
"end": {
"line": 19,
"column": 40
}
},
"expression": {
"type": "UnaryExpression",
"start": 606,
"end": 629,
"loc": {
"start": {
"line": 19,
"column": 16
},
"end": {
"line": 19,
"column": 39
}
},
"operator": "delete",
"prefix": true,
"argument": {
"type": "MemberExpression",
"start": 613,
"end": 629,
"loc": {
"start": {
"line": 19,
"column": 23
},
"end": {
"line": 19,
"column": 39
}
},
"object": {
"type": "MemberExpression",
"start": 613,
"end": 623,
"loc": {
"start": {
"line": 19,