New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/address

Package Overview
Dependencies
Maintainers
10
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/address - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

2

dist/AddressFormatter.js

@@ -171,2 +171,4 @@ "use strict";

return [2 /*return*/, country.attributes.zipKey];
case types_1.FieldName.Address2:
return [2 /*return*/, country.attributes.address2Key];
default:

@@ -173,0 +175,0 @@ return [2 /*return*/, key];

@@ -8,2 +8,3 @@ declare const data: {

zipKey: string;
address2Key: string;
phoneNumberPrefix: number;

@@ -10,0 +11,0 @@ format: {

@@ -10,2 +10,3 @@ "use strict";

zipKey: 'postalCode',
address2Key: 'aptUnitNumber',
phoneNumberPrefix: 1,

@@ -12,0 +13,0 @@ format: {

@@ -8,2 +8,3 @@ declare const data: {

zipKey: string;
address2Key: string;
phoneNumberPrefix: number;

@@ -10,0 +11,0 @@ format: {

@@ -10,2 +10,3 @@ "use strict";

zipKey: 'postalCode',
address2Key: 'aptUnitNumber',
phoneNumberPrefix: 1,

@@ -12,0 +13,0 @@ format: {

@@ -8,2 +8,3 @@ declare const data: {

zipKey: string;
address2Key: string;
phoneNumberPrefix: number;

@@ -10,0 +11,0 @@ format: {

@@ -10,2 +10,3 @@ "use strict";

zipKey: 'postalCode',
address2Key: 'aptSuiteEtc',
phoneNumberPrefix: 33,

@@ -12,0 +13,0 @@ format: {

@@ -8,2 +8,3 @@ declare const data: {

zipKey: string;
address2Key: string;
phoneNumberPrefix: number;

@@ -10,0 +11,0 @@ format: {

@@ -10,2 +10,3 @@ "use strict";

zipKey: 'postalCode',
address2Key: 'aptSuiteEtc',
phoneNumberPrefix: 81,

@@ -12,0 +13,0 @@ format: {

@@ -8,2 +8,3 @@ declare const data: {

zipKey: string;
address2Key: string;
format: {

@@ -10,0 +11,0 @@ edit: string;

@@ -10,2 +10,3 @@ "use strict";

zipKey: 'postalCode',
address2Key: 'aptSuiteEtc',
format: {

@@ -12,0 +13,0 @@ edit: '{firstName}{lastName}_{company}_{address1}_{address2}_{city}_{country}{zip}_{phone}',

@@ -42,4 +42,5 @@ export declare enum FieldName {

zipKey: string;
address2Key: string;
provinces: Province[];
};
}

2

package.json
{
"name": "@shopify/address",
"version": "1.0.2",
"version": "1.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Address utilities for formatting addresses.",

@@ -77,4 +77,31 @@ # `@shopify/address`

await getTranslationKey('US', 'zip'); // => "zipCode"
await getTranslationKey('CA', 'address2'); // => "aptUnitNumber"
await getTranslationKey('JA', 'address2'); // => "aptSuiteEtc"
```
#### Translation keys
The label used to designate zip code and provinces are not the same from a country to another
- `zoneKey` is one of the following
- `county`
- `emirate`
- `governorate`
- `prefecture`
- `province`
- `region`
- `stateAndTerritory`
- `state`
- `zipKey` is one of the following
- `postcode`
- `pincode`
- `zipCode`
- `address2Key` is one of the following
- `aptSuiteEtc`
- `aptUnitNumber`
#### Example Usage

@@ -81,0 +108,0 @@

@@ -118,2 +118,4 @@ import {Address, FieldName, Country} from './types';

return country.attributes.zipKey;
case FieldName.Address2:
return country.attributes.address2Key;
default:

@@ -120,0 +122,0 @@ return key;

@@ -194,2 +194,12 @@ import {fetch} from '@shopify/jest-dom-mocks';

it('translates based on the country address2 key', async () => {
const addressFormatter = new AddressFormatter('ja');
const result = await addressFormatter.getTranslationKey(
'JP',
FieldName.Address2,
);
expect(result).toBe('aptSuiteEtc');
});
it('translates based on the country key', async () => {

@@ -196,0 +206,0 @@ const addressFormatter = new AddressFormatter('ja');

@@ -8,2 +8,3 @@ const data = {

zipKey: 'postalCode',
address2Key: 'aptUnitNumber',
phoneNumberPrefix: 1,

@@ -10,0 +11,0 @@ format: {

@@ -8,2 +8,3 @@ const data = {

zipKey: 'postalCode',
address2Key: 'aptUnitNumber',
phoneNumberPrefix: 1,

@@ -10,0 +11,0 @@ format: {

@@ -8,2 +8,3 @@ const data = {

zipKey: 'postalCode',
address2Key: 'aptSuiteEtc',
phoneNumberPrefix: 33,

@@ -10,0 +11,0 @@ format: {

@@ -8,2 +8,3 @@ const data = {

zipKey: 'postalCode',
address2Key: 'aptSuiteEtc',
phoneNumberPrefix: 81,

@@ -10,0 +11,0 @@ format: {

@@ -8,2 +8,3 @@ const data = {

zipKey: 'postalCode',
address2Key: 'aptSuiteEtc',
format: {

@@ -10,0 +11,0 @@ edit:

@@ -46,4 +46,5 @@ export enum FieldName {

zipKey: string;
address2Key: string;
provinces: Province[];
};
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc