inputmask.dependencyLib.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*!
  2. * inputmask.dependencyLib.js
  3. * http://github.com/RobinHerbots/jquery.inputmask
  4. * Copyright (c) 2010 - 2015 Robin Herbots
  5. * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. * Version: 3.2.1-89
  7. */
  8. !function(factory) {
  9. "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
  10. }(function($) {
  11. function indexOf(list, elem) {
  12. for (var i = 0, len = list.length; len > i; i++) if (list[i] === elem) return i;
  13. return -1;
  14. }
  15. function type(obj) {
  16. return null == obj ? obj + "" : "object" == typeof obj || "function" == typeof obj ? class2type[class2type.toString.call(obj)] || "object" : typeof obj;
  17. }
  18. function Event(elem) {
  19. this[0] = elem;
  20. }
  21. function DependencyLib(elem) {
  22. return this instanceof DependencyLib ? void 0 : new Event(elem);
  23. }
  24. for (var class2type = {}, classTypes = "Boolean Number String Function Array Date RegExp Object Error".split(" "), nameNdx = 0; nameNdx < classTypes.length; nameNdx++) class2type["[object " + classTypes[nameNdx] + "]"] = classTypes[nameNdx].toLowerCase();
  25. return Event.prototype = {
  26. on: function() {
  27. return $.fn.on.apply($(this[0]), arguments), this;
  28. },
  29. off: function() {
  30. return $.fn.off.apply($(this[0]), arguments), this;
  31. },
  32. trigger: function() {
  33. return $.fn.trigger.apply($(this[0]), arguments), this;
  34. },
  35. triggerHandler: function() {
  36. return $.fn.triggerHandler.apply($(this[0]), arguments), this;
  37. }
  38. }, DependencyLib.isFunction = function(obj) {
  39. return "function" === type(obj);
  40. }, DependencyLib.noop = function() {}, DependencyLib.parseJSON = function(data) {
  41. return JSON.parse(data + "");
  42. }, DependencyLib.isArray = Array.isArray, DependencyLib.inArray = function(elem, arr, i) {
  43. return null == arr ? -1 : indexOf(arr, elem, i);
  44. }, DependencyLib.valHooks = $.valHooks, DependencyLib.isWindow = function(obj) {
  45. return null != obj && obj === obj.window;
  46. }, DependencyLib.isPlainObject = function(obj) {
  47. return "object" !== type(obj) || obj.nodeType || DependencyLib.isWindow(obj) ? !1 : obj.constructor && !class2type.hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ? !1 : !0;
  48. }, DependencyLib.extend = function() {
  49. var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = !1;
  50. for ("boolean" == typeof target && (deep = target, target = arguments[i] || {},
  51. i++), "object" == typeof target || DependencyLib.isFunction(target) || (target = {}),
  52. i === length && (target = this, i--); length > i; i++) if (null != (options = arguments[i])) for (name in options) src = target[name],
  53. copy = options[name], target !== copy && (deep && copy && (DependencyLib.isPlainObject(copy) || (copyIsArray = DependencyLib.isArray(copy))) ? (copyIsArray ? (copyIsArray = !1,
  54. clone = src && DependencyLib.isArray(src) ? src : []) : clone = src && DependencyLib.isPlainObject(src) ? src : {},
  55. target[name] = DependencyLib.extend(deep, clone, copy)) : void 0 !== copy && (target[name] = copy));
  56. return target;
  57. }, DependencyLib.each = $.each, DependencyLib.map = $.map, DependencyLib.Event = $.Event,
  58. DependencyLib.data = $.data, window.dependencyLib = DependencyLib, DependencyLib;
  59. });