
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@testit-sdk/express
Advanced tools
AbTest is a lightweight TypeScript library for implementing A/B testing in Express.js applications. It provides an easy way to create and manage experiments, assign users to variants, and check variant assignments. This package is made to work with Test It but can be used without it if you have your own analytics system.
npm install @testit-sdk/express
import AbTest from "@testit-sdk/express";
import express from "express";
const app = express();
app.get("/", (req, res) => {
const abTest = new AbTest({
experimentId: "66d6381d630d87321d2937c6",
variants: [
{ id: "66d6621d630d87341d2937f3", name: "baseline", weight: 50 },
{ id: "66d6681c630d87341d2936d4", name: "v_1", weight: 50 },
],
req,
res,
});
if (abTest.isVariant("v_1")) {
res.send('<button style="background-color: blue;">Click me!</button>');
} else {
res.send('<button style="background-color: red;">Click me!</button>');
}
});
app.listen(3000, () => console.log("Server running on port 3000"));
options.experimentId: Unique identifier for the experimentoptions.variants: Array of variant objects with id, name, and weight propertiesoptions.req: Express request objectoptions.res: Express response objectisVariant(variantName: string): boolean: Check if the current user is assigned to a specific variantisV(variantName: string): boolean: Alias for isVariantAbTest uses cookies to persistently assign users to variants. When a user first encounters an experiment, they are randomly assigned to a variant based on the specified weights. This assignment is stored in a cookie and reused for subsequent requests.
FAQs
An A/B testing utility for Express applications.
The npm package @testit-sdk/express receives a total of 4 weekly downloads. As such, @testit-sdk/express popularity was classified as not popular.
We found that @testit-sdk/express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.