Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
appolo-decorators
Advanced tools
useful decorators The cache will remove the oldest used item when reached max capacity
npm install appolo-decorators --save
delay call method by given time in milliseconds
import { delay } from 'appolo-decorators';
class SomeClass {
@delay(1000)
method() {
// ...
}
}
cache method results using appolo-cache
options:
maxSize
- max cache size default 1000
maxAge
- optional set maximum age in ms of all cache items default unlimited
clone
- clone the cache result default false
interval
- set cache refresh interval
resolver
- function to get the cache key by default the fist argument will be used as the cache key
multi
- boolean if no resolver defined use all the arguments as key else use the first argument as key default false
peek
- boolean use peek
method instead of get default false
refresh
- boolean refresh cache on half maxAge
expire default false
import { cache } from 'appolo-decorators';
class SomeClass {
private counter = 0;
@cache()
method() {
return ++this.counter
}
}
let someClass = new SomeClass();
someClass.method() // 1
someClass.method()// 1
bind method to class instance
import { bind } from 'appolo-decorators';
class SomeClass {
@bind
method() {
// ...
}
}
document.body.addEventListener('click', new SomeClass().method);
debounce method using lodash debounce
import { debounce } from 'appolo-decorators';
class SomeClass {
@debounce(1000,{trailing:true})
method() {
// ...
}
}
throttle method using lodash debounce
import { throttle } from 'appolo-decorators';
class SomeClass {
@throttle(1000,{trailing:true})
method() {
// ...
}
}
memoize method using lodash debounce
import { memoize } from 'appolo-decorators';
class SomeClass {
@memoize()
method() {
// ...
}
}
method will be called max n times and return last call result
import { once } from 'appolo-decorators';
class SomeClass {
@once(2)
method() {
// ...
}
}
set interval to method once called
import { interval } from 'appolo-decorators';
class SomeClass {
@interval(100)
method() {
// ...
}
}
//start the interval
new SomeClass().method()
add prototype to class
import { mixins } from 'appolo-decorators';
@mixins(EventDispacher)
class SomeClass {
method() {
// ...
}
}
new SomeClass().on("some event")
MIT
FAQs
useful decorators
The npm package appolo-decorators receives a total of 4 weekly downloads. As such, appolo-decorators popularity was classified as not popular.
We found that appolo-decorators 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.