Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Latest commit

 

History

History
75 lines (45 loc) · 2 KB

File metadata and controls

75 lines (45 loc) · 2 KB

@nsf-open/ember-contact-utils

@nsf-open/ember-contact-utils

Table of contents

Functions

Functions

domesticUSPhoneNumber

domesticUSPhoneNumber(dependantKey, defaultValue?): default<string, string>

Exposes the toDomesticUSPhoneNumber formatter as an Ember computed decorator that normalizes a string or number into a standard US telephone number with area code.

public phone = "1234567890"

@domesticUSPhoneNumber('phone')
public formattedPhone!: string; // => "(123) 456-7890"

Parameters

Name Type Default value
dependantKey string undefined
defaultValue string 'None'

Returns

default<string, string>

Defined in

computed-macros.ts:16


toDomesticUSPhoneNumber

toDomesticUSPhoneNumber(value, defaultValue?): string

Normalizes a string or number into a standard US telephone number with area code. If a valid string cannot be created, a default value will be returned.

toDomesticUSPhoneNumber("1234567890"); // => "(123) 456-7890"

toDomesticUSPhoneNumber("123-456-7890"); // => "(123) 456-7890"

toDomesticUSPhoneNumber(1234567890); // => "(123) 456-7890"

toDomesticUSPhoneNumber("1234", "N/A"); // => "N/A"

Parameters

Name Type Default value
value any undefined
defaultValue string 'None'

Returns

string

Defined in

formatters.ts:23