New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flack

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flack - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

21

flack.js

@@ -19,3 +19,3 @@ (function () {

flack.prototype.put = function (reportedMessage) {
flack.prototype.push = function (reportedMessage) {
reportedMessage = reportedMessage.toLowerCase();

@@ -41,3 +41,3 @@

flack.prototype.get = function () {
flack.prototype.pop = function () {
var found = false;

@@ -64,7 +64,20 @@ var biggestKey;

return biggestKey;
} else {
return undefined;
}
};
flack.prototype.start = function (callback, interval) {
if (typeof callback !== "function") {
throw new Error("callback not a function.");
}
var self = this;
this.timer = setInterval(function () {
callback(self.pop());
}, interval || 30000);
};
flack.prototype.stop = function () {
clearInterval(this.timer);
};
if (typeof define === 'function' && define.amd) {

@@ -71,0 +84,0 @@ define('flack', [], function () {

2

flack.min.js

@@ -1,2 +0,2 @@

(function(){var e=this;var t=function(e,t){this.blackList=typeof t==="undefined"?[]:t;this.limit=typeof e==="undefined"?50:parseInt(e);this.obj={}};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=t}exports.flack=t}else{e.flack=t}t.prototype.put=function(e){e=e.toLowerCase();var t=e.match(/\S+/g);t=t.filter(function(e,i){return t.indexOf(e)==i});for(var i in t){if(this.blackList.indexOf(t[i])!=-1){continue}if(this.obj.hasOwnProperty(t[i])){this.obj[t[i]]++}else{this.obj[t[i]]=1}}};t.prototype.get=function(){var e=false;var t;var i=false;for(var f in this.obj){if(this.obj[f]>=this.limit){e=true;if(!i){t=f;i=true}else{if(this.obj[f]>this.obj[t]){t=f}}}}if(e){delete this.obj[t];return t}else{return undefined}};if(typeof define==="function"&&define.amd){define("flack",[],function(){return t})}})();
(function(){var t=this;var e=function(t,e){this.blackList=typeof e==="undefined"?[]:e;this.limit=typeof t==="undefined"?50:parseInt(t);this.obj={}};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=e}exports.flack=e}else{t.flack=e}e.prototype.push=function(t){t=t.toLowerCase();var e=t.match(/\S+/g);e=e.filter(function(t,i){return e.indexOf(t)==i});for(var i in e){if(this.blackList.indexOf(e[i])!=-1){continue}if(this.obj.hasOwnProperty(e[i])){this.obj[e[i]]++}else{this.obj[e[i]]=1}}};e.prototype.pop=function(){var t=false;var e;var i=false;for(var o in this.obj){if(this.obj[o]>=this.limit){t=true;if(!i){e=o;i=true}else{if(this.obj[o]>this.obj[e]){e=o}}}}if(t){delete this.obj[e];return e}};e.prototype.start=function(t,e){if(typeof t!=="function"){throw new Error("callback not a function.")}var i=this;this.timer=setInterval(function(){t(i.pop())},e||3e4)};e.prototype.stop=function(){clearInterval(this.timer)};if(typeof define==="function"&&define.amd){define("flack",[],function(){return e})}})();
//# sourceMappingURL=flack.min.js.map

@@ -18,3 +18,3 @@ {

"main": "flack.js",
"version": "0.0.1",
"version": "0.0.2",
"repository": {

@@ -21,0 +21,0 @@ "type": "git",

@@ -0,1 +1,43 @@

![Logo](http://png-2.findicons.com/files/icons/2579/iphone_icons/40/black_list_lock_closed.png)
# flack
flexible blacklist
## usage
amd, commonjs, npm, browser, nodejs ...
```sh
$ npm install flack
```
## documentation
### new flack(limit:integer[default: 50], blackList:array[default: empty array])
```javascript
var flackList = new flack(3, ["test"]);
```
### (flack).put(reportedMessage:string)
```javascript
flackList.put("good bad");
```
### (flack).get()
```javascript
flackList.get();
```
### (flack).start(callback:function, interval:integer[default: 30000])
```javascript
flackList.start(function (word) {
console.log(word);
}, 3000);
```
### (flack).stop()
```javascript
flackList.stop();
```
## contributing
1. fork it!
2. create your feature branch: `git checkout -b my-new-feature`
3. commit your changes: `git commit -m 'Add some feature'`
4. push to the branch: `git push origin my-new-feature`
5. submit a pull request :D
## license
mit.

@@ -15,7 +15,7 @@ var Code = require('code');

test.put("eray arslan");
test.put("eray arslan");
test.put("eray");
expect("eray").to.equal(test.get());
expect(undefined).to.equal(test.get());
test.push("eray arslan");
test.push("eray arslan");
test.push("eray");
expect("eray").to.equal(test.pop());
expect(undefined).to.equal(test.pop());

@@ -28,8 +28,8 @@ done();

test.put("eray arslan");
test.put("eray arslan");
test.put("eray");
expect(undefined).to.equal(test.get());
test.put("arslan");
expect("arslan").to.equal(test.get());
test.push("eray arslan");
test.push("eray arslan");
test.push("eray");
expect(undefined).to.equal(test.pop());
test.push("arslan");
expect("arslan").to.equal(test.pop());

@@ -42,16 +42,16 @@ done();

test.put("eray");
test.put("eray");
test.put("eray");
test.put("arslan");
test.put("arslan");
expect("eray").to.equal(test.get());
expect("arslan").to.equal(test.get());
test.put("arslan");
test.put("arslan");
test.put("eray");
test.put("eray");
test.put("eray");
expect("eray").to.equal(test.get());
expect("arslan").to.equal(test.get());
test.push("eray");
test.push("eray");
test.push("eray");
test.push("arslan");
test.push("arslan");
expect("eray").to.equal(test.pop());
expect("arslan").to.equal(test.pop());
test.push("arslan");
test.push("arslan");
test.push("eray");
test.push("eray");
test.push("eray");
expect("eray").to.equal(test.pop());
expect("arslan").to.equal(test.pop());

@@ -58,0 +58,0 @@ done();

Sorry, the diff of this file is not supported yet

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