Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimalist Command Line Interface #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Minimalist Command Line Interface #109

wants to merge 2 commits into from

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

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.

None yet

2 participants