ce1919dd8a0402ab16708badec8e046d.json 6.0 KB

1
  1. {"ast":null,"code":"'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.default = exports.serialize = exports.test = void 0;\n\nvar _collections = require('../collections');\n/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/* eslint-disable local/ban-types-eventually */\n\n\nconst SPACE = ' ';\nconst OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];\nconst ARRAY_REGEXP = /^(HTML\\w*Collection|NodeList)$/;\n\nconst testName = name => OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);\n\nconst test = val => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);\n\nexports.test = test;\n\nconst isNamedNodeMap = collection => collection.constructor.name === 'NamedNodeMap';\n\nconst serialize = (collection, config, indentation, depth, refs, printer) => {\n const name = collection.constructor.name;\n\n if (++depth > config.maxDepth) {\n return '[' + name + ']';\n }\n\n return (config.min ? '' : name + SPACE) + (OBJECT_NAMES.indexOf(name) !== -1 ? '{' + (0, _collections.printObjectProperties)(isNamedNodeMap(collection) ? Array.from(collection).reduce((props, attribute) => {\n props[attribute.name] = attribute.value;\n return props;\n }, {}) : { ...collection\n }, config, indentation, depth, refs, printer) + '}' : '[' + (0, _collections.printListItems)(Array.from(collection), config, indentation, depth, refs, printer) + ']');\n};\n\nexports.serialize = serialize;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;","map":{"version":3,"sources":["/Users/jane/Documents/Курс Front-end/HW8/myproject/node_modules/pretty-format/build/plugins/DOMCollection.js"],"names":["Object","defineProperty","exports","value","default","serialize","test","_collections","require","SPACE","OBJECT_NAMES","ARRAY_REGEXP","testName","name","indexOf","val","constructor","isNamedNodeMap","collection","config","indentation","depth","refs","printer","maxDepth","min","printObjectProperties","Array","from","reduce","props","attribute","printListItems","plugin","_default"],"mapp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,KAA1B,KACCC,YAAY,CAACI,OAAb,CAAqBD,IAArB,MAA+B,CAAC,CAAhC,GACG,MACA,CAAC,GAAGN,YAAY,CAACmB,qBAAjB,EACET,cAAc,CAACC,UAAD,CAAd,GACIS,KAAK,CAACC,IAAN,CAAWV,UAAX,EAAuBW,MAAvB,CAA8B,CAACC,KAAD,EAAQC,SAAR,KAAsB;AAClDD,IAAAA,KAAK,CAACC,SAAS,CAAClB,IAAX,CAAL,GAAwBkB,SAAS,CAAC5B,KAAlC;AACA,WAAO2B,KAAP;AACD,GAHD,EAGG,EAHH,CADJ,GAKI,EAAC,GAAGZ;AAAJ,GANN,EAOEC,MAPF,EAQEC,WARF,EASEC,KATF,EAUEC,IAVF,EAWEC,OAXF,CADA,GAcA,GAfH,GAgBG,MACA,CAAC,GAAGhB,YAAY,CAACyB,cAAjB,EACEL,KAAK,CAACC,IAAN,CAAWV,UAAX,CADF,EAEEC,MAFF,EAGEC,WAHF,EAIEC,KAJF,EAKEC,IALF,EAMEC,OANF,CADA,GASA,GA1BJ,CADF;AA6BD,CApCD;;AAsCArB,OAAO,CAACG,SAAR,GAAoBA,SAApB;AACA,MAAM4B,MAAM,GAAG;AACb5B,EAAAA,SADa;AAEbC,EAAAA;AAFa,CAAf;AAIA,IAAI4B,QAAQ,GAAGD,MAAf;AACA/B,OAAO,CAACE,OAAR,GAAkB8B,QAAlB","sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.default = exports.serialize = exports.test = void 0;\n\nvar _collections = require('../collections');\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/* eslint-disable local/ban-types-eventually */\nconst SPACE = ' ';\nconst OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];\nconst ARRAY_REGEXP = /^(HTML\\w*Collection|NodeList)$/;\n\nconst testName = name =>\n OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);\n\nconst test = val =>\n val &&\n val.constructor &&\n !!val.constructor.name &&\n testName(val.constructor.name);\n\nexports.test = test;\n\nconst isNamedNodeMap = collection =>\n collection.constructor.name === 'NamedNodeMap';\n\nconst serialize = (collection, config, indentation, depth, refs, printer) => {\n const name = collection.constructor.name;\n\n if (++depth > config.maxDepth) {\n return '[' + name + ']';\n }\n\n return (\n (config.min ? '' : name + SPACE) +\n (OBJECT_NAMES.indexOf(name) !== -1\n ? '{' +\n (0, _collections.printObjectProperties)(\n isNamedNodeMap(collection)\n ? Array.from(collection).reduce((props, attribute) => {\n props[attribute.name] = attribute.value;\n return props;\n }, {})\n : {...collection},\n config,\n indentation,\n depth,\n refs,\n printer\n ) +\n '}'\n : '[' +\n (0, _collections.printListItems)(\n Array.from(collection),\n config,\n indentation,\n depth,\n refs,\n printer\n ) +\n ']')\n );\n};\n\nexports.serialize = serialize;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;\n"]},"metadata":{},"sourceType":"script"}