Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
mathleet
Advanced tools
Readme
Library of helpful math utilities.
Via npm
npm install mathleet
Via Yarn
yarn add mathleet
import { keySum } from 'mathleet'
const values = [
{ a: 0, b: 1},
{ a: 1, b: 2},
{ a: 2, b: 3},
]
const sumA = keySum(values, 'a')
console.log(sumA) // Output: 3
const sumB = keySum(values, 'b')
console.log(sumB) // Output: 6
Method | Params | Description |
---|---|---|
filterNumbers | (items: any[] ) | Accepts an array of inputs and converts them to numbers and filters out all NaN entries. |
keySum | (items: any[] , key: string ) | Accepts an array of objects and calculates the sum value for provided key . |
keyAvg | (items: any[] , key: string ) | Accepts an array of objects and calculates the avergage for the provided key . |
numMin | (items: any[] ) | Takes an array of values and filters valid numbers, returning the Math.min . |
numMax | (items: any[] ) | Takes an array of values and filters valid numbers, returning the Math.max . |
sum | (items: any[] , offset: number = 0 ) | Takes an array of values, and optional offset, and calculates sum of values with offset applied. |
sumAvg | (items: any[] , offset: number = 0 ) | Takes an array of values and calculates the average, with offset applied to sum before divided by items length. |
rangeAvg | (items: any[] , rangeMin: number = 0 , 'rangeMax: number = 1`) | Takes an array of values and calculates the average within a specified range. |
within | (value: number , target: number , offset: number = 0 ) | Takes a value and target and returns a boolean if is within the target range with the provided offset . |
outside | (value: number , target: number , offset: number = 0 ) | Takes a value and target and returns a boolean if values is outside the target range with the provided offset . |
degrees | (value: number ) | Convert value of radians to degrees. |
radians | (value: number ) | Convert value of degrees to radians. |
angle | (pointA: Point , pointB: Point , pointC: Point ) | Takes three Point ({ x: number, y: number } ) values and calculates the angle between them. |
velocity | (distance: number , time: number ) | Takes a distance value and time and returns the calculated velocity . |
FAQs
Library of helpful math utilities.
The npm package mathleet receives a total of 29 weekly downloads. As such, mathleet popularity was classified as not popular.
We found that mathleet 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.