Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

v1.0.0 (Stable)

Latest
Compare
Choose a tag to compare
@thibmaek thibmaek released this 06 Dec 12:10
· 130 commits to master since this release

Breaking changes

  • Module now has to be instantiated first. The ID has to be passed to bpost() only once, methods are chainable to the 'constructor':
import bpost from 'bpost';

const pkg = bpost('<id>');
const status = pkg.getStatus();

Of course destructured syntax for imports is still supported but the ID needs to passed in explicitly in this case:

import { getStatus } from 'bpost';

const status = getStatus('<id>');

Features

  • Support for multilanguage returns (defaults to english). The bpost() 'constructor' can take a second argument lang that sets the language for data returns that have multiple language keys. Currently bpost only has keys for nl, fr and en:
import bpost from 'bpost';

const pkg = bpost('<id>', 'nl');
pkg.sourcePostalPoint(); // will return the source postal point in Dutch

Methods that have the possibilty to return a different value for a different language key can also take the argument directly:

import { sourcePostalPoint } from 'bpost';

sourcePostalPoint('<id>', 'nl');

Fixes

  • Unnecessary done() callbacks removed from async flows. Would take up unneeded time.
  • Methods themselves no longer catch exceptions and errors. All catch() promise handlers have been removed since this proved to be an issue with the bpost API. Sending to many incorrect requests would block the origin IP address in their firewall. Therefore this decision has been made since it would also break the tests in CI and locally. Errors from composedFetch would be bubbled up one level to the then() handler of the method anyway.

Misc

  • Add a new test:watch npm task to only test files changed on the fs
  • README and examples updated
  • Git hooks are now possible to opt out of. Create a .opt-out file in root and put the corresponding hooks you want to opt out of in there. For further information read: https://github.com/ta2edchimp/opt-cli