{"id":31425069,"url":"https://github.com/es-shims/string.prototype.towellformed","last_synced_at":"2025-09-30T04:55:24.424Z","repository":{"id":65990754,"uuid":"536248597","full_name":"es-shims/String.prototype.toWellFormed","owner":"es-shims","description":"An ESnext spec-compliant `String.prototype.toWellFormed` shim/polyfill/replacement that works as far down as ES3.","archived":false,"fork":false,"pushed_at":"2024-03-20T20:47:56.000Z","size":48,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-07T05:31:34.507Z","etag":null,"topics":["ecmascript","javascript","pair","polyfill","shim","string","surrogate","unicode","well-formed"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/es-shims.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},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/es5-shim","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-09-13T17:57:21.000Z","updated_at":"2023-04-11T15:54:13.000Z","dependencies_parsed_at":"2024-03-20T19:06:42.007Z","dependency_job_id":null,"html_url":"https://github.com/es-shims/String.prototype.toWellFormed","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"964ea7c8387ba68556ffabc24510240c0f2a4515"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/es-shims/String.prototype.toWellFormed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.toWellFormed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.toWellFormed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.toWellFormed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.toWellFormed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/es-shims","download_url":"https://codeload.github.com/es-shims/String.prototype.toWellFormed/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.toWellFormed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277632373,"owners_count":25850734,"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","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ecmascript","javascript","pair","polyfill","shim","string","surrogate","unicode","well-formed"],"created_at":"2025-09-30T04:55:21.155Z","updated_at":"2025-09-30T04:55:24.419Z","avatar_url":"https://github.com/es-shims.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ljharb","https://tidelift.com/funding/github/npm/es5-shim"],"categories":[],"sub_categories":[],"readme":"# string.prototype.towellformed \u003csup\u003e[![Version Badge][npm-version-svg]][package-url]\u003c/sup\u003e\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![dependency status][deps-svg]][deps-url]\n[![dev dependency status][dev-deps-svg]][dev-deps-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nAn ESnext spec-compliant `String.prototype.toWellFormed` shim/polyfill/replacement that works as far down as ES3.\n\nThis package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the expected ES2024 [spec](https://tc39.es/proposal-is-usv-string/).\n\nBecause `String.prototype.toWellFormed` depends on a receiver (the `this` value), the main export takes the string to operate on as the first argument.\n\n## Getting started\n\n```sh\nnpm install --save string.prototype.towellformed\n```\n\n## Usage/Examples\n\n```js\nvar toWellFormed = require('string.prototype.towellformed');\nvar assert = require('assert');\n\nvar leadingPoo = '\\uD83D';\nvar trailingPoo = '\\uDCA9';\nvar wholePoo = leadingPoo + trailingPoo;\n\nvar replacementChar = '\\uFFFD';\n\nassert.equal(toWellFormed(wholePoo), wholePoo);\nassert.equal(toWellFormed(leadingPoo), replacementChar);\nassert.equal(toWellFormed(trailingPoo), replacementChar);\n```\n\n```js\nvar toWellFormed = require('string.prototype.towellformed');\nvar assert = require('assert');\n/* when String#toWellFormed is not present */\ndelete String.prototype.toWellFormed;\nvar shimmed = toWellFormed.shim();\n\nassert.equal(shimmed, toWellFormed.getPolyfill());\nassert.deepEqual(wholePoo.toWellFormed(), toWellFormed(wholePoo));\nassert.deepEqual(leadingPoo.toWellFormed(), toWellFormed(leadingPoo));\nassert.deepEqual(trailingPoo.toWellFormed(), toWellFormed(trailingPoo));\n```\n\n```js\nvar toWellFormed = require('string.prototype.towellformed');\nvar assert = require('assert');\n/* when String#at is present */\nvar shimmed = toWellFormed.shim();\n\nassert.equal(shimmed, String.prototype.toWellFormed);\nassert.deepEqual(wholePoo.toWellFormed(), toWellFormed(wholePoo));\nassert.deepEqual(leadingPoo.toWellFormed(), toWellFormed(leadingPoo));\nassert.deepEqual(trailingPoo.toWellFormed(), toWellFormed(trailingPoo));\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/string.prototype.towellformed\n[npm-version-svg]: https://versionbadg.es/es-shims/String.prototype.toWellFormed.svg\n[deps-svg]: https://david-dm.org/es-shims/String.prototype.toWellFormed.svg\n[deps-url]: https://david-dm.org/es-shims/String.prototype.toWellFormed\n[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.toWellFormed/dev-status.svg\n[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.toWellFormed#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/string.prototype.towellformed.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/string.prototype.towellformed.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/string.prototype.towellformed.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.towellformed\n[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.toWellFormed/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.toWellFormed/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.toWellFormed\n[actions-url]: https://github.com/es-shims/String.prototype.toWellFormed/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Fstring.prototype.towellformed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fes-shims%2Fstring.prototype.towellformed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Fstring.prototype.towellformed/lists"}