{"expireTime":9007200821629618000,"key":"gatsby-plugin-mdx-entire-payload-e70157c1477ea5305f92604631398d21-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"type:","position":{"start":{"line":2,"column":3,"offset":3},"end":{"line":2,"column":8,"offset":8},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":10,"offset":10},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":2,"column":10,"offset":10},"end":{"line":2,"column":11,"offset":11},"indent":[]}},{"type":"inlineCode","value":"(data: *, entities: Object = {}) => NormalizeState","position":{"start":{"line":2,"column":11,"offset":11},"end":{"line":2,"column":63,"offset":63},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":63,"offset":63},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Use the schemas relationships to normalize for storage.","position":{"start":{"line":4,"column":1,"offset":65},"end":{"line":4,"column":56,"offset":120},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":65},"end":{"line":4,"column":56,"offset":120},"indent":[]}},{"type":"code","lang":"js","meta":"live=true","value":"function Normalize() {\n    const person = new EntitySchema('person', {\n        shape: new ObjectSchema({})\n    });\n    const people = new ArraySchema(person);\n\n\n    // Will only store two entities and merge their first and last names\n    const state = people.normalize([\n        {id: 'foo', name: 'fooschia'},\n        {id: 'bar', name: 'bartholomew'},\n        {id: 'foo', lastName: 'foofoo'},\n        {id: 'bar', lastName: 'barterer'},\n    ]);\n\n    return <JSON>{state}</JSON>;\n}","position":{"start":{"line":6,"column":1,"offset":122},"end":{"line":24,"column":4,"offset":621},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"You can provide existing entities this will perform a merge.","position":{"start":{"line":26,"column":3,"offset":625},"end":{"line":26,"column":63,"offset":685},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":625},"end":{"line":26,"column":63,"offset":685},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":623},"end":{"line":26,"column":63,"offset":685},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"The input shape must match the shape of the definition schema.","position":{"start":{"line":27,"column":3,"offset":688},"end":{"line":27,"column":65,"offset":750},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":688},"end":{"line":27,"column":65,"offset":750},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":686},"end":{"line":27,"column":65,"offset":750},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":623},"end":{"line":27,"column":65,"offset":750},"indent":[1]}},{"type":"export","value":"export const _frontmatter = {}","position":{"start":{"line":30,"column":1,"offset":753},"end":{"line":30,"column":31,"offset":783},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":30,"column":31,"offset":783}}},"scopeImports":[],"scopeIdentifiers":[],"rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {};\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n  console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\")\n  return <div {...props}/>\n};\n\nconst layoutProps = {\n  _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n  components,\n  ...props\n}) {\n  return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n    <p><strong parentName=\"p\">{`type:`}</strong>{` `}<inlineCode parentName=\"p\">{`(data: *, entities: Object = {}) => NormalizeState`}</inlineCode></p>\n    <p>{`Use the schemas relationships to normalize for storage.`}</p>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\",\n        \"metastring\": \"live=true\",\n        \"live\": \"true\"\n      }}>{`function Normalize() {\n    const person = new EntitySchema('person', {\n        shape: new ObjectSchema({})\n    });\n    const people = new ArraySchema(person);\n\n\n    // Will only store two entities and merge their first and last names\n    const state = people.normalize([\n        {id: 'foo', name: 'fooschia'},\n        {id: 'bar', name: 'bartholomew'},\n        {id: 'foo', lastName: 'foofoo'},\n        {id: 'bar', lastName: 'barterer'},\n    ]);\n\n    return <JSON>{state}</JSON>;\n}\n`}</code></pre>\n    <ul>\n      <li parentName=\"ul\">{`You can provide existing entities this will perform a merge.`}</li>\n      <li parentName=\"ul\">{`The input shape must match the shape of the definition schema.`}</li>\n    </ul>\n\n    </MDXLayout>;\n}\n\n;\nMDXContent.isMDXComponent = true;"}}