{"id":16430414,"url":"https://github.com/nikhil22/namespace-it","last_synced_at":"2025-07-12T04:34:52.586Z","repository":{"id":57307685,"uuid":"85886449","full_name":"Nikhil22/namespace-it","owner":"Nikhil22","description":"Apply a namespace to any block of code contained inside a function, or in a javascript file.","archived":false,"fork":false,"pushed_at":"2017-03-23T00:20:40.000Z","size":107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T10:19:25.047Z","etag":null,"topics":["es6-javascript","execution-context","functions","javascript","namespace","scope"],"latest_commit_sha":null,"homepage":null,"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/Nikhil22.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}},"created_at":"2017-03-22T23:34:48.000Z","updated_at":"2017-03-22T23:54:36.000Z","dependencies_parsed_at":"2022-09-17T11:02:33.646Z","dependency_job_id":null,"html_url":"https://github.com/Nikhil22/namespace-it","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikhil22%2Fnamespace-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikhil22%2Fnamespace-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikhil22%2Fnamespace-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikhil22%2Fnamespace-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nikhil22","download_url":"https://codeload.github.com/Nikhil22/namespace-it/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240645255,"owners_count":19834391,"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":["es6-javascript","execution-context","functions","javascript","namespace","scope"],"created_at":"2024-10-11T08:26:54.133Z","updated_at":"2025-02-25T09:45:22.801Z","avatar_url":"https://github.com/Nikhil22.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Namespace-It - Apply a namespace to any block of code contained inside a function, or in a javascript file.\n\n## Overview of full workflow\nGrab the scope variables of a function or a file.\n\n\u003cp\u003e\n  \u003cimg src=\"https://github.com/Nikhil22/namespace-it/blob/master/images/full-workflow.png\"\u003e\n\u003c/p\u003e\n\n## Usage - Step by Step\n### Require the namespaceit module\n```javascript\nconst NamespaceIt = require('namespaceit');\n```\n\n### Pick any function in your code block. For example...\n```javascript\nfunction someFunction() {\n  const number = 1;\n  const string = 'string';\n  const array = [1,2];\n  const object = {\n    hey: 'you',\n    fn: function() {\n      return 1;\n    }\n  };\n  function functionStatement() {\n    return 'I\\'m a function statement';\n  };\n  const functionExpression = function() {\n    return 'I\\'m a function expression';\n  };\n}\n```\n### Initialize a new namespaceit object\n```javascript\nconst namespaceIt = new NamespaceIt('A', someFunction);\n```\n\n### Call applyNamespace method\n```javascript\nnamespaceIt.applyNamespace();\n```\n\n### See the magic happen\n```javascript\nA.object.fn(); //1\nA.array; //[1,2]\n```\n\n### Clear the namespace if you want\n```javascript\nnamespaceIt.clearNamespace();\n//A is no longer defined!\n```\n\n## Limitations\n\u003cul\u003e\n  \u003cli\u003eDoes not currently support arrow function syntax\u003c/li\u003e\n  \u003cli\u003eCode must be properly linted with semi colons after each line\u003c/li\u003e\n  \u003cli\u003eFunctions with arguments are not yet supported\u003c/li\u003e\n  \u003cli\u003eVariable declared as a reference to another variable in scope is not yet supported\u003c/li\u003e\n\u003c/ul\u003e\n\n## Improvements\nAll points under \u003cstrong\u003eLimitations\u003c/strong\u003e are being worked on until they are no longer limitations. If this project excites you, feel free to submit a pull request.\n\n## External Modules/libraries used\n\u003cul\u003e\n  \u003cli\u003e\u003cstrong\u003eesprima\u003c/strong\u003e: npm module for parsing\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eJasmine\u003c/strong\u003e: javascript framework for unit testing\u003c/li\u003e\n\u003c/ul\u003e\n\n### Author\nNikhil Bhaskar\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhil22%2Fnamespace-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikhil22%2Fnamespace-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhil22%2Fnamespace-it/lists"}