@shopify/name
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -17,3 +17,3 @@ 'use strict'; | ||
const FAMILY_NAME_GIVEN_NAME_ORDERING = new Map([['ko', defaultFamilyNameGivenNameOrderingFormatter], ['ja', (givenName, familyName, full) => full ? `${familyName}${givenName}` : `${familyName}様`], ['zh-CN', defaultFamilyNameGivenNameOrderingFormatter], ['zh-TW', defaultFamilyNameGivenNameOrderingFormatter]]); | ||
const FAMILY_NAME_GIVEN_NAME_ORDERING_INDEXED_BY_LANGUAGE = new Map([['ko', defaultFamilyNameGivenNameOrderingFormatter], ['ja', (givenName, familyName, full) => full ? `${familyName}${givenName}` : `${familyName}様`], ['zh', defaultFamilyNameGivenNameOrderingFormatter]]); | ||
@@ -24,2 +24,2 @@ function defaultFamilyNameGivenNameOrderingFormatter(givenName, familyName, full) { | ||
exports.FAMILY_NAME_GIVEN_NAME_ORDERING = FAMILY_NAME_GIVEN_NAME_ORDERING; | ||
exports.FAMILY_NAME_GIVEN_NAME_ORDERING_INDEXED_BY_LANGUAGE = FAMILY_NAME_GIVEN_NAME_ORDERING_INDEXED_BY_LANGUAGE; |
@@ -6,2 +6,3 @@ 'use strict'; | ||
var constants = require('./constants.js'); | ||
var languageFromLocale = require('./utilities/languageFromLocale.js'); | ||
@@ -22,3 +23,3 @@ function formatName({ | ||
const isFullName = Boolean(options && options.full); | ||
const customNameFormatter = constants.FAMILY_NAME_GIVEN_NAME_ORDERING.get(locale); | ||
const customNameFormatter = constants.FAMILY_NAME_GIVEN_NAME_ORDERING_INDEXED_BY_LANGUAGE.get(languageFromLocale.languageFromLocale(locale)); | ||
@@ -25,0 +26,0 @@ if (customNameFormatter) { |
@@ -6,5 +6,6 @@ 'use strict'; | ||
var constants = require('./constants.js'); | ||
var languageFromLocale = require('./utilities/languageFromLocale.js'); | ||
function hasFamilyNameGivenNameOrdering(locale) { | ||
const familyNameGivenNameOrdering = constants.FAMILY_NAME_GIVEN_NAME_ORDERING.get(locale); | ||
const familyNameGivenNameOrdering = constants.FAMILY_NAME_GIVEN_NAME_ORDERING_INDEXED_BY_LANGUAGE.get(languageFromLocale.languageFromLocale(locale)); | ||
return Boolean(familyNameGivenNameOrdering); | ||
@@ -11,0 +12,0 @@ } |
@@ -10,5 +10,5 @@ export declare enum UnicodeCharacterSet { | ||
} | ||
export declare const FAMILY_NAME_GIVEN_NAME_ORDERING: Map<string, typeof defaultFamilyNameGivenNameOrderingFormatter>; | ||
export declare const FAMILY_NAME_GIVEN_NAME_ORDERING_INDEXED_BY_LANGUAGE: Map<string, typeof defaultFamilyNameGivenNameOrderingFormatter>; | ||
declare function defaultFamilyNameGivenNameOrderingFormatter(givenName: string, familyName: string, full: boolean): string; | ||
export {}; | ||
//# sourceMappingURL=constants.d.ts.map |
export { getGraphemes } from './getGraphemes'; | ||
export { identifyScripts } from './identifyScripts'; | ||
export { languageFromLocale } from './languageFromLocale'; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@shopify/name", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Name-related utilities", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
49308
52
561