UNPKG

rizzo-next

Version:

The next generation of Lonely Planet's style guide and pattern library.

1,226 lines (1,225 loc) 121 kB
{ "type": "Program", "start": 0, "end": 1543, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 52, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 73, "end": 1542, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 51, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 88, "end": 1542, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 51, "column": 1 } }, "id": { "type": "Identifier", "start": 94, "end": 104, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 31 } }, "name": "CookieUtil", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 105, "end": 1542, "loc": { "start": { "line": 6, "column": 32 }, "end": { "line": 51, "column": 1 } }, "body": [ { "type": "MethodDefinition", "start": 109, "end": 179, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 9, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 109, "end": 120, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 13 } }, "name": "constructor" }, "static": false, "kind": "constructor", "value": { "type": "FunctionExpression", "start": 120, "end": 179, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 9, "column": 3 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 121, "end": 144, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 37 } }, "left": { "type": "ObjectPattern", "start": 121, "end": 139, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 32 } }, "properties": [ { "type": "Property", "start": 123, "end": 137, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 30 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 123, "end": 130, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 23 } }, "name": "cookies" }, "kind": "init", "value": { "type": "AssignmentPattern", "start": 123, "end": 137, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 30 } }, "left": { "type": "Identifier", "start": 123, "end": 130, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 23 } }, "name": "cookies" }, "right": { "type": "Literal", "start": 133, "end": 137, "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 30 } }, "value": null, "rawValue": null, "raw": "null" } } } ] }, "right": { "type": "ObjectExpression", "start": 142, "end": 144, "loc": { "start": { "line": 7, "column": 35 }, "end": { "line": 7, "column": 37 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 146, "end": 179, "loc": { "start": { "line": 7, "column": 39 }, "end": { "line": 9, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 152, "end": 175, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 152, "end": 174, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 152, "end": 164, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 16 } }, "object": { "type": "ThisExpression", "start": 152, "end": 156, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 8 } } }, "property": { "type": "Identifier", "start": 157, "end": 164, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 16 } }, "name": "cookies" }, "computed": false }, "right": { "type": "Identifier", "start": 167, "end": 174, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 26 } }, "name": "cookies" } } } ], "trailingComments": null }, "trailingComments": null }, "trailingComments": [ { "type": "Block", "value": "*\n * Retrievew a cookie by it's name\n * @param {String} cookieName Name of the cookie to retrieve\n * @param {String} format Whether or not the cookie should be parsed with JSON\n * @return {String|Object} The cookie\n ", "start": 182, "end": 414, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 15, "column": 5 } }, "range": [ 182, 414 ] } ] }, { "type": "MethodDefinition", "start": 417, "end": 739, "loc": { "start": { "line": 16, "column": 2 }, "end": { "line": 22, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 417, "end": 426, "loc": { "start": { "line": 16, "column": 2 }, "end": { "line": 16, "column": 11 } }, "name": "getCookie", "leadingComments": null }, "static": false, "kind": "method", "value": { "type": "FunctionExpression", "start": 426, "end": 739, "loc": { "start": { "line": 16, "column": 11 }, "end": { "line": 22, "column": 3 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 427, "end": 442, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 27 } }, "left": { "type": "Identifier", "start": 427, "end": 437, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 22 } }, "name": "cookieName" }, "right": { "type": "Literal", "start": 440, "end": 442, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 27 } }, "value": "", "rawValue": "", "raw": "\"\"" } }, { "type": "AssignmentPattern", "start": 444, "end": 455, "loc": { "start": { "line": 16, "column": 29 }, "end": { "line": 16, "column": 40 } }, "left": { "type": "Identifier", "start": 444, "end": 450, "loc": { "start": { "line": 16, "column": 29 }, "end": { "line": 16, "column": 35 } }, "name": "format" }, "right": { "type": "Literal", "start": 453, "end": 455, "loc": { "start": { "line": 16, "column": 38 }, "end": { "line": 16, "column": 40 } }, "value": "", "rawValue": "", "raw": "\"\"" } } ], "body": { "type": "BlockStatement", "start": 457, "end": 739, "loc": { "start": { "line": 16, "column": 42 }, "end": { "line": 22, "column": 3 } }, "body": [ { "type": "VariableDeclaration", "start": 463, "end": 654, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 19, "column": 53 } }, "declarations": [ { "type": "VariableDeclarator", "start": 467, "end": 653, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 19, "column": 52 } }, "id": { "type": "Identifier", "start": 467, "end": 475, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 16 } }, "name": "contents" }, "init": { "type": "LogicalExpression", "start": 478, "end": 653, "loc": { "start": { "line": 17, "column": 19 }, "end": { "line": 19, "column": 52 } }, "left": { "type": "CallExpression", "start": 478, "end": 645, "loc": { "start": { "line": 17, "column": 19 }, "end": { "line": 19, "column": 44 } }, "callee": { "type": "Identifier", "start": 478, "end": 486, "loc": { "start": { "line": 17, "column": 19 }, "end": { "line": 17, "column": 27 } }, "name": "unescape" }, "arguments": [ { "type": "CallExpression", "start": 487, "end": 644, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 19, "column": 43 } }, "callee": { "type": "MemberExpression", "start": 487, "end": 510, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 51 } }, "object": { "type": "MemberExpression", "start": 487, "end": 502, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 43 } }, "object": { "type": "Identifier", "start": 487, "end": 495, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 36 } }, "name": "document" }, "property": { "type": "Identifier", "start": 496, "end": 502, "loc": { "start": { "line": 17, "column": 37 }, "end": { "line": 17, "column": 43 } }, "name": "cookie" }, "computed": false }, "property": { "type": "Identifier", "start": 503, "end": 510, "loc": { "start": { "line": 17, "column": 44 }, "end": { "line": 17, "column": 51 } }, "name": "replace" }, "computed": false }, "arguments": [ { "type": "NewExpression", "start": 511, "end": 637, "loc": { "start": { "line": 17, "column": 52 }, "end": { "line": 19, "column": 36 } }, "callee": { "type": "Identifier", "start": 515, "end": 521, "loc": { "start": { "line": 17, "column": 56 }, "end": { "line": 17, "column": 62 } }, "name": "RegExp" }, "arguments": [ { "type": "BinaryExpression", "start": 522, "end": 636, "loc": { "start": { "line": 17, "column": 63 }, "end": { "line": 19, "column": 35 } }, "left": { "type": "BinaryExpression", "start": 522, "end": 598, "loc": { "start": { "line": 17, "column": 63 }, "end": { "line": 18, "column": 55 } }, "left": { "type": "Literal", "start": 522, "end": 540, "loc": { "start": { "line": 17, "column": 63 }, "end": { "line": 17, "column": 81 } }, "value": "(?:(?:^|.*;)\\s*", "rawValue": "(?:(?:^|.*;)\\s*", "raw": "\"(?:(?:^|.*;)\\\\s*\"" }, "operator": "+", "right": { "type": "CallExpression", "start": 549, "end": 598, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 55 } }, "callee": { "type": "MemberExpression", "start": 549, "end": 575, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 32 } }, "object": { "type": "CallExpression", "start": 549, "end": 567, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 24 } }, "callee": { "type": "Identifier", "start": 549, "end": 555, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 12 } }, "name": "escape" }, "arguments": [ { "type": "Identifier", "start": 556, "end": 566, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 23 } }, "name": "cookieName" } ] }, "property": { "type": "Identifier", "start": 568, "end": 575, "loc": { "start": { "line": 18, "column": 25 }, "end": { "line": 18, "column": 32 } }, "name": "replace" }, "computed": false }, "arguments": [ { "type": "Literal", "start": 576, "end": 589, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 46 } }, "value": {}, "rawValue": {}, "raw": "/[\\-\\.\\+\\*]/g", "regex": { "pattern": "[\\-\\.\\+\\*]", "flags": "g" } }, { "type": "Literal", "start": 591, "end": 597, "loc": { "start": { "line": 18, "column": 48 }, "end": { "line": 18, "column": 54 } }, "value": "\\$&", "rawValue": "\\$&", "raw": "\"\\\\$&\"" } ] } }, "operator": "+", "right": { "type": "Literal", "start": 607, "end": 636, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 35 } }, "value": "\\s*\\=\\s*([^;]*).*$)|^.*$", "rawValue": "\\s*\\=\\s*([^;]*).*$)|^.*$", "raw": "\"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"" } } ] }, { "type": "Literal", "start": 639, "end": 643, "loc": { "start": { "line": 19, "column": 38 }, "end": { "line": 19, "column": 42 } }, "value": "$1", "rawValue": "$1", "raw": "\"$1\"" } ] } ] }, "operator": "||", "right": { "type": "Literal", "start": 649, "end": 653, "loc": { "start": { "line": 19, "column": 48 }, "end": { "line": 19, "column": 52 } }, "value": null, "rawValue": null, "raw": "null" } } } ], "kind": "let" }, { "type": "ReturnStatement", "start": 660, "end": 735, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 79 } }, "argument": { "type": "ConditionalExpression", "start": 667, "end": 734, "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 78 } }, "test": { "type": "BinaryExpression", "start": 668, "end": 699, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 43 } }, "left": { "type": "CallExpression", "start": 668, "end": 688, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 32 } }, "callee": { "type": "MemberExpression", "start": 668, "end": 686, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 30 } }, "object": { "type": "Identifier", "start": 668, "end": 674, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 18 } }, "name": "format" }, "property": { "type": "Identifier", "start": 675, "end": 686, "loc": { "start": { "line": 21, "column": 19 }, "end": { "line": 21, "column": 30 } }, "name": "toUpperCase" }, "computed": false }, "arguments": [] }, "operator": "===", "right": { "type": "Literal", "start": 693, "end": 699, "loc": { "start": { "line": 21, "column": 37 }, "end": { "line": 21, "column": 43 } }, "value": "JSON", "rawValue": "JSON", "raw": "\"JSON\"" }, "parenthesizedExpression": true }, "consequent": { "type": "CallExpression", "start": 703, "end": 723, "loc": { "start": { "line": 21, "column": 47 }, "end": { "line": 21, "column": 67 } }, "callee": { "type": "MemberExpression", "start": 703, "end": 713, "loc": { "start": { "line": 21, "column": 47 }, "end": { "line": 21, "column": 57 } }, "object": { "type": "Identifier", "start": 703, "end": 707, "loc": { "start": { "line": 21, "column": 47 }, "end": { "line": 21, "column": 51 } }, "name": "JSON" }, "property": { "type": "Identifier", "start": 708, "end": 713, "loc": { "start": { "line": 21, "column": 52 }, "end": { "line": 21, "column": 57 } }, "name": "parse" }, "computed": false },