New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

betsol-ng-intl-tel-input

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

betsol-ng-intl-tel-input - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

CHANGELOG.md

7

bower.json
{
"name": "betsol-ng-intl-tel-input",
"description": "intl-tel-input integration for Angular.js",
"version": "1.1.0",
"main": "dist/betsol-ng-intl-tel-input.js",
"version": "1.2.0",
"main": "dist/scripts/betsol-ng-intl-tel-input.js",
"ignore": [

@@ -15,3 +15,4 @@ "src",

"dependencies": {
"intl-tel-input": "^8.4.6"
"angular": "^1.2.29",
"intl-tel-input": "^7.1.1"
},

@@ -18,0 +19,0 @@ "repository": {

/**
* betsol-ng-intl-tel-input - intl-tel-input integration for Angular.js
* @version v1.0.0
* @version v1.2.0
* @link https://github.com/betsol/ng-intl-tel-input

@@ -13,2 +13,4 @@ * @license MIT

var VALIDATOR_NAME = 'phoneNumber';
angular.module('betsol.intlTelInput', [])

@@ -25,4 +27,4 @@

scope: {
intlTelInputOptions: '=',
intlTelInputController: '='
intlTelInputOptions: '=?',
intlTelInputController: '=?'
},

@@ -67,8 +69,25 @@ link: function link ($scope, $element, attrs, modelCtrl) {

*/
modelCtrl.$validators.phoneNumber = function (modelValue, viewValue) {
if (!modelValue && !viewValue) {
return true;
}
return callApi('isValidNumber');
};
if ('undefined' !== typeof modelCtrl.$validators) {
// Using newer `$validators` API.
modelCtrl.$validators[VALIDATOR_NAME] = function (modelValue, viewValue) {
if (!modelValue && !viewValue) {
return true;
}
return isValidInput();
};
} else {
// Using legacy validation approach.
// This is required for Angular v1.2.x.
// @todo: deprecate this in the future!
var validateValue = function (value) {
if (!value) {
return value;
}
var isValid = isValidInput(value);
modelCtrl.$setValidity(VALIDATOR_NAME, isValid);
return value;
};
modelCtrl.$parsers.push(validateValue);
modelCtrl.$formatters.push(validateValue);
}

@@ -132,2 +151,23 @@ /**

/**
* Validates the passed value, or the current value of the input.
* @todo: remove the workaround when this is implemented: https://github.com/jackocnr/intl-tel-input/issues/391
*
* @param {string} value
*
* @returns {boolean}
*/
function isValidInput (value) {
var useWorkaround = ('undefined' !== typeof value);
if (useWorkaround) {
var previousValue = $element.val();
$element.val(value);
}
var result = callApi('isValidNumber');
if (useWorkaround) {
$element.val(previousValue);
}
return result;
}
}

@@ -134,0 +174,0 @@ };

/**
* betsol-ng-intl-tel-input - intl-tel-input integration for Angular.js
* @version v1.0.0
* @version v1.2.0
* @link https://github.com/betsol/ng-intl-tel-input

@@ -9,2 +9,2 @@ * @license MIT

*/
!function(n){"use strict";function t(n){console.log("ng-intl-tel-input: "+n)}n.module("betsol.intlTelInput",[]).constant("intlTelInputOptions",{}).directive("intlTelInput",["intlTelInputOptions",function(e){return{restrict:"AC",require:"ngModel",scope:{intlTelInputOptions:"=",intlTelInputController:"="},link:function(i,l,u,o){function r(){return p.apply(l,arguments)}function c(n){i.$evalAsync(function(){o.$setViewValue("",n)})}var p=l.intlTelInput;if(!p)return void t("intl-tel-input jQuery plugin must be loaded, skipping directive initialization");var s=n.extend({},i.intlTelInputOptions||{},e),a=!1,d=!1;r(s),o.$render=function(){a=!0,r("setNumber",o.$viewValue||""),a=!1},o.$validators.phoneNumber=function(n,t){return n||t?r("isValidNumber"):!0},i.$on("$destroy",function(){r("destroy")});var f=o.$setViewValue;o.$setViewValue=function(){arguments[0]=r("getNumber"),f.apply(o,arguments)},l.bind("country-change countrychange",function(){a||d||c("countrychange")}),i.intlTelInputController={},i.intlTelInputController.setCountry=function(n){d=!0,r("setCountry",n),c(),d=!1}}}}])}(angular);
!function(n){"use strict";function t(n){console.log("ng-intl-tel-input: "+n)}var e="phoneNumber";n.module("betsol.intlTelInput",[]).constant("intlTelInputOptions",{}).directive("intlTelInput",["intlTelInputOptions",function(i){return{restrict:"AC",require:"ngModel",scope:{intlTelInputOptions:"=?",intlTelInputController:"=?"},link:function(u,r,l,o){function a(){return c.apply(r,arguments)}function s(n){u.$evalAsync(function(){o.$setViewValue("",n)})}function p(n){var t="undefined"!=typeof n;if(t){var e=r.val();r.val(n)}var i=a("isValidNumber");return t&&r.val(e),i}var c=r.intlTelInput;if(!c)return void t("intl-tel-input jQuery plugin must be loaded, skipping directive initialization");var f=n.extend({},u.intlTelInputOptions||{},i),d=!1,v=!1;if(a(f),o.$render=function(){d=!0,a("setNumber",o.$viewValue||""),d=!1},"undefined"!=typeof o.$validators)o.$validators[e]=function(n,t){return n||t?p():!0};else{var y=function(n){if(!n)return n;var t=p(n);return o.$setValidity(e,t),n};o.$parsers.push(y),o.$formatters.push(y)}u.$on("$destroy",function(){a("destroy")});var $=o.$setViewValue;o.$setViewValue=function(){arguments[0]=a("getNumber"),$.apply(o,arguments)},r.bind("country-change countrychange",function(){d||v||s("countrychange")}),u.intlTelInputController={},u.intlTelInputController.setCountry=function(n){v=!0,a("setCountry",n),s(),v=!1}}}}])}(angular);

@@ -161,3 +161,3 @@ //==============//

gulp.task('default', function (done) {
runSequence('build', 'test', done);
runSequence('build', done);
});

@@ -164,0 +164,0 @@

{
"name": "betsol-ng-intl-tel-input",
"description": "intl-tel-input integration for Angular.js",
"version": "1.1.0",
"version": "1.2.0",
"homepage": "https://github.com/betsol/ng-intl-tel-input",

@@ -9,3 +9,4 @@ "license": "MIT",

"dependencies": {
"intl-tel-input": "^8.4.6"
"angular": "^1.2.29",
"intl-tel-input": "^7.1.1"
},

@@ -12,0 +13,0 @@ "devDependencies": {

@@ -5,2 +5,4 @@ (function (angular) {

var VALIDATOR_NAME = 'phoneNumber';
angular.module('betsol.intlTelInput', [])

@@ -17,4 +19,4 @@

scope: {
intlTelInputOptions: '=',
intlTelInputController: '='
intlTelInputOptions: '=?',
intlTelInputController: '=?'
},

@@ -59,8 +61,25 @@ link: function link ($scope, $element, attrs, modelCtrl) {

*/
modelCtrl.$validators.phoneNumber = function (modelValue, viewValue) {
if (!modelValue && !viewValue) {
return true;
}
return callApi('isValidNumber');
};
if ('undefined' !== typeof modelCtrl.$validators) {
// Using newer `$validators` API.
modelCtrl.$validators[VALIDATOR_NAME] = function (modelValue, viewValue) {
if (!modelValue && !viewValue) {
return true;
}
return isValidInput();
};
} else {
// Using legacy validation approach.
// This is required for Angular v1.2.x.
// @todo: deprecate this in the future!
var validateValue = function (value) {
if (!value) {
return value;
}
var isValid = isValidInput(value);
modelCtrl.$setValidity(VALIDATOR_NAME, isValid);
return value;
};
modelCtrl.$parsers.push(validateValue);
modelCtrl.$formatters.push(validateValue);
}

@@ -124,2 +143,23 @@ /**

/**
* Validates the passed value, or the current value of the input.
* @todo: remove the workaround when this is implemented: https://github.com/jackocnr/intl-tel-input/issues/391
*
* @param {string} value
*
* @returns {boolean}
*/
function isValidInput (value) {
var useWorkaround = ('undefined' !== typeof value);
if (useWorkaround) {
var previousValue = $element.val();
$element.val(value);
}
var result = callApi('isValidNumber');
if (useWorkaround) {
$element.val(previousValue);
}
return result;
}
}

@@ -126,0 +166,0 @@ };

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc