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.
base-conversion-kit
Advanced tools
Readme
The Base Conversion Kit is a JavaScript package designed to simplify number operations across different bases. Whether you're working with binary, octal, decimal, or hexadecimal numbers, this package provides convenient functions for conversions and basic arithmetic operations.
You can install the Base Conversion Kit using npm
:
npm install base-conversion-kit
The package offers a flexible function for converting numbers from any base to another:
const { convertToBaseN, convertBase } = require('base-conversion-kit');
// Convert a decimal number to binary
const binaryResult = convertToBaseN(42, 2);
console.log(`Binary representation: ${binaryResult}`);
// Convert a hexadecimal number to octal
const octalResult = convertBase("1A", 8, 16);
console.log(`Octal representation: ${octalResult}`);
Performing arithmetic operations on numbers from different bases is seamless:
const { multiplyNumbers, addNumbers, subtractNumbers } = require('base-conversion-kit');
// Multiply two binary numbers
const resultBinary = multiplyNumbers("101", "110", 2);
console.log(`Binary multiplication result: ${resultBinary}`);
// Add two decimal numbers
const resultAddition = addNumbers("15", "7", 10);
console.log(`Decimal addition result: ${resultAddition}`);
// Subtract two hexadecimal numbers
const resultSubtraction = subtractNumbers("1A", "B", 16);
console.log(`Hexadecimal subtraction result: ${resultSubtraction}`);
const { addNumbers } = require('base-conversion-kit');
const result = addNumbers("101", "110", 2);
console.log(`Binary addition result: ${result}`);
const { convertToBaseN, addNumbers } = require('base-conversion-kit');
// Convert decimal numbers to binary and add
const binarySum = addNumbers(
convertToBaseN(10, 2),
convertToBaseN(5, 2),
2
);
console.log(`Binary sum: ${binarySum}`);
Feel free to contribute to the development of the Base Conversion Kit. If you encounter issues, have suggestions, or want to add features, please submit a pull request or open an issue on the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Perform operations with numbers in different bases
The npm package base-conversion-kit receives a total of 6 weekly downloads. As such, base-conversion-kit popularity was classified as not popular.
We found that base-conversion-kit 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
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.