Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
This is Jituan Lin 's utils library, maybe is also helpful for you.
install berserk
npm install berserk
import or require the berserk, depend your environment.
const j =require('berserk').default
// berserk include a whole Ramda.js in it
j.log(j.always('hello world'))
// log: hello world
import j from 'berserk'
//berserk also has it's own function
j.midFlow(
[
({a})=>({b:a+1}),
({b})=>({c:a+b}),
(obj)=>j.log(obj)
]
)({a:1})
//log: { a:1, b:2 , c:3 }
const {readdir} =require('fs')
const readdirP=toPromise(readdir)
readdir(Path)
.then(
files=>console.log(files),
(err)=>console.log(err)
)
npm run build
npm run test
npm run doc
function
A convenient function for handle error in callback function. Accept two function res(resolve) and rej(reject) , return a wrap function that accept a list arguments, the first argument as error, if error is null, the res function will call,else the rej function.
judge a set is it another set's childSet
function
any
a function return a unit what pass to it
boolean
compare whether two set (es6: new Set(iterable)) is same as.
function
wrap the callback style function to Promise style function, the callback style function must restrict by convention:
function
A convenient function for handle error in callback function. Accept two function res(resolve) and rej(reject) , return a wrap function that accept a list arguments, the first argument as error, if error is null, the res function will call,else the rej function.
Kind: global function
Returns: function
- return a function that accept a list arguments,
the first argument as error, if error is null, the res function
will call,else the rej function
Param | Type | Description |
---|---|---|
res | function | the function which will call when no error throw |
rej | function | the function which will call when error occur |
judge a set is it another set's childSet
Kind: global function
Param | Type |
---|---|
childSet | Set |
supperSet | Set |
function
Kind: global function
Returns: function
- a function that accept a object as initial 'context' pass to first middleware
Param | Type | Description |
---|---|---|
mids | array | a array of middleware, the middleware must accept a object as 'context' and return a object to merge to context |
Example
a function use midFlow for create a element(browser) by option
const elm = j.midFlow(
[
({tag}) => ({el: document.createElement(tag)}),
({el, attr = {}}) => {
R.forEachObjIndexed(
(value, name) => el[name] = value,
attr
)
},
({children = [], el}) => {
j.midFlow(
[
({doc}) => {
R.forEach(
(child) => doc.appendChild(child),
children
)
},
({doc}) => {el.appendChild(doc)}
]
)({doc: new DocumentFragment})
},
({evtLir = [], el}) => {
R.forEach(
({handler, type, opt = {}}) => el.addEventListener(type, handler, opt),
evtLir
)
},
({el}) => el
]
)
any
a function return a unit what pass to it
Kind: global function
Params: any
boolean
compare whether two set (es6: new Set(iterable)) is same as.
Kind: global function
Param | Type |
---|---|
set1 | Set |
set2 | Set |
function
wrap the callback style function to Promise style function, the callback style function must restrict by convention:
Kind: global function
Returns: function
- return the new function that will return a Promise,
while the origin function throw a error, the Promise will be Promise.reject(error),
while the origin function work fine, the Promise will be Promise.resolve(args: array),
the args is which callback function accept
Param | Type | Description |
---|---|---|
fun | function | the callback style function to transform |
Example
const {readdir} =require('fs')
const readdirP=toPromise(readdir)
readdir(Path)
.then(
files=>console.log(files),
(err)=>console.log(err)
)
FAQs
A library of convenient function by Jituan lin
The npm package berserk receives a total of 0 weekly downloads. As such, berserk popularity was classified as not popular.
We found that berserk 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.