
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
function-com-utils
Advanced tools
Some utils of function , like Log、event module 、async module and so on .
SingleEvent is a pub/sub module based on self defination event . It use document.createEvent function to create a event object . So it could run in IE 、Chrome and other browser .
Why this module has a single attribute , because you can only used one instance , created by SingleEvent() , to listen one EVENT topic name .
But remeber this , SingleEvent can only handle NAMED function .
import { SingleEvent } from "function-com-utils" ;
let ev = SingleEvent("myEvent") ;
let a = function(){console.log('a');} ;
let b = function(){console.log('b');} ;
// on
ev.on(a) ;
ev.on(b) ;
// emit
ev.emit() ; // a b
// remove
ev.remove(a) ;
ev.emit() ; // b
MultEvent is a pub/sub module based on self defination event . It use document.createEvent function to create a event object . So it could run in IE 、Chrome and other browser .
import {MultEvent} from "function-com-utils" ;
let a = function(){console.log('a');} ;
let b = function(){console.log('b');} ;
MultEvent.on("topic1" , a) ;
MultEvent.on("topic1" , b) ;
MultEvent.remove("topic1" , a) ;
MultEvent.emit("topic1") ;
MultEvent.on("topic2" , a) ;
MultEvent.on("topic2" , b) ;
MultEvent.emit("topic2") ;
MultAsync could handle given number async process . With this moulde , you could have a final result through binding a final function .
import {MultAsync} from "function-com-utils" ;
let getFinalData = (res) => { console.log(res);}
let m = MultAsync(3 , getFinalData) ;
let t1 = setTimeout(() => {
let obj = {a : 1} ; m.registerProcess("key1" , obj) ;
clearTimeout(t1) ;
} , 1000) ;
let t2 = setTimeout(() => {
let obj = {a : 2} ; m.registerProcess("key2" , obj) ;
clearTimeout(t2) ;
} , 2000) ;
let t3 = setTimeout(() => {
let obj = {a : 3} ; m.registerProcess("key3" , obj) ;
clearTimeout(t3) ;
} , 3000) ;
Curry module has offered a currying process .
import { Curry } from "function-com-utils" ;
var cost = (function () {
var money = 0;
return function () {
for (var i = 0, l = arguments.length; i < l; i++) {
money += arguments[i];
}
return money;
}
})();
let caf = Curry(cost) ;
caf(100) ;
caf(1000) ;
console.log(caf()) // 1100 ;
CurryProcess could help you to curry some process . Especially , when you want to depart your complex process .
But remeber , this function would no suport async process , if you want to do it , you should use async/await or Promise .
import { CurryProcess } from "function-com-utils"
let initPrams = { a : 1 } ;
let process1 = (data) => { return Object.assign({b : 1} , data) } ;
let process2 = (data) => { return Object.assign({c : 1} , data) } ;
let res = CurryProcess(initPrams)(process1)(process2)() ;
console.log(res) ; // { a : 1 , b : 1 , c : 1 }
MultSync would help you to handle some sync process . And the same params would be given in every process .
But remeber , you should use next function to run next process .
import { MultSync } from "function-com-utils" ;
let ms = new MultSync() ;
ms.use(function(a , b){ console.log("====" , a) ; ms.next() ; }) ;
ms.use(function(a , b){ console.log("====" , b) ; ms.next() ; }) ;
ms.use(function(a , b){ console.log("====" , a + b) ;ms.next() ; }) ;
ms.emit(1 , 2) ;
filterXSS(dangerStr , <replacePatten>)
filterXSS module offer you a XSS filter function ,
which would filter dangerous script 、console and alert tag and content .
import { filterXSS } from "function-com-utils" ;
let dangerStr = "<script>alert(111);</script>wqe" ;
console.log(filterXSS(dangerStr)) ; // wqe
md5(string)
md5 module offer a basic md5 counting function .
import { md5 } from "function-com-utils" ;
let str = "this is a md5 test" ;
console.log(md5(str)) ;
MIT
FAQs
Some utils of function
We found that function-com-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.