rizzo-next
Version:
The next generation of Lonely Planet's style guide and pattern library.
1,484 lines (1,483 loc) • 65.8 kB
JSON
{
"type": "Program",
"start": 0,
"end": 924,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 31,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 45
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 16
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 16
}
},
"name": "analytics"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 22,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 44
}
},
"value": "./trackers/analytics",
"rawValue": "./trackers/analytics",
"raw": "\"./trackers/analytics\""
}
},
{
"type": "ImportDeclaration",
"start": 46,
"end": 91,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 45
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 53,
"end": 62,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 16
}
},
"local": {
"type": "Identifier",
"start": 53,
"end": 62,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 16
}
},
"name": "flamsteed"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 68,
"end": 90,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 44
}
},
"value": "./trackers/flamsteed",
"rawValue": "./trackers/flamsteed",
"raw": "\"./trackers/flamsteed\""
}
},
{
"type": "ImportDeclaration",
"start": 92,
"end": 138,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 46
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 99,
"end": 105,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 99,
"end": 105,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 13
}
},
"name": "postal"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 111,
"end": 137,
"loc": {
"start": {
"line": 3,
"column": 19
},
"end": {
"line": 3,
"column": 45
}
},
"value": "postal/lib/postal.lodash",
"rawValue": "postal/lib/postal.lodash",
"raw": "\"postal/lib/postal.lodash\""
}
},
{
"type": "VariableDeclaration",
"start": 140,
"end": 182,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 42
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 146,
"end": 181,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 41
}
},
"id": {
"type": "Identifier",
"start": 146,
"end": 154,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 14
}
},
"name": "TRACKERS"
},
"init": {
"type": "ObjectExpression",
"start": 157,
"end": 181,
"loc": {
"start": {
"line": 5,
"column": 17
},
"end": {
"line": 5,
"column": 41
}
},
"properties": [
{
"type": "Property",
"start": 159,
"end": 168,
"loc": {
"start": {
"line": 5,
"column": 19
},
"end": {
"line": 5,
"column": 28
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 159,
"end": 168,
"loc": {
"start": {
"line": 5,
"column": 19
},
"end": {
"line": 5,
"column": 28
}
},
"name": "analytics"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 159,
"end": 168,
"loc": {
"start": {
"line": 5,
"column": 19
},
"end": {
"line": 5,
"column": 28
}
},
"name": "analytics"
}
},
{
"type": "Property",
"start": 170,
"end": 179,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 39
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 170,
"end": 179,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 39
}
},
"name": "flamsteed"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 170,
"end": 179,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 39
}
},
"name": "flamsteed"
}
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 183,
"end": 219,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 36
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 189,
"end": 218,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 35
}
},
"id": {
"type": "Identifier",
"start": 189,
"end": 205,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 22
}
},
"name": "TRACKING_CHANNEL"
},
"init": {
"type": "Literal",
"start": 208,
"end": 218,
"loc": {
"start": {
"line": 6,
"column": 25
},
"end": {
"line": 6,
"column": 35
}
},
"value": "tracking",
"rawValue": "tracking",
"raw": "\"tracking\""
}
}
],
"kind": "const",
"trailingComments": [
{
"type": "Block",
"value": "*\n * Abstraction over tracking services such as Flamsteed and Google Analytics\n * @param {Object} options\n * @param {String} options.name The name of the event\n * @param {String|Object} options.data Details of the event\n * @param {Array} [options.trackers] An array of string names of trackers to use. \n ",
"start": 221,
"end": 535,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 14,
"column": 3
}
},
"range": [
221,
535
]
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 536,
"end": 923,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 30,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 551,
"end": 923,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 30,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 560,
"end": 570,
"loc": {
"start": {
"line": 15,
"column": 24
},
"end": {
"line": 15,
"column": 34
}
},
"name": "trackEvent",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 572,
"end": 639,
"loc": {
"start": {
"line": 15,
"column": 36
},
"end": {
"line": 18,
"column": 46
}
},
"left": {
"type": "ObjectPattern",
"start": 572,
"end": 634,
"loc": {
"start": {
"line": 15,
"column": 36
},
"end": {
"line": 18,
"column": 41
}
},
"properties": [
{
"type": "Property",
"start": 577,
"end": 581,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 6
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 577,
"end": 581,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 6
}
},
"name": "name"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 577,
"end": 581,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 6
}
},
"name": "name"
}
},
{
"type": "Property",
"start": 586,
"end": 590,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 6
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 586,
"end": 590,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 6
}
},
"name": "data"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 586,
"end": 590,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 6
}
},
"name": "data"
}
},
{
"type": "Property",
"start": 595,
"end": 632,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 39
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 595,
"end": 603,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 10
}
},
"name": "trackers"
},
"kind": "init",
"value": {
"type": "AssignmentPattern",
"start": 595,
"end": 632,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 39
}
},
"left": {
"type": "Identifier",
"start": 595,
"end": 603,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 10
}
},
"name": "trackers"
},
"right": {
"type": "ArrayExpression",
"start": 606,
"end": 632,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 39
}
},
"elements": [
{
"type": "Literal",
"start": 607,
"end": 618,
"loc": {
"start": {
"line": 18,
"column": 14
},
"end": {
"line": 18,
"column": 25
}
},
"value": "flamsteed",
"rawValue": "flamsteed",
"raw": "\"flamsteed\""
},
{
"type": "Literal",
"start": 620,
"end": 631,
"loc": {
"start": {
"line": 18,
"column": 27
},
"end": {
"line": 18,
"column": 38
}
},
"value": "analytics",
"rawValue": "analytics",
"raw": "\"analytics\""
}
]
}
}
}
]
},
"right": {
"type": "ObjectExpression",
"start": 637,
"end": 639,
"loc": {
"start": {
"line": 18,
"column": 44
},
"end": {
"line": 18,
"column": 46
}
},
"properties": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 642,
"end": 923,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 30,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 646,
"end": 921,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 29,
"column": 6
}
},
"expression": {
"type": "CallExpression",
"start": 646,
"end": 920,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 29,
"column": 5
}
},
"callee": {
"type": "MemberExpression",
"start": 646,
"end": 783,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 27,
"column": 12
}
},
"object": {
"type": "CallExpression",
"start": 646,
"end": 775,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 27,
"column": 4
}
},
"callee": {
"type": "MemberExpression",
"start": 646,
"end": 658,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 14
}
},
"object": {
"type": "Identifier",
"start": 646,
"end": 654,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 10
}
},
"name": "trackers"
},
"property": {
"type": "Identifier",
"start": 655,
"end": 658,
"loc": {
"start": {
"line": 20,
"column": 11
},
"end": {
"line": 20,
"column": 14
}
},
"name": "map"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 659,
"end": 774,
"loc": {
"start": {
"line": 20,
"column": 15
},
"end": {
"line": 27,
"column": 3
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 660,
"end": 667,
"loc": {
"start": {
"line": 20,
"column": 16
},
"end": {
"line": 20,
"column": 23
}
},
"name": "tracker"
}
],
"body": {
"type": "BlockStatement",
"start": 672,
"end": 774,
"loc": {
"start": {
"line": 20,
"column": 28
},
"end": {
"line": 27,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 678,
"end": 770,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 26,
"column": 6
}
},
"argument": {
"type": "ObjectExpression",
"start": 685,
"end": 769,
"loc": {
"start": {
"line": 21,
"column": 11
},
"end": {
"line": 26,
"column": 5
}
},
"properties": [
{
"type": "Property",
"start": 693,
"end": 748,
"loc": {
"start": {
"line": 22,
"column": 6
},
"end": {
"line": 24,
"column": 8
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 693,
"end": 699,
"loc": {
"start": {
"line": 22,
"column": 6
},
"end": {
"line": 22,
"column": 12
}
},
"name": "result"
},
"value": {
"type": "CallExpression",
"start": 701,
"end": 748,
"loc": {
"start": {
"line": 22,
"column": 14
},
"end": {
"line": 24,
"column": 8
}
},
"callee": {
"type": "MemberExpression",
"start": 701,
"end": 718,
"loc": {
"start": {
"line": 22,
"column": 14
},
"end": {
"line": 22,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 701,
"end": 709,
"loc": {
"start": {
"line": 22,
"column": 14
},
"end": {
"line": 22,
"column": 22
}
},
"name": "TRACKERS"
},
"property": {
"type": "Identifier",
"start": 710,
"end": 717,
"loc": {
"start": {
"line": 22,
"column": 23
},
"end": {
"line": 22,
"column": 30
}
},
"name": "tracker"
},
"computed": true
},
"arguments": [
{
"type": "ObjectExpression",
"start": 719,
"end": 747,
"loc": {
"start": {
"line": 22,
"column": 32
},
"end": {
"line": 24,
"column": 7
}
},
"properties": [
{
"type": "Property",
"start": 729,
"end": 733,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 12
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 729,
"end": 733,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 12
}
},
"name": "name"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 729,
"end": 733,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 12
}
},
"name": "name"
}
},
{
"type": "Property",
"start": 735,
"end": 739,
"loc": {
"start": {
"line": 23,
"column": 14
},
"end": {
"line": 23,
"column": 18
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 735,
"end": 739,
"loc": {
"start": {
"line": 23,
"column": 14
},
"end": {
"line": 23,
"column": 18
}
},
"name": "data"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 735,
"end": 739,
"loc": {
"start": {
"line": 23,
"column": 14
},
"end": {
"line": 23,
"column": 18
}
},
"name": "data"
}
}
]
}
]
},
"kind": "init"
},
{
"type": "Property",
"start": 756,
"end": 763,
"loc": {
"start": {
"line": 25,
"column": 6
},
"end": {
"line": 25,
"column": 13
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 756,
"end": 763,
"loc": {
"start": {
"line": 25,
"column": 6
},
"end": {
"line": 25,
"column": 13
}
},
"name": "tracker"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 756,
"end": 763,
"loc": {
"start": {
"line": 25,
"column": 6
},
"end": {
"line": 25,
"column": 13
}
},
"name": "tracker"
}
}
]
}
}
]
}
}
]
},
"property": {
"type": "Identifier",
"start": 776,
"end": 783,
"loc": {
"start": {
"line": 27,
"column": 5
},
"end": {
"line": 27,
"column": 12
}
},
"name": "forEach"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 784,
"end": 919,
"loc": {
"start": {
"line": 27,
"column": 13
},
"end": {
"line": 29,
"column": 4
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 785,
"end": 804,
"loc": {
"start": {
"line": 27,
"column": 14
},
"end": {
"line": 27,
"column": 33
}
},
"properties": [
{
"type": "Property",
"start": 787,
"end": 793,
"loc": {
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 22
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 787,
"end": 793,
"loc": {
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 22
}
},
"name": "result"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 787,
"end": 793,
"loc": {
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 22
}
},
"name": "result"
}
},
{
"type": "Property",
"start": 795,
"end": 802,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 31
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 795,
"end": 802,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 31
}
},
"name": "tracker"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 795,
"end": 802,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 31
}
},
"name": "tracker"
}
}
]
}
],
"body": {
"type": "LogicalExpression",
"start": 809,
"end": 919,
"loc": {
"start": {
"line": 27,
"column": 38
},
"end": {
"line": 29,
"column": 4
}
},
"left": {
"type": "BinaryExpression",
"start": 809,
"end": 825,
"loc": {
"start": {
"line": 27,
"column": 38
},
"end": {
"line": 27,
"column": 54
}
},
"left": {
"type": "Identifier",
"start": 809,
"end": 815,
"loc": {
"start": {
"line": 27,
"column": 38
},
"end": {
"line": 27,
"column": 44
}
},
"name": "result"
},
"operator": "!==",
"right": {
"type": "Literal",
"start": 820,
"end": 825,
"loc": {
"start": {
"line": 27,
"column": 49
},