{"id":19303557,"url":"https://github.com/matthewcallis/fifo","last_synced_at":"2025-04-22T11:32:09.210Z","repository":{"id":66818630,"uuid":"61151967","full_name":"MatthewCallis/fifo","owner":"MatthewCallis","description":"First In First Out accounting for JavaScript localStorage.","archived":false,"fork":false,"pushed_at":"2022-02-22T20:00:57.000Z","size":261,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T23:38:23.457Z","etag":null,"topics":["fifo","javascript","localstorage"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/localstorage-fifo","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/MatthewCallis.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":"2016-06-14T20:00:44.000Z","updated_at":"2023-11-20T08:11:16.000Z","dependencies_parsed_at":"2023-03-08T03:45:20.901Z","dependency_job_id":null,"html_url":"https://github.com/MatthewCallis/fifo","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"998ec4bf63f61c0b361b86bb8def413baa525c9a"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Ffifo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Ffifo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Ffifo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Ffifo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatthewCallis","download_url":"https://codeload.github.com/MatthewCallis/fifo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250232209,"owners_count":21396595,"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":["fifo","javascript","localstorage"],"created_at":"2024-11-09T23:26:46.946Z","updated_at":"2025-04-22T11:32:09.173Z","avatar_url":"https://github.com/MatthewCallis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Fifo](https://github.com/MatthewCallis/fifo)\n\n[![Build Status](https://travis-ci.org/MatthewCallis/fifo.svg)](https://travis-ci.org/MatthewCallis/fifo)\n[![Test Coverage](https://codeclimate.com/github/MatthewCallis/fifo/badges/coverage.svg)](https://codeclimate.com/github/MatthewCallis/fifo/coverage)\n[![Coverage Status](https://coveralls.io/repos/github/MatthewCallis/fifo/badge.svg?branch=master)](https://coveralls.io/github/MatthewCallis/fifo?branch=master)\n[![devDependency Status](https://david-dm.org/MatthewCallis/fifo/dev-status.svg?style=flat)](https://david-dm.org/MatthewCallis/fifo#info=devDependencies)\n[![npm version](https://img.shields.io/npm/v/localstorage-fifo.svg?style=flat-square)](https://www.npmjs.com/package/localstorage-fifo)\n[![npm downloads](https://img.shields.io/npm/dm/localstorage-fifo.svg?style=flat-square)](https://www.npmjs.com/package/localstorage-fifo)\n\n**First In First Out accounting for JavaScript `localStorage`.**\n\n`npm install --save localstorage-fifo`\n\n## About\n\n`localStorage` doesn't have an unlimited amount of space, and just throws an error when you try to save to it when its full. `fifo` gracefully handles saving data to localStorage: when you run out of room it simply removes the earliest item(s) saved.\n\nAdditionally, `fifo` also stores all of your `key:value` pairs on one key in `localStorage` for [better performance](http://jsperf.com/localstorage-string-size-retrieval).\n\n## API\n\n```javascript\n// create a collection stored on `tasks` key in localStorage\nconst collection = new Fifo({ namespace: 'tasks' });\n\n// set an item\ncollection.set('task-1', 'close two tickets');\n\n// retrieve an item - preference for fixed items, then FIFO queue\nvar storedTask = collection.get('task-1'); //\u003e 'close two tickets'\n\n// retrieve all items by sending no arguments to get\nvar tasks = collection.get();\n\n// remove an item - preference for fixed items, then FIFO queue\ncollection.remove('task-1');\n```\n\n```javascript\n// empty an entire FIFO queue\ncollection.empty();\n\n// set any JavaScript object, don't have to JSON.parse or JSON.stringify() yourself when setting and getting.\ncollection.set('task:2', { due: 'sunday', task: 'go to church' });\ncollection.set('whatevz', [1,2,3]);\n\n// get a list of all keys, both those in fifo and fixed localStorage\ncollection.keys(); /* Returns an array of key names */\n\n// Check to see if a key exists in the FIFO queue or fixed localStorage\ncollection.has('key'); /* true or false */\n```\n\nPlease see the source for more details.\n\n## Browser Support\n\n`fifo` assumes the browser has `localStorage` and `JSON`. _There is a `localStorage` shim but it will not persist_.\n\n### Testing\n\n```shell\nnpm run lint\nnpm run make\nnpm run test\n```\n\n## License\n\nMIT-Style license\n\nOriginally forked from [rpflorence](https://github.com/rpflorence/fifo) to fix some issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewcallis%2Ffifo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthewcallis%2Ffifo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewcallis%2Ffifo/lists"}