{"id":16759545,"url":"https://github.com/cyrildever/es-normalizer","last_synced_at":"2025-04-10T17:15:01.169Z","repository":{"id":42189068,"uuid":"235638516","full_name":"cyrildever/es-normalizer","owner":"cyrildever","description":"Contact data  normalization adapted from the Empreinte Sociométrique's normalizers","archived":false,"fork":false,"pushed_at":"2025-01-30T11:44:32.000Z","size":2565,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T09:45:13.783Z","etag":null,"topics":["data-normalization","javascript-library","typescript-library"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyrildever.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-22T18:31:40.000Z","updated_at":"2025-01-30T11:44:36.000Z","dependencies_parsed_at":"2024-04-05T11:36:51.428Z","dependency_job_id":"b1b0b9bb-0978-4945-8e69-36a09f9cd38c","html_url":"https://github.com/cyrildever/es-normalizer","commit_stats":{"total_commits":92,"total_committers":3,"mean_commits":"30.666666666666668","dds":0.1630434782608695,"last_synced_commit":"d6d2306cb820016928e214ba925bb693a9eb9717"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fes-normalizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fes-normalizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fes-normalizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fes-normalizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyrildever","download_url":"https://codeload.github.com/cyrildever/es-normalizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261916,"owners_count":21074225,"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":["data-normalization","javascript-library","typescript-library"],"created_at":"2024-10-13T04:08:24.259Z","updated_at":"2025-04-10T17:15:01.129Z","avatar_url":"https://github.com/cyrildever.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# es-normalizer\n\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/cyrildever/es-normalizer)\n![npm](https://img.shields.io/npm/dw/es-normalizer)\n![GitHub last commit](https://img.shields.io/github/last-commit/cyrildever/es-normalizer)\n![GitHub issues](https://img.shields.io/github/issues/cyrildever/es-normalizer)\n![NPM](https://img.shields.io/npm/l/es-normalizer)\n\nThis is a TypeScript normalization library for contact data (address, phones, etc.) adapted from [Edgewhere](https://www.edgewhere.fr)'s Empreinte Sociométrique patented normalizers. It's working in both the browser and a NodeJS environment.\n\n### Motivation\n\nWhen it comes to hashing data, the necessary uniqueness of the source sometimes makes it hard to compare two hashed data, mostly if dealing with postal address. This library helps normalizing any contact data (the postal or e-mail address, the mobile or landline phone number, the title, names or date of birth of an individual) that would feed any hashing algorithm to make hash comparison always trustable.\nIt's based on the work for the Empreinte Sociométrique\u0026trade; patented by Cyril Dever for Edgewhere. For more information on the latter, please [contact us](mailto:contact@edgewhere.fr).\n\nYou might also want to read our [white paper](documentation/src/latex/es_whitepaper.pdf).\n\n\n### Usage\n\n```\nnpm i es-normalizer\n```\n\n*IMPORTANT*: as of this version, most normalizers are for use on French data.\n\nTo get a normalized string, you simply need to use the `normalize()` method passing it the data, a normalizer function and eventual arguments.\nThere are currently eleven specific normalizer functions and a generic one:\n* `Any`: the generic normalizer should be used if no specific normalizer exists;\n* `AddressLine`: pass any address line through it to get a normalized address, eg. `8, rue Henner` becomes `8 RUE HENNER`, and eventually `true` as parameter when trying to normalize a French address line 1 to also transform the title, eg. `Monsieur Cyril Dever` should then become `1 CYRIL DEVER` when passed `true` instead of `MONSIEUR CYRIL DEVER` for the default behaviour;\n* `AddressLine6`: the French address line 6 with the department inserted in between the zip code and the city as in the Empreinte Sociométrique implementation (eg. `75009 75 PARIS`);\n* `City`: for normalizing city names (it removes any Cedex mention in French address, for instance);\n* `CodePostalFrance`: for French zip code;\n* `DateOfBirth`: pass a date and up to two parameters: the input format (eg. `YYYY-MM-DD`) and the output format wished (eg. `normalizer.ISO_FORMAT`), the default values being respectively the ISO format and the French date format;\n* `DepartementFrance`: extract the French departement number (out of a code postal, for instance);\n* `Email`: validates the passed e-mail and returns it in lower-case;\n* `FirstName`: pass a first name and get a normalized one (it uses an enlarged French dictionay of first names to process it making it possible to pass from `\"J.-Louis\"` to `\"JEAN LOUIS\"`);\n* `Mobile`: to validate a French mobile phone;\n* `PhoneNumber`: to normalize a French phone or fax number in the international format, eg. `+33 (0) 123 456 789`;\n* `StreetNumber`: parses the passed field to normalize it the Empreinte Sociométrique\u0026trade;'s way, eg. `1bis` or `1 bis` becomes `1B`;\n* `Title`: returns a code depending on the passed string (1 for gentlemen, 2 for ladies, 0 when undefined or unknown).\n\n```typescript\nimport * as esNormalizer from 'es-normalizer'\n\nconst anyStringNormalized = esNormalizer.normalize('#This is any String(). ', esNormalizer.Any)\n// THIS IS ANY STRING\nconsole.log(anyStringNormalized.getOrElse(''))\n\nconst addressLine1Normalized = esNormalizer.normalize('Monsieur Cyril Dever', esNormalizer.AddressLine(true))\n// 1 CYRIL DEVER\nconsole.log(addressLine1Normalized.getOrElse(''))\n\nconst addressLine4Normalized = esNormalizer.normalize('24, rué de Maubeuge', esNormalizer.AddressLine())\n// 24 RUE MAUBEUGE\nconsole.log(addressLine4Normalized.getOrElse(''))\n\nlet addressLine6Normalized = esNormalizer.normalize('75009 .# Paris', esNormalizer.AddressLine6())\n// 75009 75 PARIS\nconsole.log(addressLine6Normalized.getOrElse(''))\n\naddressLine6Normalized = esNormalizer.normalize('75009 .# Paris', esNormalizer.AddressLine6(false))\n// 75009 PARIS\nconsole.log(addressLine6Normalized.getOrElse(''))\n\nconst cityNormalized = esNormalizer.normalize('Paris Cedex 09', esNormalizer.City)\n// PARIS\nconsole.log(cityNormalized.getOrElse(''))\n\nconst ddnNormalized = esNormalizer.normalize('70/12/01', esNormalizer.DateOfBirth, 'YY/MM/DD', esNormalizer.FRENCH_DATE)\n// 01/12/1970\nconsole.log(ddnNormalized.getOrElse(''))\n\nconst dptNormalized = esNormalizer.normalize(' 75009 ', esNormalizer.DepartementFrance)\n// 75\nconsole.log(dptNormalized.getOrElse(''))\n\nconst emailNormalized = esNormalizer.normalize(' Contact@GMAIL.com', esNormalizer.Email)\n// contact@gmail.com\nconsole.log(emailNormalized.getOrElse(''))\n\nconst firstNameNormalized = esNormalizer.normalize('J.-Michel', esNormalizer.FirstName)\n// JEAN MICHEL\nconsole.log(firstNameNormalized.getOrElse(''))\n\nconst mobileNormalized = esNormalizer.normalize('06.23.45.67.89', esNormalizer.Mobile)\n// +33 (0) 123 456 789\nconsole.log(mobileNormalized.getOrElse(''))\n\nconst phoneNormalized = esNormalizer.normalize('0123456789', esNormalizer.PhoneNumber)\n// +33 (0) 123 456 789\nconsole.log(phoneNormalized.getOrElse(''))\n\nconst streetNumberNormalized = esNormalizer.normalize('1bis', esNormalizer.StreetNumber)\n// 1B\nconsole.log(streetNumberNormalized.getOrElse(''))\n\nconst titleNormalized = esNormalizer.normalize('Mademoiselle', esNormalizer.Title)\n// 2\nconsole.log(titleNormalized.getOrElse(''))\n```\n\n##### Dependencies\n\nThis library relies on the following dependencies:\n* [`moment`](https://www.npmjs.com/package/moment);\n* [`ts-utls`](https://www.npmjs.com/package/ts-utls).\n\nBesides, to run the tests, you would need to install [`live-server`](https://www.npmjs.com/package/live-server):\n```console\nnpm i -g live-server\n```\n\n\n### License\n\nThis module is distributed under a MIT license. \\\nSee the [LICENSE](LICENSE) file.\n\n\n\u003chr /\u003e\n\u0026copy; 2020-2025 Cyril Dever. All rights reserved.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyrildever%2Fes-normalizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyrildever%2Fes-normalizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyrildever%2Fes-normalizer/lists"}