Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Basic math functions that have been stabilized to act well over Null
/None
/NaN
Branch | Status |
---|---|
master | |
dev |
Many of the basic math functions you know and love, with the additional benefit
that they do not throw exceptions and do not return NaN
.
These functions are all module methods. Be sure you call the functions
with mo_math.
prefix, like
import mo_math
mo_math.abs(-42)
or rename the functions
from mo_math import abs as mo_abs
mo_abs(-42)
This prevents confusion with the __builtin__
functions by the same name
Functions are generally conservative in the face of nulls: Specifically, they return Null
if any of their operands are not a number.
Most functions need no introduction, but some are interesting:
round(value, decimal=7, digits=None)
- Rounds to 7 decimal points, unless specified differently. Rounding to decimal=0
will return an int
. The useful parameter here is digits
, which rounds to a specified number of significant digits.floor(value, mod=1)
- The mod
ulo parameter is used to specify the granularity of the floor function.ceiling(value, mod=1)
- Return the smallest value, that's equal or larger than value
, with suitable granularity.mod(value, mod=1)
- Works on floatsapprox_str(value)
- Round values, and return text
(unicode
in py2, str
in py3)sign(v)
- Missing from the Python libraryThe all-caps aggregate functions accept only one parameter; an iterable. They are decisive operators: Non-numbers are ignored, if no values are numbers then the aggregate will return Null
.
COUNT(values)
SUM(values)
PRODUCT(values)
MIN(values)
MAX(values)
The AES and RSA crypto functions provide structured input/output on top of cryptography
library. The intent is to reveal the signed/encrypted structures so third parties can decode the data.
FAQs
More Math! Many of the aggregates you are familiar with, but null-safe
We found that mo-math demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.