2014年10月29日 星期三

[NodeJS] domain-parser

晚上7:58
NodeJS - domain-parser
前言:
剛好想要這個功能,但是沒有現成的
有找到php版本,不過判斷的情況不是很完美
只好自己寫一個 XD

套件名稱:
domain-parser
https://www.npmjs.org/package/domain-parser

Version: 0.0.5 (2014/10/29)

Source Code on Github
https://github.com/kilfu0701/node-domain-parser


安裝方式 (Install)
npm install domain-parser

用法 (Usage)
var dp = require('domain-parser');

var result = dp('www.google.com.tw').domainName;
console.log(result);
// google.com.tw

result = dp('direct.jp-bank.japanpost.jp').domainName;
console.log(result);
// japanpost.jp