diff --git a/CHANGELOG.md b/CHANGELOG.md index 0100fe5..502e675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# @sumup/intl +# @sumup-oss/intl ## 1.6.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca61ba9..ab79900 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,11 +39,11 @@ Make sure that you use Node v20.14 _exactly_, otherwise, the unit tests will pro ## Release process -`@sumup/intl` follows semantic versioning. In short, this means we use patch versions for bugfixes, minor versions for new features, and major versions for breaking changes. +`@sumup-oss/intl` follows semantic versioning. In short, this means we use patch versions for bugfixes, minor versions for new features, and major versions for breaking changes. ### Changesets -`@sumup/intl` uses [changesets](https://github.com/atlassian/changesets) to do versioning. A changeset is a piece of information about changes made in a branch or commit. It holds three bits of information: +`@sumup-oss/intl` uses [changesets](https://github.com/atlassian/changesets) to do versioning. A changeset is a piece of information about changes made in a branch or commit. It holds three bits of information: - What needs to be released - What version the packages should be released at (using a [semver bump type](https://semver.org/)) @@ -62,7 +62,7 @@ We have a couple of special branches that are used for stable releases and [pre- To install the most recent version from a release channel in your project, run: ```sh -npm install --dev @sumup/intl@ +npm install --dev @sumup-oss/intl@ ``` #### Pre-releases diff --git a/README.md b/README.md index 5530779..cce0caf 100644 --- a/README.md +++ b/README.md @@ -20,35 +20,35 @@ Format 🔢 numbers, 💱 currency values, 📅 dates, and 🕘 times for any lo ## Introduction -`@sumup/intl` is a light abstraction layer on top of the [ECMAScript Internationalization API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl). In addition to a simplified API, it offers the following benefits: +`@sumup-oss/intl` is a light abstraction layer on top of the [ECMAScript Internationalization API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl). In addition to a simplified API, it offers the following benefits: ### Performance -Creating instances of `Intl.*` formatters is an [expensive operation](https://blog.david-reess.de/posts/hBEx9w-on-number-formatting-and-performance). `@sumup/intl` solves this by [memoizing](https://github.com/formatjs/intl-format-cache) the `Intl` formatters with a cache key based on the arguments passed to the constructor. +Creating instances of `Intl.*` formatters is an [expensive operation](https://blog.david-reess.de/posts/hBEx9w-on-number-formatting-and-performance). `@sumup-oss/intl` solves this by [memoizing](https://github.com/formatjs/intl-format-cache) the `Intl` formatters with a cache key based on the arguments passed to the constructor. ### Compatibility -`@sumup/intl` works in [modern browsers](https://caniuse.com/mdn-javascript_builtins_intl_numberformat_numberformat,mdn-javascript_builtins_intl_datetimeformat_datetimeformat) as well as server runtimes with support for the `Intl` APIs (such as Node 10+[^1]). When the `Intl` APIs aren't (fully) available, `@sumup/intl` tries to gracefully degrade. Please refer to the [API reference](#api-reference) to learn how certain functions behave when the runtime doesn't support the necessary APIs. If you need to support legacy browsers, consider including [polyfills](https://formatjs.io/docs/polyfills/). +`@sumup-oss/intl` works in [modern browsers](https://caniuse.com/mdn-javascript_builtins_intl_numberformat_numberformat,mdn-javascript_builtins_intl_datetimeformat_datetimeformat) as well as server runtimes with support for the `Intl` APIs (such as Node 10+[^1]). When the `Intl` APIs aren't (fully) available, `@sumup-oss/intl` tries to gracefully degrade. Please refer to the [API reference](#api-reference) to learn how certain functions behave when the runtime doesn't support the necessary APIs. If you need to support legacy browsers, consider including [polyfills](https://formatjs.io/docs/polyfills/). [^1]: [Node](https://nodejs.org/en/) supports the `Intl` APIs since v8, however, it includes only the English localizations up to v12. Node v13 and above support all locales. If you're unable to use Node v13+, you can either include [polyfills](https://formatjs.io/docs/polyfills/) or use a [custom Node build](https://nodejs.org/docs/latest-v8.x/api/intl.html#intl_options_for_building_node_js). ## Installation -[`@sumup/intl`](https://www.npmjs.com/package/@sumup/intl) can be installed as a dependency via the [npm](https://www.npmjs.com) or [Yarn](https://classic.yarnpkg.com) package managers. Depending on your preference, run one of the following: +[`@sumup-oss/intl`](https://www.npmjs.com/package/@sumup-oss/intl) can be installed as a dependency via the [npm](https://www.npmjs.com) or [Yarn](https://classic.yarnpkg.com) package managers. Depending on your preference, run one of the following: ```sh # With npm -npm install @sumup/intl +npm install @sumup-oss/intl # With Yarn v1 -yarn add @sumup/intl +yarn add @sumup-oss/intl ``` -`@sumup/intl` requires Node v10+. +`@sumup-oss/intl` requires Node v10+. ## Usage -The functions exported by `@sumup/intl` share a similar interface such as the common [`locales`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument), [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#options_argument), and [`currency`](https://en.wikipedia.org/wiki/ISO_4217) arguments. These are passed on almost unchanged to the [`Intl.*`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#constructor_properties) constructors and thus support the same values. If the `locales` argument is not provided or is undefined, the runtime's default locale is used. Please refer to the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) for more details. +The functions exported by `@sumup-oss/intl` share a similar interface such as the common [`locales`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument), [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#options_argument), and [`currency`](https://en.wikipedia.org/wiki/ISO_4217) arguments. These are passed on almost unchanged to the [`Intl.*`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#constructor_properties) constructors and thus support the same values. If the `locales` argument is not provided or is undefined, the runtime's default locale is used. Please refer to the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) for more details. Each type of data can be formatted with three increasingly advanced functions: diff --git a/package-lock.json b/package-lock.json index 9261517..9a7f006 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@sumup/intl", + "name": "@sumup-oss/intl", "version": "1.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "@sumup/intl", + "name": "@sumup-oss/intl", "version": "1.6.0", "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index a2fc010..cbd5ac3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@sumup/intl", + "name": "@sumup-oss/intl", "version": "1.6.0", "description": "Format numbers, currency values, dates, and times for any locale with the ECMAScript Internationalization API", "repository": "git@github.com:sumup-oss/intl-js.git", diff --git a/src/lib/date-time-format/index.ts b/src/lib/date-time-format/index.ts index b45f570..ac22869 100644 --- a/src/lib/date-time-format/index.ts +++ b/src/lib/date-time-format/index.ts @@ -31,7 +31,7 @@ export { isDateTimeFormatSupported, isDateTimeFormatToPartsSupported }; * and [time](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#timestyle) styles. * * @example - * import { formatDateTime } from '@sumup/intl'; + * import { formatDateTime } from '@sumup-oss/intl'; * * formatDateTime(new Date(2000, 1, 1), 'de-DE'); // '1.2.2000' * formatDateTime(new Date(2000, 1, 1), ['ban', 'id']); // '1/2/2000' @@ -59,7 +59,7 @@ export const formatDateTime = formatDateTimeFactory(); * [date styles](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#datestyle). * * @example - * import { formatDate } from '@sumup/intl'; + * import { formatDate } from '@sumup-oss/intl'; * * const date = new Date(2000, 1, 1); * const locale = 'en-GB'; @@ -91,7 +91,7 @@ export function formatDate( * [time styles](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#datestyle). * * @example - * import { formatTime } from '@sumup/intl'; + * import { formatTime } from '@sumup-oss/intl'; * * const time = new Date(2000, 1, 1, 9, 55); * const locale = 'en-GB'; @@ -166,7 +166,7 @@ function formatDateTimeFactory(): ( * and [time](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#timestyle) styles. * * @example - * import { formatDateTimeToParts } from '@sumup/intl'; + * import { formatDateTimeToParts } from '@sumup-oss/intl'; * * const time = new Date(2000, 1, 1, 9, 55); * @@ -232,7 +232,7 @@ function formatDateTimeToPartsFactory(): ( * Resolves the locale and collation options that are used to format a `Date`. * * @example - * import { resolveDateTimeFormat } from '@sumup/intl'; + * import { resolveDateTimeFormat } from '@sumup-oss/intl'; * * resolveDateTimeFormat(); * // { diff --git a/src/lib/number-format/index.ts b/src/lib/number-format/index.ts index 7eb6f22..48a59c8 100644 --- a/src/lib/number-format/index.ts +++ b/src/lib/number-format/index.ts @@ -48,7 +48,7 @@ type GetOptions = ( * and [notations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat#Using_notation). * * @example - * import { formatNumber } from '@sumup/intl'; + * import { formatNumber } from '@sumup-oss/intl'; * * formatNumber(12345.67, 'de-DE'); // '12.345,67' * formatNumber(-0.89, ['ban', 'id']); // '-0,89' @@ -81,7 +81,7 @@ export const format = formatNumber; * with support for various [notations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat#Using_notation). * * @example - * import { formatCurrency } from '@sumup/intl'; + * import { formatCurrency } from '@sumup-oss/intl'; * * formatCurrency(12345.67, 'de-DE'); // '12.345,67 €' * formatCurrency(89, 'ja-JP', 'JPY'); // '¥89' @@ -123,7 +123,7 @@ function formatNumberFactory( * and [notations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat#Using_notation). * * @example - * import { formatNumberToParts } from '@sumup/intl'; + * import { formatNumberToParts } from '@sumup-oss/intl'; * * formatNumberToParts(12345.67, 'de-DE'); * // [ @@ -179,7 +179,7 @@ export const formatToParts = formatNumberToParts; * with support for various [notations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat#Using_notation). * * @example - * import { formatCurrencyToParts } from '@sumup/intl'; + * import { formatCurrencyToParts } from '@sumup-oss/intl'; * * formatCurrencyToParts(12345.67, 'de-DE'); * // [ @@ -247,7 +247,7 @@ function formatNumberToPartsFactory( * Resolves the locale and collation options that are used to format a number. * * @example - * import { resolveNumberFormat } from '@sumup/intl'; + * import { resolveNumberFormat } from '@sumup-oss/intl'; * * resolveNumberFormat(); * // { @@ -323,7 +323,7 @@ export const resolveFormat = resolveNumberFormat; * in the country's official currency. * * @example - * import { resolveCurrencyFormat } from '@sumup/intl'; + * import { resolveCurrencyFormat } from '@sumup-oss/intl'; * * resolveCurrencyFormat(); * // {