Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
$ npm i retention
D3 and C3 libraries are not included in the bundle, you have to install them separately.
import { buildMatrix, renderTable, renderChart } from 'retention';
const { buildMatrix, renderTable, renderChart } = require('retention');
Notice: Because CJS modules are almost always used in NodeJS backend code (Webpack or Rollup should automatically use UMD or ESM version), this version includes only buildMatrix
function, no rendering functions. If you want those you should probably explicitly include the UMD version:
const {
buildMatrix,
renderTable,
renderChart
} = require('retention/dist/retention.umd.js');
<script src="https://cdn.jsdelivr.net/npm/retention"></script>
<script>
const { buildMatrix, renderTable, renderChart } = Retention;
</script>
Clone the repo, install dependencies, build the bundle, and start a simple web server with these commands:
git clone https://github.com/marszall87/retention.git
cd retention
npm install
npm run build
npm run sample
Navigate to http://localhost:5000
and you should see a sample retention chart and table.
Returns promise with retention matrix object.
opts.startingDate
- Date
object, defines the end of the last week used to calculate retention, you probably want to use today or yesterday here
opts.numberOfWeeks
- number of weeks you want to generate retention for
opts.getInitialEvents
- function that should return a promise with Array
of objects with two props: date
and id
, date represents
opts.getActivity
- function or object in form of { eventsA: () => {...}, eventsB: () => {...} }
, functions take three args: start date, end date and index of a given time range, should return an Array
of ids that were active in that range
opts.container
- container in which the table will be rendered
opts.matrix
- retention matrix as returned by buildMatrix()
opts.container
- container in which the chart will be rendered
opts.matrix
- retention matrix as returned by buildMatrix()
MIT © Michał Nykiel
FAQs
Build retention matrix, render table or chart with data
The npm package retention receives a total of 6 weekly downloads. As such, retention popularity was classified as not popular.
We found that retention 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 threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.