ソースを参照

create dependencyLib

Robin Herbots 10 年 前
コミット
3b9f09399c

+ 4 - 1
.eslintrc

@@ -37,6 +37,9 @@
   },
   "globals": {
     "Inputmask": true,
-    "jQuery": false
+    "jQuery": false,
+    "module": false,
+    "require": false,
+    "define": false
   }
 }

+ 1 - 0
CHANGELOG.md

@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
 ## [Unreleased]
 
 ### Added
+- dependencyLib wrapper around needed jQuery functionality
 - mac address alias #986
 - tabThrough option - Tab and autoselect mask parts #433
 - eslint testing in grunt validate task

+ 2 - 31
Gruntfile.js

@@ -15,8 +15,6 @@ module.exports = function(grunt) {
 		for (var srcNdx in srcFiles) {
 			var dstFile = srcFiles[srcNdx].replace("js/", ""),
 				dstFileMin = dstFile.replace(".js", ".min.js");
-			wrapModuleLoaders(srcFiles[srcNdx], "build/" + dstFile, dstFile.indexOf("jquery") == -1 ?
-				(dstFile.indexOf("extension") == -1 ? ["jquery"] : ["jquery", "./inputmask"]) : ["jquery", "./inputmask"]);
 			uglifyConfig[dstFile] = {
 				dest: 'dist/inputmask/' + dstFile,
 				src: "build/" + dstFile,
@@ -29,7 +27,7 @@ module.exports = function(grunt) {
 				}
 			};
 			uglifyConfig[dstFileMin] = {
-				dest: "dist/inputmask/" + dstFileMin,
+				dest: "dist/min/inputmask/" + dstFileMin,
 				src: "build/" + dstFile,
 				options: {
 					banner: createBanner(dstFileMin),
@@ -56,7 +54,7 @@ module.exports = function(grunt) {
 		}
 		uglifyConfig["inputmaskbundlemin"] = {
 			files: {
-				'dist/<%= pkg.name %>.bundle.min.js': srcFiles
+				'dist/min/<%= pkg.name %>.bundle.min.js': srcFiles
 			},
 			options: {
 				banner: createBanner('<%= pkg.name %>.bundle'),
@@ -67,33 +65,6 @@ module.exports = function(grunt) {
 		return uglifyConfig;
 	}
 
-	function wrapModuleLoaders(src, dst, dependencies) {
-		function stripClosureExecution() {
-			return srcFile.replace(new RegExp("\\(jQuery\\)[\\s\\S]*$"), "");
-		}
-
-		function createCommonJsRequires(dependencies) {
-			var res = [];
-
-			dependencies.forEach(function(dep) {
-				res.push("require('" + dep + "')");
-			});
-
-			return res.join(", ");
-		}
-
-		var srcFile = grunt.file.read(src),
-			dstContent = "(function (factory) {" +
-			"if (typeof define === 'function' && define.amd) {" +
-			"define(" + JSON.stringify(dependencies) + ", factory);" +
-			"} else if (typeof exports === 'object') {" +
-			"module.exports = factory(" + createCommonJsRequires(dependencies) + ");" +
-			"} else {" +
-			"factory(jQuery);" +
-			"}}\n" + stripClosureExecution() + ");";
-		grunt.file.write(dst, dstContent);
-	}
-
 	// Project configuration.
 	grunt.initConfig({
 		pkg: grunt.file.readJSON("package.json"),

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.64-166",
+  "version": "3.1.64-168",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/inputmask.js",

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
     "name": "jquery_inputmask",
     "repository": "robinherbots/jquery.inputmask",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-    "version": "3.1.64-166",
+    "version": "3.1.64-168",
     "keywords": [ "jquery", "plugins", "input", "form", "inputmask", "mask" ],
     "main": "./dist/jquery.inputmask.bundle.js",
     "scripts": [

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
     "name": "robinherbots/jquery.inputmask",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-	"version": "3.1.64-166",
+	"version": "3.1.64-168",
     "type": "library",
     "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
     "homepage": "http://robinherbots.github.io/jquery.inputmask",

+ 1 - 1
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

+ 1 - 1
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

+ 1 - 1
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);

+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

+ 1 - 1
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

+ 1 - 1
dist/inputmask/inputmask.regex.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

+ 23 - 9
dist/jquery.inputmask.bundle.js

@@ -3,9 +3,11 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-166
+* Version: 3.1.64-168
 */
-!function($) {
+!function(factory) {
+    "function" == typeof define && define.amd ? define([ "dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("dependencyLib")) : factory(window.dependencyLib || jQuery);
+}(function($) {
     function Inputmask(options) {
         this.el = void 0, this.opts = $.extend(!0, {}, this.defaults, options), this.noMasksCache = options && void 0 !== options.definitions, 
         this.userOptions = options || {}, resolveAlias(this.opts.alias, options, this.opts);
@@ -1362,7 +1364,9 @@
     };
     var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = null !== ua.match(new RegExp("android.*chrome.*", "i")), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
     return window.Inputmask = Inputmask, Inputmask;
-}(jQuery), function($) {
+}), function(factory) {
+    "function" == typeof define && define.amd ? define([ "jQuery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jQuery"), require("inputmask")) : factory(jQuery, window.Inputmask);
+}(function($, Inputmask) {
     return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
         var nptmask, input;
         if (options = options || {}, "string" == typeof fn) switch (fn) {
@@ -1409,7 +1413,9 @@
             });
         }
     }), $.fn.inputmask;
-}(jQuery), function($) {
+}), function(factory) {
+    "function" == typeof define && define.amd ? define([ "jQuery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jQuery"), require("inputmask")) : factory(jQuery, window.Inputmask);
+}(function($, Inputmask) {
     return Inputmask.extendDefinitions({
         h: {
             validator: "[01][0-9]|2[0-3]",
@@ -1883,7 +1889,9 @@
             clearIncomplete: !0
         }
     }), Inputmask;
-}(jQuery), function($) {
+}), function(factory) {
+    "function" == typeof define && define.amd ? define([ "jQuery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jQuery"), require("inputmask")) : factory(jQuery, window.Inputmask);
+}(function($, Inputmask) {
     return Inputmask.extendDefinitions({
         A: {
             validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
@@ -1988,7 +1996,9 @@
             mask: "##:##:##:##:##:##"
         }
     }), Inputmask;
-}(jQuery), function($) {
+}), function(factory) {
+    "function" == typeof define && define.amd ? define([ "jQuery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jQuery"), require("inputmask")) : factory(jQuery, window.Inputmask);
+}(function($, Inputmask) {
     return Inputmask.extendAliases({
         numeric: {
             mask: function(opts) {
@@ -2406,7 +2416,9 @@
             allowMinus: !1
         }
     }), Inputmask;
-}(jQuery), function($) {
+}), function(factory) {
+    "function" == typeof define && define.amd ? define([ "jQuery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jQuery"), require("inputmask")) : factory(jQuery, window.Inputmask);
+}(function($, Inputmask) {
     return Inputmask.extendAliases({
         phone: {
             url: "phone-codes/phone-codes.js",
@@ -2444,7 +2456,9 @@
             nojumpsThreshold: 4
         }
     }), Inputmask;
-}(jQuery), function($) {
+}), function(factory) {
+    "function" == typeof define && define.amd ? define([ "jQuery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jQuery"), require("inputmask")) : factory(jQuery, window.Inputmask);
+}(function($, Inputmask) {
     return Inputmask.extendAliases({
         Regex: {
             mask: "r",
@@ -2549,4 +2563,4 @@
             }
         }
     }), Inputmask;
-}(jQuery);
+});

ファイルの差分が大きいため隠しています
+ 0 - 11
dist/jquery.inputmask.bundle.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/inputmask/inputmask.date.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/inputmask/inputmask.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/inputmask/inputmask.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/inputmask/inputmask.phone.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/inputmask/inputmask.regex.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/inputmask/jquery.inputmask.min.js


ファイルの差分が大きいため隠しています
+ 12 - 0
dist/min/jquery.inputmask.bundle.min.js


+ 14 - 0
js/dependencyLib.js

@@ -0,0 +1,14 @@
+(function(factory) {
+		if (typeof define === "function" && define.amd) {
+			define(["jQuery"], factory);
+		} else if (typeof exports === "object") {
+			module.exports = factory(require("jQuery"));
+		} else {
+			factory(jQuery);
+		}
+	}
+	(function($) {
+		var dependencyLib = $; //todo split out needed functionality
+		window.dependencyLib = dependencyLib;
+		return dependencyLib;
+	}));

ファイルの差分が大きいため隠しています
+ 566 - 557
js/inputmask.date.extensions.js


+ 11 - 2
js/inputmask.extensions.js

@@ -7,7 +7,16 @@ Version: 0.0.0-dev
 
 Optional extensions on the jquery.inputmask base
 */
-(function($) {
+(function(factory) {
+		if (typeof define === "function" && define.amd) {
+			define(["jQuery", "inputmask"], factory);
+		} else if (typeof exports === "object") {
+			module.exports = factory(require("jQuery"), require("inputmask"));
+		} else {
+			factory(jQuery, window.Inputmask);
+		}
+	}
+	(function($, Inputmask) {
 	//extra definitions
 	Inputmask.extendDefinitions({
 		"A": {
@@ -134,4 +143,4 @@ Optional extensions on the jquery.inputmask base
 		}
 	});
 	return Inputmask;
-})(jQuery);
+}));

ファイルの差分が大きいため隠しています
+ 2281 - 2273
js/inputmask.js


+ 11 - 2
js/inputmask.numeric.extensions.js

@@ -7,7 +7,16 @@ Version: 0.0.0-dev
 
 Optional extensions on the jquery.inputmask base
 */
-(function($) {
+(function(factory) {
+		if (typeof define === "function" && define.amd) {
+			define(["jQuery", "inputmask"], factory);
+		} else if (typeof exports === "object") {
+			module.exports = factory(require("jQuery"), require("inputmask"));
+		} else {
+			factory(jQuery, window.Inputmask);
+		}
+	}
+	(function($, Inputmask) {
 	//number aliases
 	Inputmask.extendAliases({
 		"numeric": {
@@ -717,4 +726,4 @@ Optional extensions on the jquery.inputmask base
 		}
 	});
 	return Inputmask;
-})(jQuery);
+}));

+ 51 - 42
js/inputmask.phone.extensions.js

@@ -17,49 +17,58 @@ When using this extension make sure you specify the correct url to get the masks
 
 
 */
-(function($) {
-	Inputmask.extendAliases({
-		"phone": {
-			url: "phone-codes/phone-codes.js",
-			countrycode: "",
-			mask: function(opts) {
-				opts.definitions["#"] = opts.definitions["9"];
-				var maskList = [];
-				$.ajax({
-					url: opts.url,
-					async: false,
-					dataType: "json",
-					success: function(response) {
-						maskList = response;
-					},
-					error: function(xhr, ajaxOptions, thrownError) {
-						alert(thrownError + " - " + opts.url);
-					}
-				});
+(function(factory) {
+		if (typeof define === "function" && define.amd) {
+			define(["jQuery", "inputmask"], factory);
+		} else if (typeof exports === "object") {
+			module.exports = factory(require("jQuery"), require("inputmask"));
+		} else {
+			factory(jQuery, window.Inputmask);
+		}
+	}
+	(function($, Inputmask) {
+		Inputmask.extendAliases({
+			"phone": {
+				url: "phone-codes/phone-codes.js",
+				countrycode: "",
+				mask: function(opts) {
+					opts.definitions["#"] = opts.definitions["9"];
+					var maskList = [];
+					$.ajax({
+						url: opts.url,
+						async: false,
+						dataType: "json",
+						success: function(response) {
+							maskList = response;
+						},
+						error: function(xhr, ajaxOptions, thrownError) {
+							alert(thrownError + " - " + opts.url);
+						}
+					});
 
-				maskList = maskList.sort(function(a, b) {
-					return (a.mask || a) < (b.mask || b) ? -1 : 1;
-				});
+					maskList = maskList.sort(function(a, b) {
+						return (a.mask || a) < (b.mask || b) ? -1 : 1;
+					});
 
-				return maskList;
-			},
-			keepStatic: false,
-			nojumps: true,
-			nojumpsThreshold: 1,
-			onBeforeMask: function(value, opts) {
-				var processedValue = value.replace(/^0/g, "");
-				if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) === -1)
-					processedValue = "+" + opts.countrycode + processedValue;
+					return maskList;
+				},
+				keepStatic: false,
+				nojumps: true,
+				nojumpsThreshold: 1,
+				onBeforeMask: function(value, opts) {
+					var processedValue = value.replace(/^0/g, "");
+					if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) === -1)
+						processedValue = "+" + opts.countrycode + processedValue;
 
-				return processedValue;
+					return processedValue;
+				}
+			},
+			"phonebe": {
+				alias: "phone",
+				url: "phone-codes/phone-be.js",
+				countrycode: "32",
+				nojumpsThreshold: 4
 			}
-		},
-		"phonebe": {
-			alias: "phone",
-			url: "phone-codes/phone-be.js",
-			countrycode: "32",
-			nojumpsThreshold: 4
-		}
-	});
-	return Inputmask;
-})(jQuery);
+		});
+		return Inputmask;
+	}));

+ 11 - 2
js/inputmask.regex.extensions.js

@@ -8,7 +8,16 @@ Version: 0.0.0-dev
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
 */
-(function($) {
+(function(factory) {
+		if (typeof define === "function" && define.amd) {
+			define(["jQuery", "inputmask"], factory);
+		} else if (typeof exports === "object") {
+			module.exports = factory(require("jQuery"), require("inputmask"));
+		} else {
+			factory(jQuery, window.Inputmask);
+		}
+	}
+	(function($, Inputmask) {
 	Inputmask.extendAliases({ // $(selector).inputmask("Regex", { regex: "[0-9]*"}
 		"Regex": {
 			mask: "r",
@@ -201,4 +210,4 @@ Allows for using regular expressions as a mask
 		}
 	});
 	return Inputmask;
-})(jQuery);
+}));

+ 69 - 59
js/jquery.inputmask.js

@@ -6,64 +6,74 @@
  * Version: 0.0.0-dev
  */
 
-(function($) {
-	if ($.fn.inputmask === undefined) {
-		//jquery plugin
-		$.fn.inputmask = function(fn, options) {
-			var nptmask, input;
-			options = options || {};
-			if (typeof fn === "string") {
-				switch (fn) {
-					case "mask":
-						nptmask = new Inputmask(options);
-						return this.each(function() {
-							nptmask.mask(this);
-						});
-					case "unmaskedvalue":
-						input = this.jquery && this.length > 0 ? this[0] : this;
-						return input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
-					case "remove":
-						return this.each(function() {
-							if (this.inputmask) this.inputmask.remove();
-						});
-					case "getemptymask":
-						input = this.jquery && this.length > 0 ? this[0] : this;
-						return input.inputmask ? input.inputmask.getemptymask() : "";
-					case "hasMaskedValue": //check wheter the returned value is masked or not; currently only works reliable when using jquery.val fn to retrieve the value
-						input = this.jquery && this.length > 0 ? this[0] : this;
-						return input.inputmask ? input.inputmask.hasMaskedValue() : false;
-					case "isComplete":
-						input = this.jquery && this.length > 0 ? this[0] : this;
-						return input.inputmask ? input.inputmask.isComplete() : true;
-					case "getmetadata": //return mask metadata if exists
-						input = this.jquery && this.length > 0 ? this[0] : this;
-						return input.inputmask ? input.inputmask.getmetadata() : undefined;
-					case "setvalue":
-						input = this.jquery && this.length > 0 ? this[0] : this;
-						$(input).val(options);
-						if (input.Inputmask === undefined)
-							$(input).triggerHandler("setvalue.inputmask");
-						break;
-					default:
-						options.alias = fn;
+(function(factory) {
+		if (typeof define === "function" && define.amd) {
+			define(["jQuery", "inputmask"], factory);
+		} else if (typeof exports === "object") {
+			module.exports = factory(require("jQuery"), require("inputmask"));
+		} else {
+			factory(jQuery, window.Inputmask);
+		}
+	}
+	(function($, Inputmask) {
+		if ($.fn.inputmask === undefined) {
+			//jquery plugin
+			$.fn.inputmask = function(fn, options) {
+				var nptmask, input;
+				options = options || {};
+				if (typeof fn === "string") {
+					switch (fn) {
+						case "mask":
+							nptmask = new Inputmask(options);
+							return this.each(function() {
+								nptmask.mask(this);
+							});
+						case "unmaskedvalue":
+							input = this.jquery && this.length > 0 ? this[0] : this;
+							return input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
+						case "remove":
+							return this.each(function() {
+								if (this.inputmask) this.inputmask.remove();
+							});
+						case "getemptymask":
+							input = this.jquery && this.length > 0 ? this[0] : this;
+							return input.inputmask ? input.inputmask.getemptymask() : "";
+						case "hasMaskedValue": //check wheter the returned value is masked or not; currently only works reliable when using jquery.val fn to retrieve the value
+							input = this.jquery && this.length > 0 ? this[0] : this;
+							return input.inputmask ? input.inputmask.hasMaskedValue() : false;
+						case "isComplete":
+							input = this.jquery && this.length > 0 ? this[0] : this;
+							return input.inputmask ? input.inputmask.isComplete() : true;
+						case "getmetadata": //return mask metadata if exists
+							input = this.jquery && this.length > 0 ? this[0] : this;
+							return input.inputmask ? input.inputmask.getmetadata() : undefined;
+						case "setvalue":
+							input = this.jquery && this.length > 0 ? this[0] : this;
+							$(input).val(options);
+							if (input.Inputmask === undefined) {
+								$(input).triggerHandler("setvalue.inputmask");
+							}
+							break;
+						default:
+							options.alias = fn;
+							nptmask = new Inputmask(options);
+							return this.each(function() {
+								nptmask.mask(this);
+							});
+					}
+				} else if (typeof fn == "object") {
+					nptmask = new Inputmask(fn);
+					return this.each(function() {
+						nptmask.mask(this);
+					});
+				} else if (fn === undefined) {
+					//look for data-inputmask atributes
+					return this.each(function() {
 						nptmask = new Inputmask(options);
-						return this.each(function() {
-							nptmask.mask(this);
-						});
+						nptmask.mask(this);
+					});
 				}
-			} else if (typeof fn == "object") {
-				nptmask = new Inputmask(fn);
-				return this.each(function() {
-					nptmask.mask(this);
-				});
-			} else if (fn === undefined) {
-				//look for data-inputmask atributes
-				return this.each(function() {
-					nptmask = new Inputmask(options);
-					nptmask.mask(this);
-				});
-			}
-		};
-	}
-	return $.fn.inputmask;
-})(jQuery);
+			};
+		}
+		return $.fn.inputmask;
+	}));

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.64-166",
+  "version": "3.1.64-168",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "files": [