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.
node-tax-api
Advanced tools
This is a wrapper for the free (but rate-limited) TaxAPI.io API that allows users to get up-to-date U.S. sales tax and EU country VAT tax rates. Typings for TypeScript are included and exported.
If you have ES6 module support, you can do the following:
import TaxAPIClient, { TaxAPIClientOptions } from 'node-tax-api';
const taxClientOptions: TaxAPIClientOptions = {
cacheEnabled: true, // This is the default value, as TaxAPI.io best practices indicate results should be cached for one day.
};
// Set up client
const taxClient = new TaxAPIClient(taxClientOptions);
// Get sales tax by U.S. postal code
taxClient.getSalesTaxByZipCode('80521').then(response => console.log(response));
// Get VAT for all EU countries
taxClient.getVATRates().then(response => console.log(response));
// Get VAT for a single EU country
taxClient.getVATRatesByCountryCode('ES').then(response => console.log(response));
// Validate VAT number for a given company
taxClient.validateVATNumber('GB943684002').then(response => console.log(response));
Otherwise, you will want to do this:
const TaxApiClient = require('node-tax-api');
const taxClient = new TaxApiClient.default({ cacheEnabled: true });
// From here, the method usage will look the same.
By default, results from these API calls are cached in-memory for one day. This is at the request of TaxAPI.io, due to the API being free. It is currently rate-limited at one request per second. If you would like to handle caching on your own, or just throw caution to the wind and not cache the results, pass cacheEnabled: false
in the options you pass to the TaxAPIClient
constructor.
Shameless plug regarding caching: I authored another library, Type-Cacheable, which is the mechanism this library is using under the hood to cache the responses from TaxAPI.io. If you would like more fine-grained control over caching (using Redis rather than an in-memory cache, which would work better for a distributed system, for example), please consider using Type-Cacheable directly. To see how you can accomplish this, refer to the source code of this library.
Special thanks to Abs Farah for creating this free API for tax information. Note that I am not the creator or maintainer of the API, just this convenience wrapper to access it with. I will try to keep this repository up to date with the API as I can. If you would like to contribute new features, bug fixes, or improvements, please open a pull request or issue. Please direct questions, comments, or concerns regarding the API itself to the API maintainer.
FAQs
TypeScript-based library for accessing the free TaxAPI.io API
The npm package node-tax-api receives a total of 0 weekly downloads. As such, node-tax-api popularity was classified as not popular.
We found that node-tax-api 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
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.