Skip to content

Commit

Permalink
Merge pull request #192 from ScaleLeap/assert-marketplace-has-adverti…
Browse files Browse the repository at this point in the history
…sing

feat: adds assertMarketplaceHasAdvertising assertion function
  • Loading branch information
repo-ranger[bot] authored May 17, 2020
2 parents 5e6fd39 + 33113b7 commit 31fe712
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 184 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ const CA = findAmazonMarketplace('countryCode', AmazonMarketplaceCountryCode.CA)
// Function will throw an error if marketplace is not found
// Thus return value is never undefined.
const US = findAmazonMarketplaceOrFail('countryCode', AmazonMarketplaceCountryCode.US)

// TypeScript assertion function that ensures that the marketplace has advertising enabled.
// Throws if not.
assertMarketplaceHasAdvertising(CA)

// CA.advertising is now type guarded and can be safely accessed.
console.log(CA.advertising.countryCode)
```

### Full Data Object Example
Expand Down
Loading

0 comments on commit 31fe712

Please sign in to comment.