{"id":17771417,"url":"https://github.com/rootslab/peela","last_synced_at":"2025-07-24T10:06:29.766Z","repository":{"id":16415969,"uuid":"19167064","full_name":"rootslab/peela","owner":"rootslab","description":"Peela, a tiny (LIFO) stack.","archived":false,"fork":false,"pushed_at":"2018-02-10T14:41:11.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T08:43:18.714Z","etag":null,"topics":["lifo","stack"],"latest_commit_sha":null,"homepage":null,"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/rootslab.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}},"created_at":"2014-04-26T02:50:20.000Z","updated_at":"2018-01-22T12:03:25.000Z","dependencies_parsed_at":"2022-06-29T19:42:04.738Z","dependency_job_id":null,"html_url":"https://github.com/rootslab/peela","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/rootslab/peela","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fpeela","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fpeela/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fpeela/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fpeela/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootslab","download_url":"https://codeload.github.com/rootslab/peela/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fpeela/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265521135,"owners_count":23781451,"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":["lifo","stack"],"created_at":"2024-10-26T21:32:48.359Z","updated_at":"2025-07-24T10:06:29.710Z","avatar_url":"https://github.com/rootslab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Peela\n\n[![NPM VERSION](http://img.shields.io/npm/v/peela.svg?style=flat)](https://www.npmjs.org/package/peela)\n[![CODACY BADGE](https://img.shields.io/codacy/b18ed7d95b0a4707a0ff7b88b30d3def.svg?style=flat)](https://www.codacy.com/public/44gatti/peela)\n[![CODECLIMATE-TEST-COVERAGE](https://img.shields.io/codeclimate/c/rootslab/peela.svg?style=flat)](https://codeclimate.com/github/rootslab/peela)\n[![LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/rootslab/peela#mit-license)\n\n![NODE VERSION](https://img.shields.io/node/v/peela.svg)\n[![TRAVIS CI BUILD](http://img.shields.io/travis/rootslab/peela.svg?style=flat)](http://travis-ci.org/rootslab/peela)\n[![BUILD STATUS](http://img.shields.io/david/rootslab/peela.svg?style=flat)](https://david-dm.org/rootslab/peela)\n[![DEVDEPENDENCY STATUS](http://img.shields.io/david/dev/rootslab/peela.svg?style=flat)](https://david-dm.org/rootslab/peela#info=devDependencies)\n\n[![NPM MONTHLY](http://img.shields.io/npm/dm/peela.svg?style=flat)](http://npm-stat.com/charts.html?package=peela)\n![NPM YEARLY](https://img.shields.io/npm/dy/peela.svg)\n\n[![NPM GRAPH1](https://nodei.co/npm/peela.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/peela/)\n\n\n\u003e **_Peela_**, a tiny (LIFO) **Stack**.\n\n\u003e If you need a fast (FIFO) __Queue__, try __[Train](https://github.com/rootslab/train)__.\n\n### Install\n\n```bash\n$ npm install peela [-g]\n// clone repo\n$ git clone git@github.com:rootslab/peela.git\n```\n\u003e __require__ \n\n```javascript\nvar Peela = require( 'peela' );\n```\n\u003e See [examples](example/).\n\n### Run Tests\n\n```bash\n$ cd peela/\n$ npm test\n```\n### Constructor\n\n\u003e Create an instance, optionally with an Array of elements.\n\n```javascript\nPeela( [ Array elements ] )\n// or\nnew Peela( [ Array elements ] )\n```\n\n### Properties\n\n```javascript\n// an array representing the stack.\nPeela.stack : Array\n```\n\n### Methods\n\n\u003e Arguments within [ ] are optional.\n\n```javascript\n/*\n * Push one or multiple objects into the stack. it uses\n * the same signature as Array#push.\n * It returns the current number of items.\n */\nPeela#push( [ Object obj1 [, Object obj2 .. ] ] ) : Number\n\n/*\n * Concatenate an Array to the stack head, optionally reversing it\n * before the operation.\n * It returns the current Peela instance.\n *\n * NOTE: It accepts a single argument, that could be also\n * a generic element.\n * NOTE: the action of reversing the array to concatenate, could be\n * useful if you want to re-push ( previously popped ) K items into\n * the stack, for example, try:\n * var p = Peela( [ 0, 1, 2, 3, 4 ] );\n * p.concat( p.pop( 3 ), true )\n */\nPeela#concat( [ Array array [, Boolean reverse ] ] ) : Peela\n\n/* \n * Evict one or multiple elements, if a number k was specified,\n * it returns an array of K elements, with K \u003c= k.\n * If k \u003e size(), all elements are returned.\n *\n * NOTE: #pop() a single element from the stack, it does not\n * return an Array, but the element itself.\n * NOTE: For popping all elements you could also do Peela#pop( Infinity )\n */\nPeela#pop( [ Number k ] ) : Array\n\n/*\n * Get the head element or an element at a certain index.\n */\nPeela#head( [ Number index ] ) : Object\n\n/*\n * Get an element starting from the tail.\n */\nPeela#tail( [ Number index ] ) : Object\n\n/*\n * Get the stack size.\n */\nPeela#size() : Number\n\n/*\n * Return the index of an element in the stack, optionally\n * starting the search from an offset index.\n * If element was not found, it returns -1.\n */\nPeela#indexOf( Object el [, Number offset ] ) : Object\n\n/*\n * Empty the stack for default.\n * If bool is set to false, no action will be done.\n * It returns the number of elements evicted.\n */\nPeela#flush( [ Boolean bool ] ) : Number\n\n```\n\n------------------------------------------------------------------------\n\n### MIT License\n\n\u003e Copyright (c) 2013-present \u0026lt; Guglielmo Ferri : 44gatti@gmail.com \u0026gt;\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the\n\u003e 'Software'), to deal in the Software without restriction, including\n\u003e without limitation the rights to use, copy, modify, merge, publish,\n\u003e distribute, sublicense, and/or sell copies of the Software, and to\n\u003e permit persons to whom the Software is furnished to do so, subject to\n\u003e the following conditions:\n\n\u003e __The above copyright notice and this permission notice shall be\n\u003e included in all copies or substantial portions of the Software.__\n\n\u003e THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\u003e MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\u003e IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\u003e CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\u003e TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\u003e SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fpeela","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootslab%2Fpeela","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fpeela/lists"}