Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@thom4parisot
Copy link
Owner

The idea is to bind tldjs.parse() to the first CLI argument/stdin:

$ echo 'github.com' | tldjs | jq '.tldExists'
> true

$ export SOME_VARIABLE='github.com'
$ tldjs $SOME_VARIABLE
> {
  "hostname": "github.com",
  "isValid": true,
  "tldExists": true,
  "publicSuffix": "com",
  "domain": "github.com",
  "subdomain": ""
}

@remusao
Copy link
Collaborator

remusao commented Sep 10, 2017

Great idea! :D Will have a look a bit later.


'use strict';

var tldjs = require('..');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it import index.js by default?

Copy link
Owner Author

@thom4parisot thom4parisot Sep 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does import the index.js file of the parent path.

According to https://nodejs.org/api/modules.html#modules_folders_as_modules:

If there is no package.json file present in the directory, then Node.js will attempt to load an index.js or index.node file out of that directory.

Because there is a package.json file, if the main field would have declared a different filepath, the latter would have been loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants