Skip to content

Commit

Permalink
Better explainations.
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed Nov 7, 2013
1 parent 0b7dc8d commit 10a321a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.3.0

* added browser compatibility
* availability for [component.io](http://component.io/) and [bower](http://bower.io/) package managers
* updated rules

## 1.2.0

* removed `node 0.6` compat
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

[![browser support](https://ci.testling.com/oncletom/tld.js.png)](https://ci.testling.com/oncletom/tld.js)

Handful API to do stuff with domain names and URIs: validity, public etc.
**`tld.js` is JavaScript API to work against complex domain names, subdomains and URIs**.

Its main purpose is to check if a domain name is valid upon. 2 constraints:
* an up-to-date TLDs database
* must work in node.js and the browser
It answers with accuracy to questions like *what is the domain/subdomain of `mail.google.com` and `a.b.ide.kyoto.jp`?*

It is based on the [public suffix list](http://publicsuffix.org/list/) provided by Mozilla.
`tld.js` is fully tested, works in Node.js and in the browser, with or without AMD.
Its database keeps up to date thanks to Mozilla's [public suffix list](http://publicsuffix.org/list/) to have and keep up to date with domain names.

Thanks Mozilla!

Expand Down Expand Up @@ -39,7 +38,7 @@ Thanks Mozilla!
```javascript
var tld = require('tldjs');

tld.getDomain('http://mail.google.co.uk');
tld.getDomain('mail.google.co.uk');
// -> 'google.co.uk'
```

Expand All @@ -48,11 +47,22 @@ tld.getDomain('http://mail.google.co.uk');
```html
<script src="bower_components/tld/dist/tld.min.js">
<script>
tld.getDomain('http://mail.google.co.uk');
tld.getDomain('mail.google.co.uk');
// -> 'google.co.uk'
</script>
```

## Browser with AMD / Require.js

```html
<script>
require(['tld'], function(tld){
tld.getDomain('mail.google.co.uk');
// -> 'google.co.uk'
});
</script>
```

# API

## getDomain()
Expand Down
2 changes: 1 addition & 1 deletion dist/rules.json

Large diffs are not rendered by default.

0 comments on commit 10a321a

Please sign in to comment.