Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

circularbuffer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circularbuffer - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

65

lib/CircularBuffer.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class CircularBuffer {
constructor(capacity) {
var CircularBuffer = (function () {
function CircularBuffer(capacity) {
this.capacity = capacity;
this.buffer = [];
}
enq(...items) {
items.forEach(item => {
if (this.buffer.length + 1 > this.capacity)
this.deq();
this.buffer.unshift(item);
CircularBuffer.prototype.enq = function () {
var _this = this;
var items = [];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i] = arguments[_i];
}
items.forEach(function (item) {
if (_this.buffer.length + 1 > _this.capacity)
_this.deq();
_this.buffer.unshift(item);
});
}
deq() {
};
CircularBuffer.prototype.deq = function () {
return this.buffer.pop();
}
replace(...items) {
};
CircularBuffer.prototype.replace = function () {
var _this = this;
var items = [];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i] = arguments[_i];
}
this.buffer = [];
items.forEach(item => this.enq(item));
}
toArray() {
return [...this.buffer].reverse();
}
get size() {
return this.buffer.length;
}
get length() {
return this.size;
}
}
items.forEach(function (item) { return _this.enq(item); });
};
CircularBuffer.prototype.toArray = function () {
return this.buffer.slice().reverse();
};
Object.defineProperty(CircularBuffer.prototype, "size", {
get: function () {
return this.buffer.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(CircularBuffer.prototype, "length", {
get: function () {
return this.size;
},
enumerable: true,
configurable: true
});
return CircularBuffer;
}());
exports.default = CircularBuffer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CircularBuffer_1 = require("./CircularBuffer");
var CircularBuffer_1 = require("./CircularBuffer");
exports.CircularBuffer = CircularBuffer_1.default;
exports.default = CircularBuffer_1.default;
{
"name": "circularbuffer",
"version": "0.1.0",
"version": "0.1.1",
"description": "A small circular/ring buffer implementation in TypeScript.",

@@ -5,0 +5,0 @@ "keywords": ["buffer", "circular", "queue", "ring", "stack", "typescript"],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc