Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including now-name with all npm packages installed. Try it out:

var nowName = require("now-name")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

now-name v1.0.2

Check whether a '.now.sh' domain name is available on ZEIT Now

now-name Build Status

Check whether a '.now.sh' domain name is available on ZEIT Now.

Install

~ ❯❯❯ npm install now-name

Usage

const nowName = require('now-name');

(async () => {
    // Check an alias name
    console.log(await nowName('carbon'));
    //=> false

    console.log(await nowName('deploy.now.sh'));
    //=> false

    console.log(await nowName('thisdoesntexist'));
    //=> true


    const result = await nowName.many(['deploy', 'jaymock.now.sh', 'abc123']);

    console.log(result.get('deploy'));
    //=> false

    console.log(result.get('jaymock.now.sh'));
    //=> false

    console.log(result.get('abc123'));
    //=> true

    try {
        await nowName('_ABC');
    } catch (error) {
        console.log(error.message);
        // Invalid domain name "_ABC"
    }
})();

API

nowName(name)

Check whether a .now.sh domain name is available (not registered) on ZEIT Now.

Returns a Promise<boolean> of whether the given domain is available.

name

Type: string

Name to check.

nowName.many(names)

Check whether multiple .now.sh domain names are available (not registered) on ZEIT Now.

Returns a Promise<Map> of name and status.

names

Type: string[]

Multiple names to check.

Credits

  • npm-name - this module is essentially a fork of npm-name, modified to check the availability of ZEIT Now's .now.sh domain names, instead of NPM package names

Related

License

MIT © Nikolaos Kamarinakis

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free