@webalternatif/js-core 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/cjs/Mouse.js +9 -3
  2. package/dist/cjs/Translator.js +60 -18
  3. package/dist/cjs/array.js +28 -24
  4. package/dist/cjs/dom.js +52 -45
  5. package/dist/cjs/eventDispatcher.js +21 -15
  6. package/dist/cjs/index.js +65 -20
  7. package/dist/cjs/is.js +25 -19
  8. package/dist/cjs/math.js +26 -20
  9. package/dist/cjs/random.js +13 -7
  10. package/dist/cjs/string.js +78 -74
  11. package/dist/cjs/stringPrototype.js +7 -3
  12. package/dist/cjs/traversal.js +30 -28
  13. package/dist/cjs/utils.js +19 -15
  14. package/dist/esm/Translator.js +46 -5
  15. package/package.json +4 -3
  16. package/types/Translator.d.ts +9 -2
  17. package/dist/cjs/i18n/agenda/en.js +0 -65
  18. package/dist/cjs/i18n/agenda/fr.js +0 -67
  19. package/dist/cjs/i18n/agenda/index.js +0 -2
  20. package/dist/cjs/i18n/ajaxform/en.js +0 -5
  21. package/dist/cjs/i18n/ajaxform/fr.js +0 -5
  22. package/dist/cjs/i18n/ajaxform/index.js +0 -2
  23. package/dist/cjs/i18n/ajaxupload/en.js +0 -11
  24. package/dist/cjs/i18n/ajaxupload/fr.js +0 -11
  25. package/dist/cjs/i18n/ajaxupload/index.js +0 -2
  26. package/dist/cjs/i18n/autocomplete/en.js +0 -3
  27. package/dist/cjs/i18n/autocomplete/fr.js +0 -3
  28. package/dist/cjs/i18n/autocomplete/index.js +0 -2
  29. package/dist/cjs/i18n/confirm/en.js +0 -5
  30. package/dist/cjs/i18n/confirm/fr.js +0 -5
  31. package/dist/cjs/i18n/confirm/index.js +0 -2
  32. package/dist/cjs/i18n/core/en.js +0 -4
  33. package/dist/cjs/i18n/core/fr.js +0 -4
  34. package/dist/cjs/i18n/core/index.js +0 -2
  35. package/dist/cjs/i18n/datagrid/en.js +0 -8
  36. package/dist/cjs/i18n/datagrid/fr.js +0 -8
  37. package/dist/cjs/i18n/datagrid/index.js +0 -2
  38. package/dist/cjs/i18n/date/en.js +0 -47
  39. package/dist/cjs/i18n/date/fr.js +0 -47
  40. package/dist/cjs/i18n/date/index.js +0 -2
  41. package/dist/cjs/i18n/datetimepicker/en.js +0 -27
  42. package/dist/cjs/i18n/datetimepicker/fr.js +0 -27
  43. package/dist/cjs/i18n/datetimepicker/index.js +0 -2
  44. package/dist/cjs/i18n/dialog/en.js +0 -3
  45. package/dist/cjs/i18n/dialog/fr.js +0 -3
  46. package/dist/cjs/i18n/dialog/index.js +0 -2
  47. package/dist/cjs/i18n/fulldayeventagenda/en.js +0 -65
  48. package/dist/cjs/i18n/fulldayeventagenda/fr.js +0 -67
  49. package/dist/cjs/i18n/fulldayeventagenda/index.js +0 -2
  50. package/dist/cjs/i18n/index.js +0 -30
  51. package/dist/cjs/i18n/richtexteditor/en.js +0 -56
  52. package/dist/cjs/i18n/richtexteditor/fr.js +0 -56
  53. package/dist/cjs/i18n/richtexteditor/index.js +0 -2
  54. package/dist/cjs/i18n/select/en.js +0 -3
  55. package/dist/cjs/i18n/select/fr.js +0 -3
  56. package/dist/cjs/i18n/select/index.js +0 -2
  57. package/dist/cjs/i18n/timepicker/en.js +0 -3
  58. package/dist/cjs/i18n/timepicker/fr.js +0 -3
  59. package/dist/cjs/i18n/timepicker/index.js +0 -2
  60. package/dist/cjs/i18n/useragenda/en.js +0 -65
  61. package/dist/cjs/i18n/useragenda/fr.js +0 -67
  62. package/dist/cjs/i18n/useragenda/index.js +0 -2
  63. package/dist/cjs/i18n.js +0 -41
  64. package/dist/esm/i18n/agenda/en.js +0 -65
  65. package/dist/esm/i18n/agenda/fr.js +0 -67
  66. package/dist/esm/i18n/agenda/index.js +0 -2
  67. package/dist/esm/i18n/ajaxform/en.js +0 -5
  68. package/dist/esm/i18n/ajaxform/fr.js +0 -5
  69. package/dist/esm/i18n/ajaxform/index.js +0 -2
  70. package/dist/esm/i18n/ajaxupload/en.js +0 -11
  71. package/dist/esm/i18n/ajaxupload/fr.js +0 -11
  72. package/dist/esm/i18n/ajaxupload/index.js +0 -2
  73. package/dist/esm/i18n/autocomplete/en.js +0 -3
  74. package/dist/esm/i18n/autocomplete/fr.js +0 -3
  75. package/dist/esm/i18n/autocomplete/index.js +0 -2
  76. package/dist/esm/i18n/confirm/en.js +0 -5
  77. package/dist/esm/i18n/confirm/fr.js +0 -5
  78. package/dist/esm/i18n/confirm/index.js +0 -2
  79. package/dist/esm/i18n/core/en.js +0 -4
  80. package/dist/esm/i18n/core/fr.js +0 -4
  81. package/dist/esm/i18n/core/index.js +0 -2
  82. package/dist/esm/i18n/datagrid/en.js +0 -8
  83. package/dist/esm/i18n/datagrid/fr.js +0 -8
  84. package/dist/esm/i18n/datagrid/index.js +0 -2
  85. package/dist/esm/i18n/date/en.js +0 -47
  86. package/dist/esm/i18n/date/fr.js +0 -47
  87. package/dist/esm/i18n/date/index.js +0 -2
  88. package/dist/esm/i18n/datetimepicker/en.js +0 -27
  89. package/dist/esm/i18n/datetimepicker/fr.js +0 -27
  90. package/dist/esm/i18n/datetimepicker/index.js +0 -2
  91. package/dist/esm/i18n/dialog/en.js +0 -3
  92. package/dist/esm/i18n/dialog/fr.js +0 -3
  93. package/dist/esm/i18n/dialog/index.js +0 -2
  94. package/dist/esm/i18n/fulldayeventagenda/en.js +0 -65
  95. package/dist/esm/i18n/fulldayeventagenda/fr.js +0 -67
  96. package/dist/esm/i18n/fulldayeventagenda/index.js +0 -2
  97. package/dist/esm/i18n/index.js +0 -30
  98. package/dist/esm/i18n/richtexteditor/en.js +0 -56
  99. package/dist/esm/i18n/richtexteditor/fr.js +0 -56
  100. package/dist/esm/i18n/richtexteditor/index.js +0 -2
  101. package/dist/esm/i18n/select/en.js +0 -3
  102. package/dist/esm/i18n/select/fr.js +0 -3
  103. package/dist/esm/i18n/select/index.js +0 -2
  104. package/dist/esm/i18n/timepicker/en.js +0 -3
  105. package/dist/esm/i18n/timepicker/fr.js +0 -3
  106. package/dist/esm/i18n/timepicker/index.js +0 -2
  107. package/dist/esm/i18n/useragenda/en.js +0 -65
  108. package/dist/esm/i18n/useragenda/fr.js +0 -67
  109. package/dist/esm/i18n/useragenda/index.js +0 -2
  110. package/dist/esm/i18n.js +0 -41
