ilib
Version:
iLib is a cross-engine library of internationalization (i18n) classes written in pure JS
1 lines • 1.46 kB
JavaScript
var ilib=require("./ilib.js");var Utils=require("./Utils.js");var JSUtils=require("./JSUtils.js");var Locale=require("./Locale.js");var NumberingPlan=function(e){var n=true,t={};this.locale=new Locale;if(e){if(e.locale){this.locale=typeof e.locale==="string"?new Locale(e.locale):e.locale}if(typeof e.sync!=="undefined"){n=e.sync==true}if(e.loadParams){t=e.loadParams}}Utils.loadData({name:"numplan.json",object:NumberingPlan,locale:this.locale,sync:n,loadParams:t,callback:ilib.bind(this,function(n){if(!n){n={region:"XX",skipTrunk:false,trunkCode:"0",iddCode:"00",dialingPlan:"closed",commonFormatChars:" ()-./",fieldLengths:{areaCode:0,cic:0,mobilePrefix:0,serviceCode:0}}}this.npdata=n;if(e&&typeof e.onLoad==="function"){e.onLoad(this)}})})};NumberingPlan.prototype={getName:function(){return this.npdata.region},getTrunkCode:function(){return this.npdata.trunkCode},getIDDCode:function(){return this.npdata.iddCode},getPlanStyle:function(){return this.npdata.dialingPlan},getContextFree:function(){return this.npdata.contextFree},getFindExtensions:function(){return this.npdata.findExtensions},getSkipTrunk:function(){return this.npdata.skipTrunk},getTrunkRequired:function(){return this.npdata.trunkRequired},getExtendedAreaCode:function(){return this.npdata.extendedAreaCodes},getCommonFormatChars:function(){return this.npdata.commonFormatChars},getFieldLength:function(e){var n=this.npdata.fieldLengths;return n[e]}};module.exports=NumberingPlan;