libphonenumber独立(没有大量谷歌依赖)?替代lib? [英] libphonenumber standalone (without masses of google dependencies)? Alternate lib?

查看:75
本文介绍了libphonenumber独立(没有大量谷歌依赖)?替代lib?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用 http://code.google.com/p/libphonenumber/为一个完善的项目。今天该项目不使用谷歌的JavaScript库,支持jQuery,jQueryUI,requirejs等。

I am looking at using http://code.google.com/p/libphonenumber/ for a well-established project. Today the project does not use Google's libraries for JavaScript, favoring jQuery, jQueryUI, requirejs, and so on.

libphonenumber看起来很棒...除了javascript版本(svn) co http://libphonenumber.googlecode.com/svn/trunk/javascript/ libphonenumber -js)使用goog.require调用。如果运行演示(libphonenumber-js / i18n / phonenumbers / demo.html,如果你按建议检查),它会从closure-library.googlecode.com获取大量的谷歌库:

libphonenumber looks awesome ... except that the javascript version (svn co http://libphonenumber.googlecode.com/svn/trunk/javascript/ libphonenumber-js) is laced with goog.require calls. If one runs the demo (libphonenumber-js/i18n/phonenumbers/demo.html if you checked out as suggested) it pulls in tons of google libraries from closure-library.googlecode.com :

GET base.js
GET deps.js
GET error.js
GET string.js
GET asserts.js
GET array.js
GET useragent.js
GET browserfeature.js
GET tagname.js
GET classes.js
GET math.js
GET coordinate.js
GET size.js
GET object.js
GET dom.js
GET json.js
GET util.js
GET descriptor.js
GET fielddescriptor.js
GET message.js
GET serializer.js
GET objectserializer.js
GET stringbuffer.js
GET lazydeserializer.js
GET pbliteserializer.js

我相信如果我使用闭包编译器编译它( 如果你给use_closure_library参数赋值为true,编译器会在源代码中查找goog.require()语句,并提供请求的Closure Library代码。任何此类陈述。, https://developers.google.com/closure/compiler / docs / api-ref )我可以减少原始请求数量,但对于电话号码解析器来说,这似乎仍然是一个相当过量的内容,即使是功能齐全的内容。

I believe if I compile this using the closure compiler ("If you give the use_closure_library parameter a value of true, the compiler looks for goog.require() statements in the source code and supplies the Closure Library code requested by any such statements.", https://developers.google.com/closure/compiler/docs/api-ref) I can cut down the raw number of requests, but this still seems like a rather excessive amount of content for a phone number parser, even a full-featured one.

我的问题有两个可能的答案:

My question has two possible answers:


  1. 一种在JavaScript中使用libphonenumber而无需拉动的方法在所有Google JavaScript基础库中

  2. 另一个独立的(如没有几十个依赖项)具有JavaScript和Java实现的一流电话号码处理库

任何和所有建议最受赞赏。

Any and all suggestions most appreciated.

推荐答案

我有一个自定义构建 (目前为220KB)我用于国际电话输入插件,暴露了大量辅助功能。有关详细信息,请阅读来源

I've got a custom build (currently 220KB) that I use for my International Telephone Input plugin, with plenty of helper functions exposed. Read the source for details.

这篇关于libphonenumber独立(没有大量谷歌依赖)?替代lib?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