{"id":17757852,"url":"https://github.com/lopatnov/namespace","last_synced_at":"2026-01-19T12:32:49.200Z","repository":{"id":42721658,"uuid":"286341194","full_name":"lopatnov/namespace","owner":"lopatnov","description":"Dynamic namespace creation","archived":false,"fork":false,"pushed_at":"2024-08-04T22:47:11.000Z","size":636,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-17T04:05:17.962Z","etag":null,"topics":["namespace","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lopatnov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"lopatnov"}},"created_at":"2020-08-10T00:34:46.000Z","updated_at":"2024-08-04T22:47:14.000Z","dependencies_parsed_at":"2024-08-05T00:20:57.196Z","dependency_job_id":null,"html_url":"https://github.com/lopatnov/namespace","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"1aa3693714d8584525104382bb7f950e414a3f24"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":"My-Templates/TypeScript-Library","purl":"pkg:github/lopatnov/namespace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopatnov%2Fnamespace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopatnov%2Fnamespace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopatnov%2Fnamespace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopatnov%2Fnamespace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lopatnov","download_url":"https://codeload.github.com/lopatnov/namespace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopatnov%2Fnamespace/sbom","scorecard":{"id":598900,"data":{"date":"2025-08-11","repo":{"name":"github.com/lopatnov/namespace","commit":"036ea05f7360129c00f4774eb27fc7e5a23b7793"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build-and-test-package.yml:1","Warn: no topLevel permission defined: .github/workflows/publish-npm-package.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test-package.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/build-and-test-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test-package.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/build-and-test-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm-package.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/publish-npm-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm-package.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/publish-npm-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm-package.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/publish-npm-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm-package.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/publish-npm-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm-package.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/publish-npm-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm-package.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/lopatnov/namespace/publish-npm-package.yml/master?enable=pin","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/17 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"20 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T23:51:32.697Z","repository_id":42721658,"created_at":"2025-08-20T23:51:32.697Z","updated_at":"2025-08-20T23:51:32.697Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28567896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["namespace","typescript"],"created_at":"2024-10-26T17:09:15.552Z","updated_at":"2026-01-19T12:32:49.184Z","avatar_url":"https://github.com/lopatnov.png","language":"TypeScript","funding_links":["https://patreon.com/lopatnov"],"categories":[],"sub_categories":[],"readme":"# @lopatnov/namespace \n\n[![npm](https://img.shields.io/npm/dt/@lopatnov/namespace)](https://www.npmjs.com/package/@lopatnov/namespace)\n[![NPM version](https://badge.fury.io/js/%40lopatnov%2Fnamespace.svg)](https://www.npmjs.com/package/@lopatnov/namespace)\n[![License](https://img.shields.io/github/license/lopatnov/namespace)](https://github.com/lopatnov/namespace/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/lopatnov/namespace)](https://github.com/lopatnov/namespace/issues)\n[![GitHub forks](https://img.shields.io/github/forks/lopatnov/namespace)](https://github.com/lopatnov/namespace/network)\n[![GitHub stars](https://img.shields.io/github/stars/lopatnov/namespace)](https://github.com/lopatnov/namespace/stargazers)\n![GitHub top language](https://img.shields.io/github/languages/top/lopatnov/namespace)\n[![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/@lopatnov/namespace)](https://www.npmjs.com/package/@lopatnov/namespace?activeTab=dependencies)\n[![LinkedIn](https://img.shields.io/badge/LinkedIn-lopatnov-informational?style=social\u0026logo=linkedin)](https://www.linkedin.com/in/lopatnov/)\n\nDynamic namespace creation\n\n## Install\n\nAs NPM package\n\n```shell\nnpm install @lopatnov/namespace\n```\n\nAs browser script\n\n```html\n\u003cscript src=\"//lopatnov.github.io/namespace/dist/namespace.min.js\"\u003e\u003c/script\u003e\n```\n\n## Import package to the project\n\n### ESM import\n\n```typescript\nimport Namespace from \"@lopatnov/namespace\";\n```\n\n### CJS require\n\n```javascript\nvar Namespace = require(\"@lopatnov/namespace\");\n```\n\n## TypeScript and JavaScript samples\n\n### namespace creation\n\n```ts\nconst ns = new Namespace(); // \u003c-- create namespace variable\n\nns.namespace(\"a.b.c.d\"); // \u003c-- create inner namespaces\nns.namespace(\"a.b.c.e\"); // \u003c-- Function namespace(path: NamespacePath): Namespace\nns.namespace(\"a.b.f.g\"); // \u003c--\nns.namespace(\"a.i.h.k\"); // \u003c--\nns.namespace(\"a.i.h.l\"); // \u003c--\nns.namespace(\"a.m.n.o\"); // \u003c--\n\n// Access to inner namespaces\nconst anyNS: any = ns; // \u003c-- to avoid type casting\nconsole.log(anyNS.a.b.f.g instanceof Namespace); // true\nconsole.log((ns as any).a.b.c.d instanceof Namespace); // true\nconsole.log((ns as any).a.b.c.e instanceof Namespace); // true\n```\n\n### attach namespace to a current object\n\n```ts\nlet shapes = {\n    color: \"green\",\n    count: 3\n};\nlet shapesSpace = Namespace.attach(shapes); // \u003c-- Namespace.attach(to: T) =\u003e T \u0026 Namespace\n\nshapesSpace.namespace('Triangles');\nshapesSpace.namespace('Circles');\nshapesSpace.namespace('Rectangles.Squares');\n\nconsole.log(shapesSpace.exists('Triangles')); // true\nconsole.log(shapesSpace.exists('Circles')); // true\nconsole.log(shapesSpace.exists('Rectangles.Squares')); // true\nconsole.log(shapesSpace.color); // \"green\"\nconsole.log(shapesSpace.count); // 3\nconsole.log(shapes === shapesSpace); // true\n```\n\n#### checking that object inside namespace exists\n\n```ts\n// Function exists(path: NamespacePath): boolean\nconsole.log(ns.exists('a.b.c.d')); // true\nconsole.log(ns.exists('a.b.c.e')); // true\nconsole.log(ns.exists('a.b.f.g')); // true\nconsole.log(ns.exists('a.i.h.k')); // true\nconsole.log(ns.exists('a.i.h.l')); // true\nconsole.log(ns.exists('a.m.n.o')); // true\n```\n\n### create namespace through direct call\n\n```ts\nvar dynamicNamespace: any = Namespace; // \u003c-- escape current TypeScript restrictions with any Type\nvar a = dynamicNamespace('Pacific.Ocean'); // \u003c-- call as function\nconsole.log(a.Pacific.Ocean instanceof Namespace); // true\n```\n\n### create namespace through new operator\n\n```ts\nvar n: any = new Namespace(\"Hello.World\");\nconsole.log(n.Hello.World instanceof Namespace); // true\n```\n\n```ts\nvar eeny: any = new Namespace('meeny.miny.moe[Catch][a][tiger][by][the][toe]');\nconsole.log(eeny.meeny.miny.moe.Catch.a.tiger.by.the.toe instanceof Namespace);  // true\n```\n\n### go to inner object\n\n```ts\nvar kitchenRadar = new Namespace();\n    kitchenRadar.namespace('big.fruits');\n    kitchenRadar.namespace('big.eggs');\n    kitchenRadar.namespace('small.dishes');\n    kitchenRadar.namespace('small.cookies');\n\n    var fruits = kitchenRadar.goto('big.fruits'); // \u003c-- goto(path: NamespacePath): any\n    var eggs = kitchenRadar.goto('big.eggs');\n    var dishes = kitchenRadar.goto('small.dishes');\n    var cookies = kitchenRadar.goto('small.cookies');\n\n    console.log(fruits === (kitchenRadar as any).big.fruits); // true\n    console.log(eggs === (kitchenRadar as any).big.eggs); // true\n    console.log(dishes === (kitchenRadar as any).small.dishes); // true\n    console.log(cookies === (kitchenRadar as any).small.cookies); // true\n```\n\n### apply namespace as a property of an object\n\n```ts\nvar persons: any = {};\nvar extension = new Namespace('with.small.kitty');\n\nextension.applyTo(persons, 'Julia'); // Function applyTo(context: any, name: string): void\nextension.applyTo(persons, 'Kathy');\nextension.applyTo(persons, 'Liza');\n\nconsole.log(persons.Julia.with.small.kitty instanceof Namespace); // true\nconsole.log(persons.Kathy.with.small.kitty instanceof Namespace); // true\nconsole.log(persons.Liza.with.small.kitty instanceof Namespace); // true\n```\n\n## Demo\n\nSee, how it's working: [https://runkit.com/lopatnov/namespace](https://runkit.com/lopatnov/namespace)\n\nTest it with a runkit: [https://npm.runkit.com/@lopatnov/namespace](https://npm.runkit.com/%40lopatnov%2Fnamespace)\n\n## Rights and Agreements\n\nLicense [Apache-2.0](https://github.com/lopatnov/namespace/blob/master/LICENSE)\n\nCopyright 2020–2021 Oleksandr Lopatnov\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flopatnov%2Fnamespace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flopatnov%2Fnamespace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flopatnov%2Fnamespace/lists"}