Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danwebb/valid-shopify-domain
Ensure the provided .myshopify.com domain is valid
https://github.com/danwebb/valid-shopify-domain
nodejs shopify
Last synced: 24 days ago
JSON representation
Ensure the provided .myshopify.com domain is valid
- Host: GitHub
- URL: https://github.com/danwebb/valid-shopify-domain
- Owner: DanWebb
- Created: 2018-07-06T03:05:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-19T03:56:18.000Z (over 6 years ago)
- Last Synced: 2024-04-24T00:41:32.837Z (9 months ago)
- Topics: nodejs, shopify
- Language: JavaScript
- Size: 43 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Valid Shopify Domain
Ensure the provided .myshopify.com domain is valid meaning...
- It ends with .myshopify.com
- Has a store name that is greater than or equal to 4 characters and less than or equal to 60 charcters
- Does not contain characters other than letters (a-z), numbers (0-9), dots, and hyphens.## Install
```
npm i -S valid-shopify-domain
```## Usage
```js
import validShopifyDomain from 'valid-shopify-domain';validShopifyDomain('store.myshopify.com'); // returns: store.myshopify.com
validShopifyDomain('store.myshpfy.com'); // throws: The provided domain did not end in .myshopify.com
validShopifyDomain('.myshopify.com'); // throws: You only provided ".myshopify.com" as the domain, a valid store name is required
validShopifyDomain('shp.myshopify.com'); // throws: The store name portion of the domain must be atleast 4 characters
validShopifyDomain('1111111111111111111111111111111111111111111111111111111111111.myshopify.com'); // throws: The provided domain contains too many characters (74 max)
validShopifyDomain('my!store.myshopify.com'); // throws: The provided domain must not contain characters other than letters (a-z), numbers (0-9), dots, and hyphens
```