{"id":16324170,"url":"https://github.com/matheus1lva/schema-normalizer","last_synced_at":"2025-05-14T15:14:23.449Z","repository":{"id":57137227,"uuid":"127333428","full_name":"matheus1lva/schema-normalizer","owner":"matheus1lva","description":"Data normalizer based on a pseudo schema","archived":false,"fork":false,"pushed_at":"2023-04-23T21:57:48.000Z","size":83,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-27T16:49:06.308Z","etag":null,"topics":["extract","normalizer","schema"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matheus1lva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-03-29T18:44:57.000Z","updated_at":"2018-07-24T18:23:00.000Z","dependencies_parsed_at":"2022-09-01T04:01:08.663Z","dependency_job_id":"bf7effb4-8e15-4559-bb28-94d8894b4e7a","html_url":"https://github.com/matheus1lva/schema-normalizer","commit_stats":null,"previous_names":["playma256/schema-normalizer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheus1lva%2Fschema-normalizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheus1lva%2Fschema-normalizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheus1lva%2Fschema-normalizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheus1lva%2Fschema-normalizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matheus1lva","download_url":"https://codeload.github.com/matheus1lva/schema-normalizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254170077,"owners_count":22026220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extract","normalizer","schema"],"created_at":"2024-10-10T22:56:52.533Z","updated_at":"2025-05-14T15:14:23.419Z","avatar_url":"https://github.com/matheus1lva.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# schema-normalizer\n## Installation\n`npm i @playma256/schema-normalizer --save` or `yarn add @playma256/schema-normalizer -S`\n\n## Motivations\nWell, i needed a data normalizer, but a simple one which i could say which properties of something i needed and that would be exported.\nSo i searched the whole internet seeking for a simple solution, which i could not find.\n\nIn a nutshell, this is a normalizer/extracter in steroids.\n\n## How to use it\nGiven an object, i.e, data.\n\n```javascript\n{\n  prop1: [some array with strings],\n  prop2: [{prop21: 'teste', prop22: 'teste2'}],\n  prop4: {\n    prop41: 'something',\n    prop42: 'something2'\n  }\n}\n```\n\nWe would like to extract just prop22 from prop2 and everything from prop4, but we would like to have a prop5, empty string, just for normalization purposes, so how do we do that?\n\nFirst: we create a \"pseudo\" schema.\n\n```javascript\nexport default {\n  prop2: ['prop22'],\n  prop4: \"*\",\n  prop5: ''\n}\n```\n\n``` javascript\nconst normalizer = require('@playma256/schema-normalizer');\n\nconst data = {\n  prop1: [some array with strings],\n  prop2: [{prop21: 'teste', prop22: 'teste2'}],\n  prop4: {\n    prop41: 'something',\n    prop42: 'something2'\n  }\n};\n\nconst finalData = normalizer(schema, data);\n```\n\nAs a result:\n```javascript\nconsole.log(finalData);\n\u003e\u003e {\n  prop2: [{prop22: 'teste2'}],\n  prop4: {\n    prop41: 'something',\n    prop42: 'something2'\n  },\n  prop5: ''\n};\n```\n\nThis lib has two wildcards that can be used at the moment:\n- \\* (asterisk) -\u003e this means, everything from the property.\n- ! (optional) -\u003e if it has this value, add, if not, omit.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheus1lva%2Fschema-normalizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatheus1lva%2Fschema-normalizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheus1lva%2Fschema-normalizer/lists"}