Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

math-helper-functions

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-helper-functions - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

12

index.js

@@ -119,10 +119,12 @@ const {max, min, mean, median, histogram} = require('d3-array');

* @param {number[]|string[]} array Array to find distribution of
* @param {number} [numOfBins] Number of bins to use (optional)
* @returns {object} Distribution of the array's values
* @memberof MathFunctions
*/
static calcDistribution(array) {
let numHelper = new NumberHelper();
let numArray = array.map((d) => numHelper.processNumber(d));
let dist = histogram()(numArray);
let graphData = {
static calcDistribution(array, numOfBins) {
const numHelper = new NumberHelper();
const numArray = array.map((d) => numHelper.processNumber(d));
const hist = numOfBins ? histogram().thresholds(numOfBins) : histogram();
const dist = hist(numArray);
const graphData = {
labels: [],

@@ -129,0 +131,0 @@ data: [],

{
"name": "math-helper-functions",
"version": "1.0.2",
"version": "1.0.3",
"description": "Helper with misc. math functions such as sums, averages, max, min, etc",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,3 +16,3 @@ <a name="MathFunctions"></a>

- [.calcPercent(toCalc, total)](#MathFunctions.calcPercent) ⇒ <code>Number</code>
- [.calcDistribution(array)](#MathFunctions.calcDistribution) ⇒ <code>object</code>
- [.calcDistribution(array, [numOfBins])](#MathFunctions.calcDistribution) ⇒ <code>object</code>

@@ -126,3 +126,3 @@ <a name="new_MathFunctions_new"></a>

### MathFunctions.calcDistribution(array) ⇒ <code>object</code>
### MathFunctions.calcDistribution(array, [numOfBins]) ⇒ <code>object</code>

@@ -134,4 +134,5 @@ Gets array distribution

| Param | Type | Description |
| ----- | ---------------------------------------------------------------------- | ----------------------------- |
| array | <code>Array.&lt;number&gt;</code> \| <code>Array.&lt;string&gt;</code> | Array to find distribution of |
| Param | Type | Description |
| ----------- | ---------------------------------------------------------------------- | -------------------------------- |
| array | <code>Array.&lt;number&gt;</code> \| <code>Array.&lt;string&gt;</code> | Array to find distribution of |
| [numOfBins] | <code>number</code> | Number of bins to use (optional) |
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc