{"id":12789,"library":"abbajs","title":"ABBA.js A/B Test Analysis","description":"ABBA.js is a JavaScript library designed for statistical analysis relevant to A/B testing, including functions for normal and binomial distributions, and a utility for computing experiment results. It provides methods for density, cumulative distribution function (CDF), survival function, and inverse CDF for both normal and binomial distributions. Additionally, it offers an `Experiment` class to calculate proportion, relative improvement, and p-value for A/B test variations against a baseline. The package is currently at version 0.1.4, published in 2014, and appears to be abandoned, with no significant updates or active maintenance in over 7 years. Its core differentiator lies in offering common statistical distribution functions and A/B test result computation directly in JavaScript, without external dependencies, though its age makes it unsuitable for modern ESM-first environments.","status":"abandoned","version":"0.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/thii/abbajs","tags":["javascript"],"install":[{"cmd":"npm install abbajs","lang":"bash","label":"npm"},{"cmd":"yarn add abbajs","lang":"bash","label":"yarn"},{"cmd":"pnpm add abbajs","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package is CommonJS-only and exports a single 'Abba' object containing all distribution and experiment classes. Attempting to use ES module `import` syntax will result in errors in modern Node.js or browser environments without a compatible bundler.","wrong":"import Abba from 'abbajs';\nimport { Abba } from 'abbajs';","symbol":"Abba","correct":"const Abba = require('abbajs');"},{"note":"Individual classes like `NormalDistribution` are properties of the main `Abba` export and must be accessed via `Abba.<ClassName>`. They are constructors, requiring the `new` keyword.","wrong":"import { NormalDistribution } from 'abbajs';\nconst normal = new NormalDistribution(mean, standardDeviation);","symbol":"Abba.NormalDistribution","correct":"const Abba = require('abbajs');\nconst normal = new Abba.NormalDistribution(mean, standardDeviation);"},{"note":"Similar to `NormalDistribution`, `Experiment` is a constructor accessed via the `Abba` object. Its methods, like `getResults`, are called on instances created with `new`.","wrong":"import { Experiment } from 'abbajs';\nconst experiment = new Experiment(...);","symbol":"Abba.Experiment","correct":"const Abba = require('abbajs');\nconst experiment = new Abba.Experiment(numVariations, baselineNumSuccesses, baselineNumTrials, intervalAlpha);"}],"quickstart":{"code":"const Abba = require('abbajs');\n\n// Create a normal distribution instance for analysis\nconst normal = new Abba.NormalDistribution(1, 2);\nconsole.log('Normal Density at 1:', normal.density(1));\nconsole.log('Normal CDF at 3:', normal.cdf(3));\n\n// Create a binomial distribution instance\nconst binomial = new Abba.BinomialDistribution(1000, 0.3);\nconsole.log('Binomial Mass at 300:', binomial.mass(300));\nconsole.log('Binomial CDF at 310:', binomial.cdf(310));\n\n// Computes an A/B test experiment result\nconst experiment = new Abba.Experiment(3, 20, 100, 0.05);\nconst result = experiment.getResults(50, 150);\nconsole.log('Experiment Result:', JSON.stringify(result, null, 2));\n/* Expected output structure:\n{\n  \"proportion\": {\n    \"value\": 0.3333333333333333,\n    \"lowerBound\": 0.24862657323794302,\n    \"upperBound\": 0.4303072595809455\n  },\n  \"relativeImprovement\": {\n    \"value\": 0.6666666666666665,\n    \"lowerBound\": -0.040933756155489553,\n    \"upperBound\": 1.1803459277365715\n  },\n  \"pValue\": 0.05749442762442982\n}*/","lang":"javascript","description":"Demonstrates the core functionality of Abba.js, including creating and using Normal and Binomial distribution objects, and computing A/B experiment results."},"warnings":[{"fix":"For Node.js ESM projects, dynamic `import()` might be used with caution, but is not officially supported. For browser ESM, a CJS-compatible bundler (like Webpack or Rollup) is required. In Node.js CJS, use `const Abba = require('abbajs');`.","message":"This package is explicitly designed for CommonJS (CJS) environments and does not support ES Modules (ESM) syntax natively. Attempting to `import` it directly in an ESM context will lead to `ERR_REQUIRE_ESM` or similar errors.","severity":"breaking","affected_versions":"0.1.0 - 0.1.4"},{"fix":"Evaluate alternatives for A/B testing analysis that are actively maintained and compatible with modern JavaScript ecosystems. If used, thoroughly audit the code for potential vulnerabilities or inaccuracies.","message":"The package is highly unmaintained, with its last commit over 7 years ago and current version 0.1.4 published in 2014. This means there are unlikely to be any updates, bug fixes, or security patches.","severity":"gotcha","affected_versions":"0.1.0 - 0.1.4"},{"fix":"Replace `var` with `const` or `let` as appropriate in your consuming code, though this does not change the internal implementation of the library.","message":"The documentation uses `var` declarations, indicative of older JavaScript practices. While functional, it might not align with modern `const`/`let` usage patterns.","severity":"gotcha","affected_versions":"0.1.0 - 0.1.4"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure your file is treated as CommonJS (e.g., `.js` in a `package.json` with `\"type\": \"commonjs\"` or without a `\"type\"` field, or directly running with `node --require esm-loader your-file.js`) or use a bundler for browser usage. If you must use ESM, consider dynamic `import('abbajs')` (though not officially supported by this library).","cause":"Attempting to use `require()` in an ES Module (ESM) file without proper configuration, or in a browser environment without a module loader.","error":"ReferenceError: require is not defined"},{"fix":"Always use the `new` keyword when creating instances of distribution or experiment classes, e.g., `const normal = new Abba.NormalDistribution(1, 2);`","cause":"Invoking `Abba.NormalDistribution` or `Abba.Experiment` as a regular function instead of a constructor with the `new` keyword.","error":"TypeError: Abba.NormalDistribution is not a constructor"},{"fix":"Verify that `require('abbajs')` successfully returns the `Abba` object and that `abbajs` is correctly installed. Ensure the module is loaded in a CommonJS context.","cause":"The `Abba` object was not correctly imported or is undefined, likely due to an incorrect `require()` path, a misspelling, or attempting to use it in an incompatible module system (ESM).","error":"TypeError: Cannot read properties of undefined (reading 'NormalDistribution')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null}