@@ -1,4 +1,12 @@
1
+ "use strict";
2
+
1
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _is = require("./is.js");
9
+ var _traversal = require("./traversal.js");
2
10
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
11
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
12
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -9,8 +17,6 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
9
17
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
10
18
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
11
19
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
12
- import { isFunction, isString, isUndefined } from "./is.js";
13
- import { each, map } from "./traversal.js";
14
20
  var _listeners = /*#__PURE__*/new WeakMap();
15
21
  var EventDispatcher = /*#__PURE__*/function () {
16
22
  function EventDispatcher() {
@@ -21,10 +27,10 @@ var EventDispatcher = /*#__PURE__*/function () {
21
27
  key: "addListener",
22
28
  value: function addListener(eventsName, callback, context) {
23
29
  var _this = this;
24
- if (!isFunction(callback)) {
30
+ if (!(0, _is.isFunction)(callback)) {
25
31
  throw new Error('Callback must be a function.');
26
32
  }
27
- if (!isString(eventsName)) {
33
+ if (!(0, _is.isString)(eventsName)) {
28
34
  throw new Error('Events name must be a string separated by comma.');
29
35
  }
30
36
  for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
@@ -35,7 +41,7 @@ var EventDispatcher = /*#__PURE__*/function () {
35
41
  context: context,
36
42
  args: args
37
43
  };
38
- each(eventsName.split(','), function (i, eventName) {
44
+ (0, _traversal.each)(eventsName.split(','), function (i, eventName) {
39
45
  if (!eventName) return true; // continue
40
46
 
41
47
  eventName = eventName.trim();
@@ -54,7 +60,7 @@ var EventDispatcher = /*#__PURE__*/function () {
54
60
  for (var _len2 = arguments.length, listenerArgs = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
55
61
  listenerArgs[_key2 - 3] = arguments[_key2];
56
62
  }
57
- each(eventsName.split(','), function (i, eventName) {
63
+ (0, _traversal.each)(eventsName.split(','), function (i, eventName) {
58
64
  eventName = eventName.trim();
59
65
  if (!eventName) return true; // continue
60
66
 
@@ -76,10 +82,10 @@ var EventDispatcher = /*#__PURE__*/function () {
76
82
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
77
83
  args[_key4 - 1] = arguments[_key4];
78
84
  }
79
- if (!isString(eventsName)) {
85
+ if (!(0, _is.isString)(eventsName)) {
80
86
  throw new Error('Events name must be a string seperated by comma.');
81
87
  }
82
- each(eventsName.split(','), function (i, eventName) {
88
+ (0, _traversal.each)(eventsName.split(','), function (i, eventName) {
83
89
  eventName = eventName.trim();
84
90
  if (!eventName) return true; // continue
85
91
 
@@ -87,7 +93,7 @@ var EventDispatcher = /*#__PURE__*/function () {
87
93
  console.warn("No listeners found for event: ".concat(eventName));
88
94
  return true; // continue
89
95
  }
90
- each(_classPrivateFieldGet(_listeners, _this3)[eventName], function (i, listener) {
96
+ (0, _traversal.each)(_classPrivateFieldGet(_listeners, _this3)[eventName], function (i, listener) {
91
97
  listener.callback.apply(listener.context, [eventName].concat(listener.args).concat(args));
92
98
  });
93
99
  });
@@ -96,10 +102,10 @@ var EventDispatcher = /*#__PURE__*/function () {
96
102
  }, {
97
103
  key: "hasListener",
98
104
  value: function hasListener(eventName, callback, context) {
99
- if (isUndefined(callback)) {
100
- return !isUndefined(_classPrivateFieldGet(_listeners, this)[eventName]);
105
+ if ((0, _is.isUndefined)(callback)) {
106
+ return !(0, _is.isUndefined)(_classPrivateFieldGet(_listeners, this)[eventName]);
101
107
  }
102
- return !!map(_classPrivateFieldGet(_listeners, this)[eventName], function (i, listener) {
108
+ return !!(0, _traversal.map)(_classPrivateFieldGet(_listeners, this)[eventName], function (i, listener) {
103
109
  return listener.callback === callback && listener.context === context ? true : null;
104
110
  }).length;
105
111
  }
@@ -108,10 +114,10 @@ var EventDispatcher = /*#__PURE__*/function () {
108
114
  value: function removeListener(eventName, callback, context) {
109
115
  var _this4 = this;
110
116
  if (this.hasListener(eventName, callback, context)) {
111
- if (isUndefined(callback)) {
117
+ if ((0, _is.isUndefined)(callback)) {
112
118
  _classPrivateFieldGet(_listeners, this)[eventName].splice(0);
113
119
  } else {
114
- each(_classPrivateFieldGet(_listeners, this)[eventName], function (i) {
120
+ (0, _traversal.each)(_classPrivateFieldGet(_listeners, this)[eventName], function (i) {
115
121
  _classPrivateFieldGet(_listeners, _this4)[eventName].splice(i, 1);
116
122
  delete _classPrivateFieldGet(_listeners, _this4)[eventName];
117
123
  return false; // break
@@ -133,4 +139,4 @@ var EventDispatcher = /*#__PURE__*/function () {
133
139
  }]);
134
140
  }();
135
141
  var eventDispatcher = new EventDispatcher();
136
- export default eventDispatcher;
142
+ var _default = exports["default"] = eventDispatcher;
package/dist/cjs/index.js CHANGED
@@ -1,28 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Mouse", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Mouse["default"];
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Translator", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _Translator["default"];
16
+ }
17
+ });
18
+ exports["default"] = exports.arrayFunctions = void 0;
19
+ Object.defineProperty(exports, "dom", {
20
+ enumerable: true,
21
+ get: function get() {
22
+ return _dom["default"];
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "eventDispatcher", {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _eventDispatcher["default"];
29
+ }
30
+ });
31
+ Object.defineProperty(exports, "getStyle", {
32
+ enumerable: true,
33
+ get: function get() {
34
+ return _dom.getStyle;
35
+ }
36
+ });
37
+ exports.utils = exports.traversal = exports.stringFunctions = exports.random = exports.math = exports.is = void 0;
38
+ var stringFunctions = _interopRequireWildcard(require("./string.js"));
39
+ exports.stringFunctions = stringFunctions;
40
+ require("./stringPrototype.js");
41
+ var arrayFunctions = _interopRequireWildcard(require("./array.js"));
42
+ exports.arrayFunctions = arrayFunctions;
43
+ var is = _interopRequireWildcard(require("./is.js"));
44
+ exports.is = is;
45
+ var random = _interopRequireWildcard(require("./random.js"));
46
+ exports.random = random;
47
+ var traversal = _interopRequireWildcard(require("./traversal.js"));
48
+ exports.traversal = traversal;
49
+ var _dom = _interopRequireWildcard(require("./dom.js"));
50
+ var math = _interopRequireWildcard(require("./math.js"));
51
+ exports.math = math;
52
+ var utils = _interopRequireWildcard(require("./utils.js"));
53
+ exports.utils = utils;
54
+ var _Translator = _interopRequireWildcard(require("./Translator.js"));
55
+ var i18n = _Translator;
56
+ var _eventDispatcher = _interopRequireDefault(require("./eventDispatcher.js"));
57
+ var _Mouse = _interopRequireDefault(require("./Mouse.js"));
58
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
59
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
1
60
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
61
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
62
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
63
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
64
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
65
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import * as stringFunctions from './string.js';
8
- import './stringPrototype.js';
9
- import * as arrayFunctions from './array.js';
10
- import * as is from './is.js';
11
- import * as random from './random.js';
12
- import * as traversal from './traversal.js';
13
- import dom, { getStyle, isDomElement, isWindow, isDocument } from './dom.js';
14
- import * as math from './math.js';
15
- import * as utils from './utils.js';
16
- import * as i18n from './Translator.js';
17
- import eventDispatcher from './eventDispatcher.js';
18
- import Mouse from './Mouse.js';
19
- import Translator from './Translator.js';
20
66
  var webf = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, stringFunctions), arrayFunctions), traversal), is), random), {}, {
21
- dom: dom,
22
- isWindow: isWindow,
23
- isDocument: isDocument,
24
- isDomElement: isDomElement,
25
- getStyle: getStyle
67
+ dom: _dom["default"],
68
+ isWindow: _dom.isWindow,
69
+ isDocument: _dom.isDocument,
70
+ isDomElement: _dom.isDomElement,
71
+ getStyle: _dom.getStyle
26
72
  }, math), utils), i18n);
27
- export default webf;
28
- export { stringFunctions, arrayFunctions, traversal, is, random, getStyle, dom, math, utils, eventDispatcher, Mouse, Translator };
73
+ var _default = exports["default"] = webf;
package/dist/cjs/is.js CHANGED
@@ -1,54 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isUndefined = exports.isTouchDevice = exports.isString = exports.isScalar = exports.isPlainObject = exports.isObject = exports.isInteger = exports.isInt = exports.isFunction = exports.isFloat = exports.isEventSupported = exports.isEvent = exports.isDate = exports.isBoolean = exports.isBool = exports.isArrayLike = exports.isArray = void 0;
7
+ var _array = require("./array.js");
1
8
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- import { inArray } from "./array.js";
3
- export var isString = function isString(str) {
9
+ var isString = exports.isString = function isString(str) {
4
10
  return typeof str == 'string' || Object.prototype.toString.call(str) === '[object String]';
5
11
  };
6
- export var isObject = function isObject(o) {
12
+ var isObject = exports.isObject = function isObject(o) {
7
13
  return !!o && !isArray(o) && _typeof(o) === 'object';
8
14
  };
9
- export var isFunction = function isFunction(f) {
15
+ var isFunction = exports.isFunction = function isFunction(f) {
10
16
  return !!f && typeof f === 'function';
11
17
  };
12
- export var isPlainObject = function isPlainObject(o) {
18
+ var isPlainObject = exports.isPlainObject = function isPlainObject(o) {
13
19
  if (false === isObject(o)) return false;
14
20
  if (undefined === o.constructor) return true;
15
21
  if (false === isObject(o.constructor.prototype)) return false;
16
22
  if (o.constructor.prototype.hasOwnProperty('isPrototypeOf') === false) return false;
17
23
  return true;
18
24
  };
19
- export var isBoolean = function isBoolean(b) {
25
+ var isBoolean = exports.isBoolean = function isBoolean(b) {
20
26
  return b === true || b === false;
21
27
  };
22
- export var isBool = isBoolean;
23
- export var isUndefined = function isUndefined(v) {
28
+ var isBool = exports.isBool = isBoolean;
29
+ var isUndefined = exports.isUndefined = function isUndefined(v) {
24
30
  return typeof v === 'undefined';
25
31
  };
26
- export var isArrayLike = function isArrayLike(o) {
32
+ var isArrayLike = exports.isArrayLike = function isArrayLike(o) {
27
33
  return !!o && !isString(o) && !isFunction(o) && isInt(o.length)
28
34
  // && o.length >= 0
29
35
  && Number.isFinite(o.length);
30
36
  };
31
- export var isArray = function isArray(a) {
37
+ var isArray = exports.isArray = function isArray(a) {
32
38
  return Array.isArray(a);
33
39
  };
34
- export var isDate = function isDate(o) {
40
+ var isDate = exports.isDate = function isDate(o) {
35
41
  return !!o && Object.prototype.toString.call(o) === '[object Date]';
36
42
  };
37
- export var isEvent = function isEvent(o) {
43
+ var isEvent = exports.isEvent = function isEvent(o) {
38
44
  return isObject(o) && (!!o.preventDefault || /\[object Event\]/.test(o.constructor.toString()));
39
45
  };
40
- export var isInteger = function isInteger(n) {
46
+ var isInteger = exports.isInteger = function isInteger(n) {
41
47
  return /^[\-]?\d+$/.test(n + '');
42
48
  };
43
- export var isInt = isInteger;
44
- export var isFloat = function isFloat(n) {
49
+ var isInt = exports.isInt = isInteger;
50
+ var isFloat = exports.isFloat = function isFloat(n) {
45
51
  return /^[\-]?\d+(\.\d+)?$/.test(n + '');
46
52
  };
47
- export var isScalar = function isScalar(value) {
53
+ var isScalar = exports.isScalar = function isScalar(value) {
48
54
  var type = _typeof(value);
49
- return value === null || inArray(type, ['string', 'number', 'bigint', 'symbol', 'boolean']);
55
+ return value === null || (0, _array.inArray)(type, ['string', 'number', 'bigint', 'symbol', 'boolean']);
50
56
  };
51
- export var isEventSupported = function () {
57
+ var isEventSupported = exports.isEventSupported = function () {
52
58
  var TAGNAMES = {
53
59
  select: 'input',
54
60
  change: 'input',
@@ -67,6 +73,6 @@ export var isEventSupported = function () {
67
73
  }
68
74
  return isEventSupported;
69
75
  }();
70
- export var isTouchDevice = function isTouchDevice() {
76
+ var isTouchDevice = exports.isTouchDevice = function isTouchDevice() {
71
77
  return isEventSupported('touchstart');
72
78
  };
package/dist/cjs/math.js CHANGED
@@ -1,25 +1,31 @@
1
- import { each } from "./traversal.js";
2
- import { isArray, isFunction, isObject } from "./is.js";
3
- import { reverse } from "./string.js";
4
- export var round = function round(val) {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.round = exports.plancher = exports.min = exports.max = exports.hex2dec = exports.floorTo = exports.dec2hex = void 0;
7
+ var _traversal = require("./traversal.js");
8
+ var _is = require("./is.js");
9
+ var _string = require("./string.js");
10
+ var round = exports.round = function round(val) {
5
11
  var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
6
12
  return Math.round(val * Math.pow(10, precision)) / Math.pow(10, precision);
7
13
  };
8
- export var floorTo = function floorTo(n, precision) {
14
+ var floorTo = exports.floorTo = function floorTo(n, precision) {
9
15
  if (precision <= 0) throw new Error('Precision must be greater than 0');
10
16
  return round(Math.floor(n / precision) * precision, 6);
11
17
  };
12
- export var plancher = floorTo;
13
- export var min = function min(list, cmp_func) {
14
- if (isArray(list)) {
18
+ var plancher = exports.plancher = floorTo;
19
+ var min = exports.min = function min(list, cmp_func) {
20
+ if ((0, _is.isArray)(list)) {
15
21
  return Math.min.apply(null, list);
16
22
  }
17
23
  var min;
18
- cmp_func = isFunction(cmp_func) ? cmp_func : function (a, b) {
24
+ cmp_func = (0, _is.isFunction)(cmp_func) ? cmp_func : function (a, b) {
19
25
  return a < b ? -1 : 1;
20
26
  };
21
- if (isObject(list)) {
22
- each(list, function (key, val, obj, index) {
27
+ if ((0, _is.isObject)(list)) {
28
+ (0, _traversal.each)(list, function (key, val, obj, index) {
23
29
  if (index === 0) {
24
30
  min = val;
25
31
  } else {
@@ -29,16 +35,16 @@ export var min = function min(list, cmp_func) {
29
35
  }
30
36
  return min;
31
37
  };
32
- export var max = function max(list, cmp_func) {
33
- if (isArray(list)) {
38
+ var max = exports.max = function max(list, cmp_func) {
39
+ if ((0, _is.isArray)(list)) {
34
40
  return Math.max.apply(null, list);
35
41
  }
36
42
  var max;
37
- cmp_func = isFunction(cmp_func) ? cmp_func : function (a, b) {
43
+ cmp_func = (0, _is.isFunction)(cmp_func) ? cmp_func : function (a, b) {
38
44
  return b - a;
39
45
  };
40
- if (isObject(list)) {
41
- each(list, function (key, val, obj, index) {
46
+ if ((0, _is.isObject)(list)) {
47
+ (0, _traversal.each)(list, function (key, val, obj, index) {
42
48
  if (index === 0) {
43
49
  max = val;
44
50
  } else {
@@ -55,7 +61,7 @@ export var max = function max(list, cmp_func) {
55
61
  * @param {number} n
56
62
  * @returns {string}
57
63
  */
58
- export var dec2hex = function dec2hex(n) {
64
+ var dec2hex = exports.dec2hex = function dec2hex(n) {
59
65
  return n.toString(16);
60
66
  };
61
67
 
@@ -65,11 +71,11 @@ export var dec2hex = function dec2hex(n) {
65
71
  * @param {string} hex
66
72
  * @returns {number}
67
73
  */
68
- export var hex2dec = function hex2dec(hex) {
69
- hex = reverse(hex + '').toUpperCase();
74
+ var hex2dec = exports.hex2dec = function hex2dec(hex) {
75
+ hex = (0, _string.reverse)(hex + '').toUpperCase();
70
76
  var c = '0123456789ABCDEF';
71
77
  var value = 0;
72
- each(hex, function (i, _char) {
78
+ (0, _traversal.each)(hex, function (i, _char) {
73
79
  var index = c.indexOf(_char);
74
80
  if (index === -1) {
75
81
  value = 0;
@@ -1,26 +1,32 @@
1
- export var randAlpha = function randAlpha(n) {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.uniqid = exports.randNum = exports.randAlphaNumCs = exports.randAlphaNum = exports.randAlphaCs = exports.randAlpha = exports.rand = void 0;
7
+ var randAlpha = exports.randAlpha = function randAlpha(n) {
2
8
  return rand("abcdefghijklmnopqrstuvwxyz".split(''), n);
3
9
  };
4
- export var randAlphaCs = function randAlphaCs(n) {
10
+ var randAlphaCs = exports.randAlphaCs = function randAlphaCs(n) {
5
11
  return rand("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(''), n);
6
12
  };
7
- export var randAlphaNum = function randAlphaNum(n) {
13
+ var randAlphaNum = exports.randAlphaNum = function randAlphaNum(n) {
8
14
  return rand("0123456789abcdefghijklmnopqrstuvwxyz".split(''), n);
9
15
  };
10
- export var randAlphaNumCs = function randAlphaNumCs(n) {
16
+ var randAlphaNumCs = exports.randAlphaNumCs = function randAlphaNumCs(n) {
11
17
  return rand("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(''), n);
12
18
  };
13
- export var randNum = function randNum(n) {
19
+ var randNum = exports.randNum = function randNum(n) {
14
20
  return rand("0123456789".split(''), n);
15
21
  };
16
- export var rand = function rand(range, n) {
22
+ var rand = exports.rand = function rand(range, n) {
17
23
  var rand = "";
18
24
  for (var i = 0; i < n; i++) {
19
25
  rand += range[Math.floor(Math.random() * 1000) % range.length];
20
26
  }
21
27
  return rand;
22
28
  };
23
- export var uniqid = function () {
29
+ var uniqid = exports.uniqid = function () {
24
30
  var uid = 0;
25
31
  return function () {
26
32
  var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';