{"id":15065298,"url":"https://github.com/jaydenseric/revertable-globals","last_synced_at":"2025-07-13T07:31:12.404Z","repository":{"id":62354859,"uuid":"282795258","full_name":"jaydenseric/revertable-globals","owner":"jaydenseric","description":"Sets globals in a JavaScript environment that can be easily reverted to restore the original environment; useful for testing code that relies on the presence of certain globals.","archived":false,"fork":false,"pushed_at":"2022-08-18T10:06:31.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-14T11:26:09.635Z","etag":null,"topics":["esm","maintained","mjs","node","npm"],"latest_commit_sha":null,"homepage":"https://npm.im/revertable-globals","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/jaydenseric.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/funding.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"jaydenseric"}},"created_at":"2020-07-27T04:39:03.000Z","updated_at":"2023-03-10T09:27:21.000Z","dependencies_parsed_at":"2022-10-31T10:47:09.748Z","dependency_job_id":null,"html_url":"https://github.com/jaydenseric/revertable-globals","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Frevertable-globals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Frevertable-globals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Frevertable-globals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Frevertable-globals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaydenseric","download_url":"https://codeload.github.com/jaydenseric/revertable-globals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225862812,"owners_count":17535998,"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":["esm","maintained","mjs","node","npm"],"created_at":"2024-09-25T00:36:28.056Z","updated_at":"2024-11-22T08:12:18.162Z","avatar_url":"https://github.com/jaydenseric.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jaydenseric"],"categories":[],"sub_categories":[],"readme":"# revertable-globals\n\nSets globals in a JavaScript environment that can be easily reverted to restore the original environment; useful for testing code that relies on the presence of certain globals.\n\n## Installation\n\nFor [Node.js](https://nodejs.org), to install [`revertable-globals`](https://npm.im/revertable-globals) with [npm](https://npmjs.com/get-npm), run:\n\n```sh\nnpm install revertable-globals --save-dev\n```\n\nFor [Deno](https://deno.land), an example import map:\n\n```json\n{\n  \"imports\": {\n    \"revertable-globals\": \"https://unpkg.com/revertable-globals@4.0.0/revertableGlobals.mjs\"\n  }\n}\n```\n\nThen, import and use the function [`revertableGlobals`](./revertableGlobals.mjs).\n\n## Requirements\n\nSupported runtime environments:\n\n- [Node.js](https://nodejs.org) versions `^14.17.0 || ^16.0.0 || \u003e= 18.0.0`.\n- [Deno](https://deno.land).\n\nNon [Deno](https://deno.land) projects must configure [TypeScript](https://typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment:\n\n- [`compilerOptions.allowJs`](https://typescriptlang.org/tsconfig#allowJs) should be `true`.\n- [`compilerOptions.maxNodeModuleJsDepth`](https://typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`.\n- [`compilerOptions.module`](https://typescriptlang.org/tsconfig#module) should be `\"node16\"` or `\"nodenext\"`.\n\n## Exports\n\nThe [npm](https://npmjs.com) package [`revertable-globals`](https://npm.im/revertable-globals) features [optimal JavaScript module design](https://jaydenseric.com/blog/optimal-javascript-module-design). These ECMAScript modules are exported via the [`package.json`](./package.json) field [`exports`](https://nodejs.org/api/packages.html#exports):\n\n- [`revertableGlobals.mjs`](./revertableGlobals.mjs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Frevertable-globals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaydenseric%2Frevertable-globals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Frevertable-globals/lists"}