Socket
Socket
Sign inDemoInstall

ml-array-mean

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ml-array-mean - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

src/__tests__/mean.test.js

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [1.1.0](https://github.com/mljs/array/compare/ml-array-mean@1.0.2...ml-array-mean@1.1.0) (2018-10-26)
**Note:** Version bump only for package ml-array-mean
<a name="1.0.2"></a>

@@ -8,0 +16,0 @@ ## [1.0.2](https://github.com/mljs/array/compare/ml-array-mean@1.0.1...ml-array-mean@1.0.2) (2018-08-03)

10

lib/index.js
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var isArray = _interopDefault(require('is-any-array'));
/**

@@ -9,8 +13,8 @@ * Computes the mean of the given values

function mean(input) {
if (!Array.isArray(input)) {
throw new Error('input must be an array');
if (!isArray(input)) {
throw new TypeError('input must be an array');
}
if (input.length === 0) {
throw new Error('input must not be empty');
throw new TypeError('input must not be empty');
}

@@ -17,0 +21,0 @@

{
"name": "ml-array-mean",
"version": "1.0.2",
"version": "1.1.0",
"description": "Get the average value in an array",

@@ -21,3 +21,7 @@ "main": "lib/index.js",

},
"homepage": "https://github.com/mljs/array/tree/master/packages/array-mean#readme"
"homepage": "https://github.com/mljs/array/tree/master/packages/array-mean#readme",
"dependencies": {
"is-any-array": "^0.0.3"
},
"gitHead": "812f53d78df7770c287916b88e94de51815f574b"
}

@@ -0,1 +1,3 @@

import isArray from 'is-any-array';
/**

@@ -7,8 +9,8 @@ * Computes the mean of the given values

export default function mean(input) {
if (!Array.isArray(input)) {
throw new Error('input must be an array');
if (!isArray(input)) {
throw new TypeError('input must be an array');
}
if (input.length === 0) {
throw new Error('input must not be empty');
throw new TypeError('input must not be empty');
}

@@ -15,0 +17,0 @@

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