Comparing version 0.1.3 to 0.1.4
@@ -1,1 +0,1 @@ | ||
module.exports=function(r){r=r.replace(/^(?:\+|00)?86/,"");var e=require("./readnumber");var a=e(r);if(!a){return null}var d=require("./readaddress");var n=require("./readsp");var i=d(a.addressIndex);var u=n(a.spIndex);return{province:i.province,city:i.city,sp:u}}; | ||
module.exports=function(r){r=r.replace(/[- ]/g,"").replace(/^(?:\+|00)?86/,"");var e=require("./readnumber");var a=e(r);if(!a){return null}var d=require("./readaddress");var n=require("./readsp");var i=d(a.addressIndex);var u=n(a.spIndex);return{province:i.province,city:i.city,sp:u}}; |
{ | ||
"name": "cellocate", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "手机归属地查询", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# Cellocate | ||
[![npm](http://img.shields.io/npm/v/cellocate.svg)](https://www.npmjs.com/package/cellocate) | ||
[![npm](http://img.shields.io/npm/l/cellocate.svg)](https://www.npmjs.com/package/cellocate) | ||
手机号码归属地查询工具。 | ||
@@ -44,2 +47,6 @@ | ||
### v0.1.4 (2015-02-05) | ||
- 添加对含空格和中杠(-)号码的处理 | ||
### v0.1.3 / v0.1.2 (2015-01-19) | ||
@@ -46,0 +53,0 @@ |
/*global describe,it*/ | ||
/*jshint node:true,strict:false,expr:true,unused:false*/ | ||
var cellocate = require('../src/index'); | ||
var cellocate = require('../lib/index'); | ||
var should = require('should'); | ||
@@ -275,2 +275,37 @@ | ||
describe('空格和中杠处理',function(){ | ||
it('前空格',function(){ | ||
var numberInfo = cellocate(' 13400000000'); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
it('中空格',function(){ | ||
var numberInfo = cellocate('134 0000 0000'); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
it('尾空格',function(){ | ||
var numberInfo = cellocate('13400000000 '); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
it('各种空格',function(){ | ||
var numberInfo = cellocate(' 134 000 000 00 '); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
it('前杠',function(){ | ||
var numberInfo = cellocate('-13400000000'); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
it('中杠',function(){ | ||
var numberInfo = cellocate('134-0000-0000'); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
it('尾杠',function(){ | ||
var numberInfo = cellocate('13400000000-'); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
it('各种杠',function(){ | ||
var numberInfo = cellocate('-134-000-000-00-'); | ||
numberInfo.should.be.an.Object; | ||
}); | ||
}); | ||
describe('特殊号码',function(){ | ||
@@ -277,0 +312,0 @@ it('0375',function(){ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1569315
286
65