[
  {
    "path": ".eslintignore",
    "content": "demo\nspec/spec.js\n*.md\nwebpack.config.spec.js\n"
  },
  {
    "path": ".eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"rules\": {\n    \"comma-dangle\": 0,\n    \"object-curly-newline\": [\"error\", { \"multiline\": true, \"minProperties\": 5 }]\n  },\n  \"parserOptions\": {\n    \"ecmaVersion\": 6,\n    \"sourceType\": \"module\",\n    \"ecmaFeatures\": {\n      \"jsx\": true,\n      \"experimentalObjectRestSpread\": true\n    }\n  }\n}\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n.idea\n.iml\n.git\nnode_modules\nnpm-debug.log\nspec/spec.js\ndemo/build\n"
  },
  {
    "path": "CONTRIBUTE.md",
    "content": "# Contributing\n\nCode of Conduct: Don't intentionally offend others, and don't look for offense from others.\n\n[Open an issue](https://github.com/TechniqueSoftware/react-json-schema/issues/new) to start a converstation about anything related to this project.\n\nTo participate by contributing, start by cloning the repo:\n\n    git clone https://github.com/TechniqueSoftware/react-json-schema.git\n\nThen install the node modules:\n\n    npm install\n\nMake your changes using an IDE that has a linter that recognizes ESLint enabled.\n\nWrite and run tests:\n\n    npm test\n\nTest your contribution using the demo as a playground (http://localhost:8080):\n\n    npm run demo\n\nConsider the maintainer's commitments and expectations found below before submitting a pull request. If you submit a pull request, briefly explain your changes. If your contribution relates to an existing issue, please link the issue in the pull request.\n\nThese are the maintainer's commitments to package users and contributers:\n* Any contribution must undergo code review before being accepted\n* Any contribution must have associated tests, and all tests must pass, before being accepted\n* Maintainers build each release; it's not necessary for you to commit a build if you do not need to use your fork immediately\n* Maintainers release the package using [semantic versioning](https://semver.org/)\n\nThese are the maintainer's expectations:\n* Contributions align with the project's purpose: \"This library constructs React elements from JSON by mapping JSON definitions to React components that you expose\"\n* You have used a linter and have followed the ESLint style guide"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2015-2018 Technique Software\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# react-json-schema\n\n`npm install react-json-schema`\n\nConstruct React elements from JSON by mapping JSON definitions to React components. Use react-json-schema for data-driven layouts, or as an abstraction layer for React components and props.\n\nRender anywhere (as long as it's DOM)! Since react-json-schema does not perform any rendering, the method in which you want to render is up to you. For example, you can use ReactDOMServer.render, ReactDOM.renderToString, etc. if you'd like. This also means JSX is not a dependency for react-json-schema.\n\n[Quick Documentation and Examples](http://techniquesoftware.github.io/react-json-schema/)\n\n### Full Documentation\n\n* [Schema](#schema)\n* [Dynamic Children and Keys](#dynamic-children-and-keys)\n* [Component Mapping](#component-mapping)\n* [Complete Example](#complete-example)\n\n#### Schema\n\nThe primary resource needed is a defined schema in JSON or a JavaScript object literal. It's recommended that schema attributes mainly define React component props. The parser explicitly handles the following attributes:\n- **component**: _MUST_ exist and be defined by a string or React component (must be a string if describing a native HTML tag)\n- **children**: _MAY_ exist to define sub-components\n- **text**: _MAY_ exist to as a string to define inner HTML text (overrides children)\n- **key**: _MAY_ exist to define a key for dynamic children\n\nExample JSON schema\n```js\nconst schema = {\n  \"component\": \"CommentList\",\n  \"children\": [\n    {\n      \"component\": \"Comment\",\n      \"author\": \"Pete Hunt\",\n      \"children\": \"This is one comment\"\n    },\n    {\n      \"component\": \"Comment\",\n      \"author\": \"Jordan Walke\",\n      \"children\": \"This is *another* comment\"\n    },\n    {\n      \"component\": \"a\",\n      \"href\": \"#help\",\n      \"text\": \"I need help\"\n    }\n  ]\n};\n```\n\nExample JS literal\n```js\n...\n  {\n    \"component\": Comment,\n    \"author\": \"Pete Hunt\",\n    \"children\": \"This is one comment\"\n  },\n...\n```\n\n##### Dynamic Children and Keys\n\nWhen arrays of components exist (like children), react-json-schema will resolve a key for the element, which follows the rules for [dynamic children](https://facebook.github.io/react/docs/multiple-components.html#dynamic-children). It will either use a custom key if defined, or resolve a numeric key based on the array index.\n\nExample of defining child keys\n```js\n...\n  {\n    \"component\": \"Comment\",\n    \"key\": \"0ab19f8e\", // defined key\n    \"author\": \"Pete Hunt\",\n    \"children\": \"This is one comment\"\n  },\n...\n```\n\n#### Component Mapping\n\nReact components need to be exposed to the react-json-schema so that the parser can create React elements. If the schema contains object literals with component references, the schema is exposing the React components and no additional configuration is needed. If the schema does not contain references to components, the components can be exposed via `setComponentMap`.\n\nExample for exposing non-exposed components (ES6)\n```js\n/* es6 object literal shorthand: { ContactForm } == { ContactForm: ContactForm } */\ncontactForm.setComponentMap({ ContactForm, StringField });\n```\n\n#### Parsing\n\nUse `parseSchema` to render React elements. It returns the root node. Note that if your schema's root is an array, you'll have to wrap the schema in an element.\n\nExample (ES6)\n```js\nReactDOM.render(contactForm.parseSchema(schema),\n  document.getElementById('contact-form'));\n```\n\n#### Complete Example\n\n```js\nimport ReactDOM from 'react-dom';\nimport ReactJsonSchema from 'react-json-schema';\n\nimport FormStore from 'FormStore';\nimport CommentList from 'CommentList';\nimport Comment from 'Comment';\n\n// For this example, let's pretend I already have data and am ignorant of actions\nconst schema = FormStore.getFormSchema();\nconst view = new ReactJsonSchema();\n\nview.setComponentMap({ CommentList, Comment });\n\nReactDOM.render(view.parseSchema(schema),\n  document.getElementById('content'));\n```\n\n### Demo an Example Codebase\n\nTo run the demo\n* `cd demo && npm install`\n* `npm start`\n* The app will be served at http://localhost:8080\n\n### Contribution and Code of Conduct\n\nIf you'd like to ask a question, raise a concern, or contribute, please follow our [contribution guidelines](CONTRIBUTE.md).\n\n### Alternatives\n\n* [react-jsonschema-form](https://github.com/mozilla-services/react-jsonschema-form): A React component for building Web forms from JSON Schema. This library further abstracts React components, making it easier to build forms. Also, it comes with components. React-json-schema is a lighter alternative that allows the use of any components.\n\n### Roadmap\n\n* Playground on our public site for discoverability\n* Possibility of react-native-json-schema\n"
  },
  {
    "path": "demo/components/CheckboxField.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FormGroup,Radio } from 'react-bootstrap';\n\nclass CheckboxField extends React.Component {\n\n  constructor(props) {\n    super(props);\n  }\n\n  renderCheckboxes() {\n    const checkboxes = [];\n    this.props.checkboxes.forEach(function loop(checkbox, index) {\n      checkboxes.push(\n        <Radio key={index} {...checkbox}>{checkbox.label}</Radio>\n      );\n    });\n    return checkboxes;\n  }\n\n  render() {\n    const checkboxes = this.renderCheckboxes();\n    return (\n      <FormGroup className=\"checkboxes\">\n        {checkboxes}\n      </FormGroup>\n    );\n  }\n}\n\nCheckboxField.propTypes = {\n  checkboxes: PropTypes.arrayOf(\n    PropTypes.shape({\n      label: PropTypes.string.isRequired\n    }).isRequired\n  ).isRequired\n};\n\nexport default CheckboxField;\n"
  },
  {
    "path": "demo/components/ContactForm.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Button, Grid, Col, Row } from 'react-bootstrap';\n\nclass ContactForm extends React.Component {\n\n  constructor(props) {\n    super(props);\n  }\n\n  alertSubmit() {\n    alert('Hey, you submitted the form!');\n  }\n\n  render() {\n    return (\n      <Grid>\n        <Row>\n          <Col md={6} mdOffset={3} xs={12}>\n            <h3>{this.props.title}</h3>\n            <form>\n              {this.props.children}\n              <Button type=\"submit\" bsStyle=\"success\" onClick={this.alertSubmit}>Submit Contact Information!</Button>\n            </form>\n          </Col>\n        </Row>\n      </Grid>\n    );\n  }\n}\n\nContactForm.propTypes = {\n  title: PropTypes.string.isRequired,\n  children: PropTypes.arrayOf(PropTypes.element)\n};\n\nexport default ContactForm;\n"
  },
  {
    "path": "demo/components/StringField.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FormGroup, ControlLabel, FormControl, HelpBlock } from 'react-bootstrap';\n\nconst alphaRegex = /^$|[A-Z]+$/i;\n\nclass StringField extends React.Component {\n\n  constructor(props) {\n    super(props);\n    this.state = { value: '' };\n  }\n\n  validateInput(event) {\n    if (alphaRegex.test(event.target.value)) {\n      this.setState({ value: event.target.value });\n    }\n  }\n\n  render() {\n    const { label, name, help, ...rest } = this.props;\n    return (\n      <FormGroup controlId={name}>\n        <ControlLabel>{label}</ControlLabel>\n        <FormControl componentClass=\"input\" name={name} />\n        {help && <HelpBlock>{help}</HelpBlock>}\n      </FormGroup>\n    );\n  }\n}\n\nStringField.propTypes = {\n  label: PropTypes.string.isRequired,\n  name: PropTypes.string.isRequired,\n  help: PropTypes.string\n};\n\nexport default StringField;\n"
  },
  {
    "path": "demo/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Demo: react-json-schema</title>\n    <link rel=\"stylesheet\" href=\"node_modules/bootstrap/dist/css/bootstrap.css\">\n  </head>\n  <body>\n    <div id=\"welcome-banner\"></div>\n    <div id=\"json-react-schema\"></div>\n  </body>\n  <script src=\"bundle.js\"></script>\n</html>\n"
  },
  {
    "path": "demo/index.jsx",
    "content": "import ReactDOM from 'react-dom';\nimport ContactForm from './components/ContactForm';\nimport StringField from './components/StringField';\nimport CheckboxField from './components/CheckboxField';\n\n// If a package dependency: import ReactJsonSchema from 'react-json-schema';\nimport ReactJsonSchema from '../lib/ReactJsonSchema';\n\nconst welcomeSchema = {\n  'component': 'h2',\n  'className': 'text-center',\n  'text': 'Hello World!'\n};\n\nconst welcomeBanner = new ReactJsonSchema();\nReactDOM.render(welcomeBanner.parseSchema(welcomeSchema), document.getElementById('welcome-banner'));\n\nconst formSchema = {\n  'component': 'ContactForm',\n  'title': 'Tell us a little about yourself, we\\'d appreciate it',\n  'children': [\n    {\n      'component': 'StringField',\n      'label': 'What\\'s your name',\n      'name': 'fullname',\n      'help': 'It\\'s okay, don\\'t be shy :)'\n    },\n    {\n      'component': 'CheckboxField',\n      'checkboxes': [\n        {\n          'label': 'I\\'m already checked!',\n          'defaultChecked': true,\n          'key': 0\n        },\n        {\n          'label': 'Here\\'s another',\n          'key': 10\n        }\n      ]\n    }\n  ]\n};\n\nconst componentMap = { ContactForm, StringField, CheckboxField };\nconst contactForm = new ReactJsonSchema();\ncontactForm.setComponentMap(componentMap);\n\nReactDOM.render(contactForm.parseSchema(formSchema), document.getElementById('json-react-schema'));\n"
  },
  {
    "path": "demo/package.json",
    "content": "{\n  \"name\": \"react-json-schema-demo\",\n  \"version\": \"1.0.0\",\n  \"description\": \"Need to test ReactJsonSchema in the wild? This is where you'd do it.\",\n  \"author\": {\n    \"name\": \"A collaborative project overseen by Club OS\",\n    \"url\": \"https://club-os.com/\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/TechniqueSoftware/react-json-schema\"\n  },\n  \"license\": \"Apache-2.0\",\n  \"bugs\": {\n    \"url\": \"https://github.com/TechniqueSoftware/react-json-schema/issues\"\n  },\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --progress --colors --inline\"\n  },\n  \"engines\": {\n    \"node\": \">=6.4.0\"\n  },\n  \"devDependencies\": {\n    \"ajv\": \"^6.1.1\",\n    \"bootstrap\": \"^3.3.7\",\n    \"file-loader\": \"^1.1.6\",\n    \"path\": \"^0.12.7\",\n    \"prop-types\": \"^15.6.0\",\n    \"react-bootstrap\": \"^0.32.1\",\n    \"react-dom\": \"^16.2.0\",\n    \"webpack\": \"^3.11.0\",\n    \"webpack-dev-server\": \"^2.11.1\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.3.2\"\n  }\n}\n"
  },
  {
    "path": "demo/webpack.config.js",
    "content": "const path = require('path');\n\nmodule.exports = {\n  entry: path.join(__dirname, 'index.jsx'),\n  output: {\n    filename: 'bundle.js',\n    path: path.join(__dirname, 'build')\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.(js|jsx)$/,\n        exclude: [\n          path.join(__dirname, '../dist'),\n          /node_modules/\n        ],\n        use: [{\n          loader: 'babel-loader',\n          options: {\n            presets: ['react', 'env'],\n            plugins: ['transform-es2015-destructuring', 'transform-object-rest-spread']\n          }\n        }]\n      }\n    ]\n  },\n  resolve: {\n    modules: [\n      path.join(__dirname, '../lib'),\n      path.join(__dirname, '../dist'),\n      'node_modules'\n    ],\n    extensions: ['.js', '.json', '.jsx']\n  }\n};\n"
  },
  {
    "path": "dist/react-json-schema.js",
    "content": "(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactJsonSchema\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"ReactJsonSchema\"] = factory(root[\"React\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = __webpack_require__(0);\n\nvar _reactDomFactories = __webpack_require__(2);\n\nvar _reactDomFactories2 = _interopRequireDefault(_reactDomFactories);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar componentMapCollection = new WeakMap();\n\nvar ReactJsonSchema = function () {\n  function ReactJsonSchema() {\n    _classCallCheck(this, ReactJsonSchema);\n  }\n\n  _createClass(ReactJsonSchema, [{\n    key: 'parseSchema',\n    value: function parseSchema(schema) {\n      var element = null;\n      var elements = null;\n      if (Array.isArray(schema)) {\n        elements = this.parseSubSchemas(schema);\n      } else if (schema) {\n        element = this.createComponent(schema);\n      }\n      return element || elements;\n    }\n  }, {\n    key: 'parseSubSchemas',\n    value: function parseSubSchemas() {\n      var _this = this;\n\n      var subSchemas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n      var Components = [];\n      var index = 0;\n      Object.keys(subSchemas).forEach(function (key) {\n        var subSchema = subSchemas[key];\n        subSchema.key = typeof subSchema.key !== 'undefined' ? subSchema.key : index;\n        Components.push(_this.parseSchema(subSchema));\n        index += 1;\n      });\n      return Components;\n    }\n  }, {\n    key: 'createComponent',\n    value: function createComponent(schema) {\n      // eslint-disable-next-line no-unused-vars\n      var component = schema.component,\n          children = schema.children,\n          text = schema.text,\n          rest = _objectWithoutProperties(schema, ['component', 'children', 'text']);\n\n      var Component = this.resolveComponent(schema);\n      var Children = typeof text !== 'undefined' ? text : this.resolveComponentChildren(schema);\n      return (0, _react.createElement)(Component, rest, Children);\n    }\n  }, {\n    key: 'resolveComponent',\n    value: function resolveComponent(schema) {\n      var componentMap = this.getComponentMap();\n      var Component = null;\n      if (Object.prototype.hasOwnProperty.call(schema, 'component')) {\n        if (schema.component === Object(schema.component)) {\n          Component = schema.component;\n        } else if (componentMap && componentMap[schema.component]) {\n          Component = componentMap[schema.component];\n        } else if (Object.prototype.hasOwnProperty.call(_reactDomFactories2.default, schema.component)) {\n          Component = schema.component;\n        }\n      } else {\n        throw new Error('ReactJsonSchema could not resolve a component due to a missing component \\n          attribute in the schema.');\n      }\n      return Component;\n    }\n  }, {\n    key: 'resolveComponentChildren',\n    value: function resolveComponentChildren(schema) {\n      return Object.prototype.hasOwnProperty.call(schema, 'children') ? this.parseSchema(schema.children) : undefined;\n    }\n  }, {\n    key: 'getComponentMap',\n    value: function getComponentMap() {\n      return componentMapCollection.get(this);\n    }\n  }, {\n    key: 'setComponentMap',\n    value: function setComponentMap(componentMap) {\n      componentMapCollection.set(this, componentMap);\n    }\n  }]);\n\n  return ReactJsonSchema;\n}();\n\nexports.default = ReactJsonSchema;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * Copyright (c) 2015-present, Facebook, Inc.\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(function(f) {\n  if (true) {\n    module.exports = f(__webpack_require__(0));\n    /* global define */\n  } else if (typeof define === 'function' && define.amd) {\n    define(['react'], f);\n  } else {\n    var g;\n    if (typeof window !== 'undefined') {\n      g = window;\n    } else if (typeof global !== 'undefined') {\n      g = global;\n    } else if (typeof self !== 'undefined') {\n      g = self;\n    } else {\n      g = this;\n    }\n\n    if (typeof g.React === 'undefined') {\n      throw Error('React module should be required before ReactDOMFactories');\n    }\n\n    g.ReactDOMFactories = f(g.React);\n  }\n})(function(React) {\n  /**\n   * Create a factory that creates HTML tag elements.\n   */\n  function createDOMFactory(type) {\n    var factory = React.createElement.bind(null, type);\n    // Expose the type on the factory and the prototype so that it can be\n    // easily accessed on elements. E.g. `<Foo />.type === Foo`.\n    // This should not be named `constructor` since this may not be the function\n    // that created the element, and it may not even be a constructor.\n    factory.type = type;\n    return factory;\n  };\n\n  /**\n   * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.\n   */\n  var ReactDOMFactories = {\n    a: createDOMFactory('a'),\n    abbr: createDOMFactory('abbr'),\n    address: createDOMFactory('address'),\n    area: createDOMFactory('area'),\n    article: createDOMFactory('article'),\n    aside: createDOMFactory('aside'),\n    audio: createDOMFactory('audio'),\n    b: createDOMFactory('b'),\n    base: createDOMFactory('base'),\n    bdi: createDOMFactory('bdi'),\n    bdo: createDOMFactory('bdo'),\n    big: createDOMFactory('big'),\n    blockquote: createDOMFactory('blockquote'),\n    body: createDOMFactory('body'),\n    br: createDOMFactory('br'),\n    button: createDOMFactory('button'),\n    canvas: createDOMFactory('canvas'),\n    caption: createDOMFactory('caption'),\n    cite: createDOMFactory('cite'),\n    code: createDOMFactory('code'),\n    col: createDOMFactory('col'),\n    colgroup: createDOMFactory('colgroup'),\n    data: createDOMFactory('data'),\n    datalist: createDOMFactory('datalist'),\n    dd: createDOMFactory('dd'),\n    del: createDOMFactory('del'),\n    details: createDOMFactory('details'),\n    dfn: createDOMFactory('dfn'),\n    dialog: createDOMFactory('dialog'),\n    div: createDOMFactory('div'),\n    dl: createDOMFactory('dl'),\n    dt: createDOMFactory('dt'),\n    em: createDOMFactory('em'),\n    embed: createDOMFactory('embed'),\n    fieldset: createDOMFactory('fieldset'),\n    figcaption: createDOMFactory('figcaption'),\n    figure: createDOMFactory('figure'),\n    footer: createDOMFactory('footer'),\n    form: createDOMFactory('form'),\n    h1: createDOMFactory('h1'),\n    h2: createDOMFactory('h2'),\n    h3: createDOMFactory('h3'),\n    h4: createDOMFactory('h4'),\n    h5: createDOMFactory('h5'),\n    h6: createDOMFactory('h6'),\n    head: createDOMFactory('head'),\n    header: createDOMFactory('header'),\n    hgroup: createDOMFactory('hgroup'),\n    hr: createDOMFactory('hr'),\n    html: createDOMFactory('html'),\n    i: createDOMFactory('i'),\n    iframe: createDOMFactory('iframe'),\n    img: createDOMFactory('img'),\n    input: createDOMFactory('input'),\n    ins: createDOMFactory('ins'),\n    kbd: createDOMFactory('kbd'),\n    keygen: createDOMFactory('keygen'),\n    label: createDOMFactory('label'),\n    legend: createDOMFactory('legend'),\n    li: createDOMFactory('li'),\n    link: createDOMFactory('link'),\n    main: createDOMFactory('main'),\n    map: createDOMFactory('map'),\n    mark: createDOMFactory('mark'),\n    menu: createDOMFactory('menu'),\n    menuitem: createDOMFactory('menuitem'),\n    meta: createDOMFactory('meta'),\n    meter: createDOMFactory('meter'),\n    nav: createDOMFactory('nav'),\n    noscript: createDOMFactory('noscript'),\n    object: createDOMFactory('object'),\n    ol: createDOMFactory('ol'),\n    optgroup: createDOMFactory('optgroup'),\n    option: createDOMFactory('option'),\n    output: createDOMFactory('output'),\n    p: createDOMFactory('p'),\n    param: createDOMFactory('param'),\n    picture: createDOMFactory('picture'),\n    pre: createDOMFactory('pre'),\n    progress: createDOMFactory('progress'),\n    q: createDOMFactory('q'),\n    rp: createDOMFactory('rp'),\n    rt: createDOMFactory('rt'),\n    ruby: createDOMFactory('ruby'),\n    s: createDOMFactory('s'),\n    samp: createDOMFactory('samp'),\n    script: createDOMFactory('script'),\n    section: createDOMFactory('section'),\n    select: createDOMFactory('select'),\n    small: createDOMFactory('small'),\n    source: createDOMFactory('source'),\n    span: createDOMFactory('span'),\n    strong: createDOMFactory('strong'),\n    style: createDOMFactory('style'),\n    sub: createDOMFactory('sub'),\n    summary: createDOMFactory('summary'),\n    sup: createDOMFactory('sup'),\n    table: createDOMFactory('table'),\n    tbody: createDOMFactory('tbody'),\n    td: createDOMFactory('td'),\n    textarea: createDOMFactory('textarea'),\n    tfoot: createDOMFactory('tfoot'),\n    th: createDOMFactory('th'),\n    thead: createDOMFactory('thead'),\n    time: createDOMFactory('time'),\n    title: createDOMFactory('title'),\n    tr: createDOMFactory('tr'),\n    track: createDOMFactory('track'),\n    u: createDOMFactory('u'),\n    ul: createDOMFactory('ul'),\n    var: createDOMFactory('var'),\n    video: createDOMFactory('video'),\n    wbr: createDOMFactory('wbr'),\n\n    // SVG\n    circle: createDOMFactory('circle'),\n    clipPath: createDOMFactory('clipPath'),\n    defs: createDOMFactory('defs'),\n    ellipse: createDOMFactory('ellipse'),\n    g: createDOMFactory('g'),\n    image: createDOMFactory('image'),\n    line: createDOMFactory('line'),\n    linearGradient: createDOMFactory('linearGradient'),\n    mask: createDOMFactory('mask'),\n    path: createDOMFactory('path'),\n    pattern: createDOMFactory('pattern'),\n    polygon: createDOMFactory('polygon'),\n    polyline: createDOMFactory('polyline'),\n    radialGradient: createDOMFactory('radialGradient'),\n    rect: createDOMFactory('rect'),\n    stop: createDOMFactory('stop'),\n    svg: createDOMFactory('svg'),\n    text: createDOMFactory('text'),\n    tspan: createDOMFactory('tspan'),\n  };\n\n  // due to wrapper and conditionals at the top, this will either become\n  // `module.exports ReactDOMFactories` if that is available,\n  // otherwise it will be defined via `define(['react'], ReactDOMFactories)`\n  // if that is available,\n  // otherwise it will be defined as global variable.\n  return ReactDOMFactories;\n});\n\n\n\n/***/ })\n/******/ ]);\n});"
  },
  {
    "path": "lib/ReactJsonSchema.js",
    "content": "import { createElement } from 'react';\nimport DOM from 'react-dom-factories';\n\nconst componentMapCollection = new WeakMap();\n\nexport default class ReactJsonSchema {\n  parseSchema(schema) {\n    let element = null;\n    let elements = null;\n    if (Array.isArray(schema)) {\n      elements = this.parseSubSchemas(schema);\n    } else if (schema) {\n      element = this.createComponent(schema);\n    }\n    return element || elements;\n  }\n\n  parseSubSchemas(subSchemas = []) {\n    const Components = [];\n    let index = 0;\n    Object.keys(subSchemas).forEach((key) => {\n      const subSchema = subSchemas[key];\n      subSchema.key = typeof subSchema.key !== 'undefined' ? subSchema.key : index;\n      Components.push(this.parseSchema(subSchema));\n      index += 1;\n    });\n    return Components;\n  }\n\n  createComponent(schema) {\n    // eslint-disable-next-line no-unused-vars\n    const { component, children, text, ...rest } = schema;\n    const Component = this.resolveComponent(schema);\n    const Children = typeof text !== 'undefined' ? text : this.resolveComponentChildren(schema);\n    return createElement(Component, rest, Children);\n  }\n\n  resolveComponent(schema) {\n    const componentMap = this.getComponentMap();\n    let Component = null;\n    if (Object.prototype.hasOwnProperty.call(schema, 'component')) {\n      if (schema.component === Object(schema.component)) {\n        Component = schema.component;\n      } else if (componentMap && componentMap[schema.component]) {\n        Component = componentMap[schema.component];\n      } else if (Object.prototype.hasOwnProperty.call(DOM, schema.component)) {\n        Component = schema.component;\n      }\n    } else {\n      throw new Error(`ReactJsonSchema could not resolve a component due to a missing component \n          attribute in the schema.`);\n    }\n    return Component;\n  }\n\n  resolveComponentChildren(schema) {\n    return (Object.prototype.hasOwnProperty.call(schema, 'children')) ?\n      this.parseSchema(schema.children) : undefined;\n  }\n\n  getComponentMap() {\n    return componentMapCollection.get(this);\n  }\n\n  setComponentMap(componentMap) {\n    componentMapCollection.set(this, componentMap);\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"react-json-schema\",\n  \"version\": \"1.2.2\",\n  \"description\": \"Write component schema in JSON; parse to create react elements.\",\n  \"keywords\": [\n    \"react\",\n    \"JSON\",\n    \"schema\",\n    \"components\"\n  ],\n  \"author\": {\n    \"name\": \"A collaborative project overseen by Club OS\",\n    \"url\": \"https://club-os.com/\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/TechniqueSoftware/react-json-schema\"\n  },\n  \"license\": \"Apache-2.0\",\n  \"bugs\": {\n    \"url\": \"https://github.com/TechniqueSoftware/react-json-schema/issues\"\n  },\n  \"scripts\": {\n    \"build\": \"eslint lib/ReactJsonSchema.js && webpack --progress --profile --colors --config webpack.config.dist.js\",\n    \"jasmine\": \"eslint lib/ReactJsonSchema.js && jasmine spec/spec.js\",\n    \"pretest\": \"eslint lib/ReactJsonSchema.js && webpack --progress --profile --colors --config webpack.config.spec.js\",\n    \"test\": \"npm run jasmine\",\n    \"preversion\": \"npm run jasmine\",\n    \"version\": \"npm run build && git add -A\",\n    \"postversion\": \"git push origin master && git push origin --tags\"\n  },\n  \"main\": \"dist/react-json-schema.js\",\n  \"files\": [\n    \"lib\",\n    \"dist\"\n  ],\n  \"engines\": {\n    \"node\": \">=6.4.0\"\n  },\n  \"peerDependencies\": {\n    \"react\": \">=15\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.3\",\n    \"babel-eslint\": \"^8.2.1\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-es2015-destructuring\": \"^6.23.0\",\n    \"babel-plugin-transform-object-rest-spread\": \"^6.26.0\",\n    \"babel-preset-env\": \"^1.7.0\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"clean-webpack-plugin\": \"^0.1.18\",\n    \"eslint\": \"^4.17.0\",\n    \"eslint-config-airbnb\": \"^16.1.0\",\n    \"eslint-plugin-import\": \"^2.8.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.0.3\",\n    \"eslint-plugin-react\": \"^7.6.1\",\n    \"jasmine\": \"^2.99.0\",\n    \"path\": \"^0.12.7\",\n    \"react\": \"^16.2.0\",\n    \"uglifyjs-webpack-plugin\": \"^1.2.5\",\n    \"webpack\": \"^3.11.0\"\n  },\n  \"dependencies\": {\n    \"react-dom-factories\": \"^1.0.2\"\n  }\n}\n"
  },
  {
    "path": "spec/ReactJsonSchemaSpec.js",
    "content": "/* global jasmine, beforeEach, describe, it, expect, spyOn */\n/* eslint max-len: 0 */\n\nimport React from 'react';\nimport ReactJsonSchema from '../lib/ReactJsonSchema';\n\nlet reactJsonSchema;\nlet schema;\n\nexport default describe('ReactJsonSchema', () => {\n  class Tester extends React.Component { // eslint-disable-line\n    render() {\n      React.createElement('h1', null, 'Tester!!!!');\n    }\n  }\n\n  beforeEach(() => {\n    reactJsonSchema = new ReactJsonSchema();\n    /* eslint-disable */\n    schema = {\n      \"component\": Tester,\n      \"someProp\": \"I'm a tester\"\n    };\n    /* eslint-enable */\n  });\n  describe('when parsing schema', () => {\n    it('should allow children to have a null value', () => {\n      const component = reactJsonSchema.parseSchema({ component: 'input', children: null, value: 'test' });\n      expect(React.isValidElement(<component />)).toBe(true);\n    });\n\n    it('should return an array of React elements when schema\\'s root type is of type array.', () => {\n      const actual = reactJsonSchema.parseSchema([schema]);\n      expect(Array.isArray(actual)).toBe(true);\n      const component = actual[0];\n      expect(React.isValidElement(<component />)).toBe(true);\n    });\n    it('should return a root React element when the schema\\'s root type is of type object.', () => {\n      const actual = reactJsonSchema.parseSchema(schema);\n      expect(actual === Object(actual)).toBe(true);\n    });\n  });\n  describe('when parsing sub-schemas', () => {\n    it('should return an empty array when no schemas are passed as an argument.', () => {\n      const actual = reactJsonSchema.parseSubSchemas();\n      expect(Array.isArray(actual)).toBe(true);\n    });\n    it('should return an array of React elements when valid schemas are passed as an argument.', () => {\n      const subSchemas = [schema, schema];\n      const actual = reactJsonSchema.parseSubSchemas(subSchemas);\n      expect(!!actual.length).toBe(true);\n      expect(actual[0] === Object(actual[0])).toBe(true);\n    });\n    it('should construct sub-schema React elements by parsing each sub-schema.', () => {\n      const subSchemas = [schema, schema];\n      spyOn(reactJsonSchema, 'parseSchema');\n      reactJsonSchema.parseSubSchemas(subSchemas);\n      expect(reactJsonSchema.parseSchema).toHaveBeenCalled();\n    });\n    it('should consume a key defined in the schema\\'s keys for the current sub-schema based on the current sub-schema\\'s index to meet React\\'s key expectation of multiple React elements.', () => {\n      const subSchemas = [Object.assign({}, schema), Object.assign({}, schema)];\n      for (const subSchema of subSchemas) { subSchema.key = Math.random(); }\n      spyOn(reactJsonSchema, 'parseSchema');\n      reactJsonSchema.parseSubSchemas(subSchemas);\n      expect(reactJsonSchema.parseSchema).toHaveBeenCalledWith(subSchemas[0]);\n      expect(reactJsonSchema.parseSchema).toHaveBeenCalledWith(subSchemas[1]);\n    });\n    it('should assign a key to the current sub-schema based on the current sub-schema\\'s index to meet React\\'s key expectation of multiple React elements.', () => {\n      spyOn(reactJsonSchema, 'parseSchema');\n      const subSchemas = [Object.assign({}, schema), Object.assign({}, schema)];\n      reactJsonSchema.parseSubSchemas(subSchemas);\n      const firstSubSchema = Object.assign({}, subSchemas[0], { key: 0 });\n      const secondSubSchema = Object.assign({}, subSchemas[1], { key: 1 });\n      expect(reactJsonSchema.parseSchema).toHaveBeenCalledWith(firstSubSchema);\n      expect(reactJsonSchema.parseSchema).toHaveBeenCalledWith(secondSubSchema);\n    });\n  });\n  describe('when creating components', () => {\n    it('should throw an error when no schema is passed as an argument.', () => {\n      spyOn(reactJsonSchema, 'resolveComponent');\n      spyOn(reactJsonSchema, 'resolveComponentChildren');\n      reactJsonSchema.resolveComponent.and.returnValue(null);\n      reactJsonSchema.resolveComponentChildren.and.returnValue(null);\n      expect(reactJsonSchema.createComponent).toThrowError();\n    });\n    it('should create a React element.', () => {\n      const actual = reactJsonSchema.createComponent(schema);\n      expect(React.isValidElement(<actual />)).toBe(true);\n    });\n    it('should resolve and pass props (schema key value pair not described by component or children) and child elements to React\\'s create element functionality.', () => {\n      const largeSchema = Object.assign({}, schema);\n      largeSchema.children = [schema];\n      spyOn(React, 'createElement');\n      reactJsonSchema.createComponent(largeSchema);\n      expect(React.createElement).toHaveBeenCalledWith(jasmine.any(Function), { someProp: schema.someProp }, jasmine.any(Array));\n    });\n  });\n  describe('when resolving components (evaluating schema for mapping requirements)', () => {\n    it('should throw an error when a schema element does not have a component attribute.', () => {\n      expect(reactJsonSchema.resolveComponent).toThrowError();\n    });\n    it('should resolve components defined as strings against a component map.', () => {\n      const stringSchema = { component: 'Tester' };\n      reactJsonSchema.setComponentMap({ Tester });\n      const actual = reactJsonSchema.resolveComponent(stringSchema);\n      expect(React.isValidElement(<actual />)).toBe(true);\n    });\n    it('should resolve components defined as components without a component map.', () => {\n      reactJsonSchema.setComponentMap({}); // a little unecessary, but to paint the picture\n      const actual = reactJsonSchema.resolveComponent(schema);\n      expect(React.isValidElement(<actual />)).toBe(true);\n    });\n    it('should resolve native HTML tags.', () => {\n      spyOn(React, 'createElement');\n      const stringSchema = { component: 'h1' };\n      reactJsonSchema.parseSchema(stringSchema);\n      expect(React.createElement).toHaveBeenCalledWith(stringSchema.component, jasmine.any(Object), undefined);\n    });\n  });\n  describe('when resolving component children', () => {\n    it('should resolve text before resolving child components.', () => {\n      spyOn(React, 'createElement');\n      spyOn(reactJsonSchema, 'resolveComponentChildren');\n      const stringSchema = { component: 'h1', text: 'Hello World' };\n      reactJsonSchema.parseSchema(stringSchema);\n      expect(React.createElement).toHaveBeenCalledWith(jasmine.any(String), jasmine.any(Object), stringSchema.text);\n      expect(reactJsonSchema.resolveComponentChildren).not.toHaveBeenCalled();\n    });\n    it('should return undefined if no child components are present.', () => {\n      const actual = reactJsonSchema.resolveComponentChildren(schema);\n      expect(typeof actual === 'undefined').toBe(true);\n    });\n    it('should return an array with child components if the children attribute is defined by valid sub-schemas.', () => {\n      const largeSchema = Object.assign({}, schema);\n      largeSchema.children = [schema];\n      const actual = reactJsonSchema.resolveComponentChildren(largeSchema);\n      expect(Array.isArray(actual)).toBe(true);\n      expect(!!actual.length).toBe(true);\n    });\n  });\n  describe('when multiple instances of ReactJsonSchema are created with different componentMaps', () => {\n    it('getComponentMap() should return the appropriate value for each instance', () => {\n      const reactJsonSchema1 = new ReactJsonSchema();\n      const componentMap1 = { component1: Tester };\n      reactJsonSchema1.setComponentMap(componentMap1);\n      const reactJsonSchema2 = new ReactJsonSchema();\n      const componentMap2 = { component2: Tester };\n      reactJsonSchema2.setComponentMap(componentMap2);\n      expect(reactJsonSchema1.getComponentMap()).toEqual(componentMap1);\n      expect(reactJsonSchema2.getComponentMap()).toEqual(componentMap2);\n    });\n  });\n});\n"
  },
  {
    "path": "spec/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n  <title>Jasmine Spec Runner</title>\n\n  <link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.2/jasmine.min.css\">\n\n  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.2/jasmine.min.js\"></script>\n  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.2/jasmine-html.min.js\"></script>\n  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.2/boot.min.js\"></script>\n\n  <script src=\"spec.js\"></script>\n\n</head>\n<body></body>\n</html>\n"
  },
  {
    "path": "spec/spec.entry.js",
    "content": "export * from './ReactJsonSchemaSpec.js';\n"
  },
  {
    "path": "spec/support/jasmine.json",
    "content": "{\n  \"spec_dir\": \"spec\",\n  \"spec_files\": [\n    \"**/*[sS]pec.js\"\n  ],\n  \"helpers\": [\n    \"helpers/**/*.js\"\n  ]\n}\n"
  },
  {
    "path": "webpack.config.dist.js",
    "content": "const path = require('path');\nconst CleanWebpackPlugin = require('clean-webpack-plugin');\nconst UglifyJsPlugin = require('uglifyjs-webpack-plugin');\nconst reactJsonSchema = path.join(__dirname, './lib/ReactJsonSchema.js');\nconst distPath = path.join(__dirname, './dist');\n\nmodule.exports = {\n  entry: {\n    'react-json-schema': reactJsonSchema,\n    'react-json-schema.min': reactJsonSchema,\n  },\n  output: {\n    library: 'ReactJsonSchema',\n    libraryTarget: 'umd',\n    path: distPath,\n    filename: '[name].js'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        include: /lib/,\n        exclude: /node_modules/,\n        use: [{\n          loader: 'babel-loader',\n          options: {\n            presets: ['react', 'env'],\n            plugins: ['transform-es2015-destructuring', 'transform-object-rest-spread']\n          }\n        }]\n      }\n    ]\n  },\n  externals: {\n    react: {\n      root: 'React',\n      commonjs2: 'react',\n      commonjs: 'react',\n      amd: 'react'\n    }\n  },\n  resolve: {\n    modules: [\n      path.join(__dirname, 'lib'),\n      'node_modules'\n    ]\n  },\n  plugins: [\n    new CleanWebpackPlugin(distPath),\n    new UglifyJsPlugin({\n      include: /\\.min\\.js$/\n    })\n  ]\n};\n"
  },
  {
    "path": "webpack.config.spec.js",
    "content": "const path = require('path');\nconst srcPath = path.join(__dirname, './spec');\n\nmodule.exports = {\n  entry: path.join(srcPath, 'spec.entry'),\n  output: {\n    path: srcPath,\n    filename: 'spec.js'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        use: [{\n          loader: 'babel-loader',\n          options: {\n            presets: ['react', 'env'],\n            plugins: ['transform-es2015-destructuring', 'transform-object-rest-spread']\n          }\n        }]\n      }\n    ]\n  },\n  resolve: {\n    modules: [\n      path.join(__dirname, 'spec'),\n      path.join(__dirname, 'lib'),\n      'node_modules'\n    ]\n  }\n};\n"
  }
]