# @shopify/name

> Name-related utilities

Latest version **1.3.0** (published 2025-01-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @shopify/name
pnpm add @shopify/name
yarn add @shopify/name
bun add @shopify/name
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2025-01-10 |
| First published | 2023-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.12.0 |
| Dependencies | 0 |
| Unpacked size | 52 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1681 |
| Author | Shopify Inc. |
| Maintainers | shopify-admin, shopify-dep, mishsmelle, netlohan, pmoloney89, maryharte, jaimie.rockburn, jaykay101 |

## Links

- npm: https://www.npmjs.com/package/@shopify/name
- Repository: https://github.com/Shopify/quilt
- Homepage: https://github.com/Shopify/quilt/blob/main/packages/name/README.md
- Issues: https://github.com/Shopify/quilt/issues
- npm.io page: https://npm.io/package/@shopify/name

## Recent versions

- 1.3.0 (latest) — 2025-01-10
- 0.0.0-snapshot-20250108150133 (snapshot) — 2025-01-08
- 0.0.0-snapshot-20250108144406 — 2025-01-08
- 1.2.0 — 2024-07-16
- 0.0.0-snapshot-20240620045713 — 2024-06-20
- 1.1.0 — 2024-06-10
- 1.0.2 — 2024-04-29
- 1.0.1 — 2024-02-08
- 0.0.0-snapshot-20240207215059 — 2024-02-07
- 1.0.0 — 2023-08-17

## README

# `@shopify/name`

> [!CAUTION]
>
> `@shopify/name` is deprecated.
>
> Shopifolk, see
> [Shopify/quilt-internal](https://github.com/shopify/quilt-internal) for
> information on the latest packages available for use internally.

[![Build Status](https://github.com/Shopify/quilt/workflows/Node-CI/badge.svg?branch=main)](https://github.com/Shopify/quilt/actions?query=workflow%3ANode-CI)
[![Build Status](https://github.com/Shopify/quilt/workflows/Ruby-CI/badge.svg?branch=main)](https://github.com/Shopify/quilt/actions?query=workflow%3ARuby-CI)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md) [![npm version](https://badge.fury.io/js/%40shopify%2Fname.svg)](https://badge.fury.io/js/%40shopify%2Fname)
![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40shopify%2Fname.svg)

Utilities for formatting localized names.

## Installation

```bash
yarn add @shopify/name
```

### formatName

Formats a name (given name and/or family name) according to the locale. For example:

- `formatName({name: {givenName: 'John', familyName: 'Smith'}, locale: 'en'})` will return `John` in English and `Smith様` in Japanese
- `formatName({name: {givenName: 'John', familyName: 'Smith'}, locale: 'en', options: {full: true}})` will return `John Smith` in English and `SmithJohn` in Japanese

### hasFamilyNameGivenNameOrdering

Returns `true` when the provided locale formats family name before given name.
For example:

- `hasFamilyNameGivenNameOrdering('ja')` will return `true`
- `hasFamilyNameGivenNameOrdering('en')` will return `false`

### abbreviateName

Takes a name (given and family name) and returns a language appropriate abbreviated name, or will return `formatName` if
it is unable to find a suitable abbreviation.

For example:

- `abbreviateName({name: {givenName: 'John', familyName: 'Smith'}, locale: 'en'})` will return `JS`
- `abbreviateName({name: {givenName: '健', familyName: '田中'}, locale: 'en'})` will return `田中`

You may also pass an optional `idealMaxLength` parameter, which gives the maximum allowable abbreviation length when
trying to abbreviate a name in the Korean language (default 3 characters). In Korean, if the given name is longer than
this length, the method will instead return the first character of the given name.

### abbreviateBusinessName

Takes a business name and returns a language appropriate abbreviated name, or will return the input name if it is unable to find
a suitable abbreviation.

For example:

- `abbreviateBusinessName({name: 'Shopify'})` will return `Sho`
- `abbreviateBusinessName({name: 'My Store'})` will return `MS`
- `abbreviateBusinessName({name: '任天堂'})` will return `任天堂`

You may also pass an optional `idealMaxLength` parameter, which gives the maximum allowable abbreviation length when
trying to abbreviate a name.

---
_Source: https://npm.io/package/@shopify/name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
