From 48c8339df5937fd7cb7b4584f429c8ffb5564f55 Mon Sep 17 00:00:00 2001 From: Ghassen Rjab Date: Thu, 4 Feb 2021 19:28:35 +0100 Subject: [PATCH] Add MIGRATING.md --- .npmignore | 1 + MIGRATING.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 MIGRATING.md diff --git a/.npmignore b/.npmignore index 5e0f78f..ff69de3 100644 --- a/.npmignore +++ b/.npmignore @@ -14,3 +14,4 @@ /babel.config.json /rollup.config.js /.gitattributes +/MIGRATING.md diff --git a/MIGRATING.md b/MIGRATING.md new file mode 100644 index 0000000..1c3a980 --- /dev/null +++ b/MIGRATING.md @@ -0,0 +1,31 @@ +# Migration guides + +## From v2 to v3 + +No migrations needed with this version. We just added `rollup` as build tool and added the browser build in our examples. + +## From v1 to v2 + +The first version of `categorize` used `yup` to validate users' input. With this, the library had two ways to categorize arrays: + +- a synchronous way using `categorizeSync` function; +- and an asynchronous way using `categorize` function. + +With the second version, we removed `yup` library in order to become a zero-dependency library and did the validation manually. + +With this change we only have one way to categorize which is the sychronous way. So we removed the `categorizeSync` function and changed the `categorize` function to become a synchronous one. + +### Usage from v1 + +```js +// asynchronous way +const asyncResult = await categorize(animals, categories); +// synchronous way +const syncResult = categorizeSync(animals, categories); +``` + +### Usage from v2 + +```js +const result = categorize(animals, categories); +```