{"id":21056648,"url":"https://github.com/dhruv-kumar-jha/loka","last_synced_at":"2026-06-08T16:04:46.176Z","repository":{"id":143887497,"uuid":"83532367","full_name":"dhruv-kumar-jha/loka","owner":"dhruv-kumar-jha","description":"Loka: make your data accessible throughout the application without declaring them globally","archived":false,"fork":false,"pushed_at":"2017-03-02T06:37:39.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T14:07:06.573Z","etag":null,"topics":["app-store","global-store","global-variables","local-store","nodejs"],"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/dhruv-kumar-jha.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2017-03-01T08:43:31.000Z","updated_at":"2019-09-03T23:19:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"78b228fe-3a06-4d14-a6c8-8325b851cf1d","html_url":"https://github.com/dhruv-kumar-jha/loka","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dhruv-kumar-jha/loka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv-kumar-jha%2Floka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv-kumar-jha%2Floka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv-kumar-jha%2Floka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv-kumar-jha%2Floka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhruv-kumar-jha","download_url":"https://codeload.github.com/dhruv-kumar-jha/loka/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv-kumar-jha%2Floka/sbom","scorecard":{"id":340504,"data":{"date":"2025-08-11","repo":{"name":"github.com/dhruv-kumar-jha/loka","commit":"9d4530de36a28b758ec38be296a67e081891a9c4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/4 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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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"}}]},"last_synced_at":"2025-08-18T05:41:38.625Z","repository_id":143887497,"created_at":"2025-08-18T05:41:38.625Z","updated_at":"2025-08-18T05:41:38.625Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34069500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":["app-store","global-store","global-variables","local-store","nodejs"],"created_at":"2024-11-19T16:52:29.300Z","updated_at":"2026-06-08T16:04:46.171Z","avatar_url":"https://github.com/dhruv-kumar-jha.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loka\n#### Easily make your data accessible throughout the application without declaring them globally.\n\nGeneral features:\n\n * **set**: set your variable\n * **get**: get the variable that you've already set\n * **update**: update an existing variable\n * **delete**: delete an existing variable\n * **store**: access the entire store\n\n\n### Use Case\n\nLot of times we have to make certain data available throughout the the application, These could be config variables, data we received from the middlewares/database/thirdparty, etc.\n\nSpecially in express, If you're doing token based authentication or if your app is multi tenant, You will need access to the user and tenant information throughout the application, And the only way to do it is either by passing the `req` param to all the methods or using `globals` which is not recommended, or using a helper module which stores and manages the data.\n\n**This is that helper module** (unless you're already using one or have created one, in that case you dont need it.)\nIts simple, readable and gets the job done.\n\n\n### Installation\n\nLet's get started by installing the library,\nDo `npm install loka --save`\n\n\nAnd then require/import in your project like\n\n```javascript\nimport 'Loka' from 'loka';\n// or\nconst Loka = require('loka');\n```\n\n\n#### Adding a key to Loka store, `Loka.set()`\n\n```javascript\nLoka.set('name', 'John Doe');\nLoka.set('user', {\n\tname: 'Johnny Bravo',\n    email: 'johnny.bravo@gmail.com',\n    gender: 'male',\n    verified: true,\n});\n```\n\n\n#### Accessing a key from Loka store, `Loka.get()`\n\n```javascript\nconst name = Loka.get('name');\nconsole.log(`name: ${name}`); // this will output `name: John Doe`\n\nconst user = Loka.get('user');\nconsole.log(user);\n// this will output\n// {\n//     name: 'Johnny Bravo',\n//     email: 'johnny.bravo@gmail.com',\n//     gender: 'male',\n//     verified: true,\n// }\n```\n\n\n#### Updating a key in Loka store, `Loka.update()`\n\n```javascript\nLoka.update('name', 'John Doe');\n// this will update the key of name `name` in the store and set its value to `John Doe`\n\nconst new_name = Loka.update('name', 'Hello World');\nconsole.log(new_name); // this will output the updated value of key `name`, that is `Hello World`\n\n// You can very easily update an object and add new properties, update existing properties of it.\n// following our `user` example from adding variables section above, we can do\n\nconst updated = Loka.update('user', {\n\tname: 'Matt Murdock',\n\talias: 'Daredevil',\n    phone: '111-2222-3333',\n});\n// this will add and update the properties of the `user` object.\n\nconsole.log('updated',updated);\n// this will output\n// updated {\n//     name: 'Matt Murdock',\n//     email: 'johnny.bravo@gmail.com',\n//     gender: 'male',\n//     verified: true,\n//     alias: 'Daredevil',\n//     phone: '111-2222-3333',\n// }\n```\n\n\n#### Deleting a key in Loka store, `Loka.delete()`\n\n```javascript\nLoka.delete('name');\n// this will delete the key of name `name` in the store.\n\nlet user_name = Loka.get('name');\nconsole.log(user_name) // this will output `undefined`\n\n// if an object, you can delete one of its properties instead of the entire object by providing a path\nconst delete_email = Loka.delete('user', 'email');\nconsole.log(delete_email);\n// this will output\n// {\n//     name: 'Matt Murdock',\n//     gender: 'male',\n//     verified: true,\n//     alias: 'Daredevil',\n//     phone: '111-2222-3333',\n// }\n\n// or you can just do \n\nconst deleted = Loka.delete('user'); // this will delete key `user` from store along with all of its properties\nconsole.log(deleted);\n// this will output `undefined`\n```\n\n\n\n#### Accessing the entire store, `Loka.store()`\n```javascript\nconst store = Loka.store();\n// this will return the entire store object.\n\nconsole.log(store);\n// this will output `{}` because the store is empty.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruv-kumar-jha%2Floka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhruv-kumar-jha%2Floka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruv-kumar-jha%2Floka/lists"}