@aller/external-id
Library for creating an ID from an URL.
Usage
Code:
import getExternalId from "@aller/external-id";
const id = getExternalId(
"https://www.dagbladet.no/nyheter/sjokkerte-allierte-pa-flyet-til-singapore---kim-ma-ikke-fa-se-noen-amerikansk-svakhet/69887776"
);
console.log(id);
Output:›
dagbladet.no/69887776
Running tests
yarn run test
Runs linter and testsyarn run test:eslint
Runs linteryarn run test:ava
Runs testsyarn run test:verbose
Runs tests with verbose outputyarn run test:watch
Automatically runs tests on saveyarn run test:coverage
Checks code coverage
Note on transpiling
This library used to transpile files on postinstall
, because it was not a npm package that could use prepare
to transpile. Now that the package is public on npm, we use prepare
to transpile files before publishing. This means that this library no longer has babel-cli
as a peer dependency.