etl-collections
A util nodejs project for etl.
install
npm install etl-collections --save
usage
The idcard and mobile is generated by random rule.
var etl = require('etl-collections');
mobile utils lib
query
- @param number 號碼
15101332143
- @desc 查詢國內(nèi)號碼
- @return {}
- province 手機(jī)號碼歸屬地 省份
- city 手機(jī)號碼歸屬地 城市
- type 手機(jī)號碼 運(yùn)營商
- @example
etl.mobile.query('15101332143')
=>
{ 'province': '甘肅', city: '蘭州', type: '中國移動' }
getCountry
- @param number 號碼
+8615101332143
- @desc 查詢國際號碼
- @return {}
- code 國家編碼
- number 號碼
- country 國家中文
- enCountry 國家英文
- @example
etl.mobile.getCountry('+8615101332143')
=>
{ code: 'CN',
number: '15101332143',
country: '中國',
enCountry: 'China' }
getInfo
- @param code 國家代碼
CN
- @desc 根據(jù)國家代碼查詢信息
- @return {}
- code 國家代碼
- name 國家名稱中文
- enName 國家名稱英文
- number 國家號碼編號
- @example
etl.mobile.getInfo('CN')
=>
{ code: 'CN', name: '中國', enName: 'China', number: '86' }
idcard util lib
query
- @param id 號碼
371501199112025093
- @desc 解析中國身份證號碼
- @return {}
- areaId 區(qū)域ID
- areaName 區(qū)域名稱
- birthday 出生日期
- gender 性別
- @example
etl.idcard.query('371501199112025093')
=>
{ areaId: '371501',
areaName: '山東省聊城市市轄區(qū)',
birthday: '19911202',
gender: '男' }
getArea
- @param id 號碼
371501199112025093
- @desc 解析中國身份證號碼
- @return {}
- areaId 區(qū)域ID
- areaName 區(qū)域名稱
- @example
etl.idcard.getArea('371501199112025093')
=>
{ areaId: '371501',
areaName: '山東省聊城市市轄區(qū)'}
getBirthday
- @param id 號碼
371501199112025093
- @desc 解析中國身份證號碼
- @return {}
- birthday 出生日期
- @example
etl.idcard.getBirthday('371501199112025093')
=>
{ birthday: '19911202' }
getGender
- @param id 號碼
371501199112025093
- @desc 解析中國身份證號碼
- @return {}
- gender 性別
- @example
etl.idcard.getGender('371501199112025093')
=>
{ gender: '男' }
isIdcard
- @param id 號碼
371501199112025093
- @desc 解析中國身份證號碼
- @return Boolean
- @example
etl.idcard.isIdcard('371501199112025093')
=>
true
Lunar Calendar util lib
整合農(nóng)歷與公歷之間相互轉(zhuǎn)換,含有二十四節(jié)氣战虏,天干地支紀(jì)年紀(jì)月紀(jì)日萍丐,生肖屬相轩端,公歷節(jié)假日及農(nóng)歷傳統(tǒng)節(jié)假日信息等功能模塊。(支持1891-2100年)
參考
isLeapYear
- @param {Number} year 公歷年
- @desc 判斷公歷年是否是閏年
- @return {Boolean}
- @example
etl.lunar.isLeapYear(2017)
=>
false
lunarToSolar
- @param {Number} year,month,day 農(nóng)歷年逝变,月(1-13基茵,有閏月),日
- @desc 將農(nóng)歷轉(zhuǎn)換為公歷
- @return {}
- year 公歷年
- month 公歷月
- day 公歷日
- @example
etl.lunar.lunarToSolar(2016,12,23)
=>
{ year: 2017, month: 1, day: 20 }
solarToLunar
- @param {Number} year,month,day 公歷年壳影,月拱层,日
- @desc 將公歷轉(zhuǎn)換為農(nóng)歷
- @return {}
- @example
etl.lunar.solarToLunar(2017,1,20)
=>
{ zodiac: '猴',
GanZhiYear: '丙申',
GanZhiMonth: '辛丑',
GanZhiDay: '丁未',
worktime: 0,
term: '大寒',
lunarYear: 2016,
lunarMonth: 12,
lunarDay: 23,
lunarMonthName: '十二月',
lunarDayName: '廿三',
lunarLeapMonth: 0,
solarFestival: undefined,
lunarFestival: '小年' }
calendar
- @param
- {Number} year,month 公歷年,月
- {Boolean} fill 是否用上下月數(shù)據(jù)補(bǔ)齊首尾空缺宴咧,首例數(shù)據(jù)從周日開始
- @desc 獲取指定公歷月份的農(nóng)歷數(shù)據(jù)
- @return {}
- @example
etl.lunar.calendar(2017,1,false)
=>
{
firstDay: 0,
monthDays: 31,
monthData:
[{ year: 2017,
month: 1,
day: 1,
zodiac: '猴',
GanZhiYear: '丙申',
GanZhiMonth: '庚子',
GanZhiDay: '戊子',
worktime: 0,
term: undefined,
lunarYear: 2016,
lunarMonth: 12,
lunarDay: 4,
lunarMonthName: '十二月',
lunarDayName: '初四',
lunarLeapMonth: 0,
solarFestival: '元旦節(jié)',
lunarFestival: undefined
},...]
}
solarCalendar
- @param
- {Number} year,month 公歷年根灯,月
- {Boolean} fill 是否用上下月數(shù)據(jù)補(bǔ)齊首尾空缺,首例數(shù)據(jù)從周日開始
- @desc 獲取指定公歷月份的日歷數(shù)據(jù)
- @return {}
- @example
etl.lunar.solarCalendar(2017,1,false)
=>
{ firstDay: 0,
monthDays: 31,
monthData:
[ { year: 2017, month: 1, day: 1 },
{ year: 2017, month: 1, day: 2 },
...
{ year: 2017, month: 1, day: 31 } ] }