@util.js/arrays 0.41.1 → 0.41.3
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.
- package/dist/Arrays.js +5 -17
- package/package.json +3 -3
package/dist/Arrays.js
CHANGED
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* JavaScript utility methods for [arrays]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array}
|
|
4
5
|
* @public
|
|
5
6
|
* @class
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
8
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
9
|
-
|
|
10
9
|
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
11
|
-
|
|
12
10
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
13
|
-
|
|
14
11
|
var _of = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/of"));
|
|
15
|
-
|
|
16
12
|
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
|
17
|
-
|
|
18
13
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
19
|
-
|
|
20
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
21
|
-
|
|
22
15
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
23
|
-
|
|
24
16
|
var Arrays = /*#__PURE__*/function () {
|
|
25
17
|
function Arrays() {
|
|
26
18
|
(0, _classCallCheck2["default"])(this, Arrays);
|
|
27
19
|
}
|
|
28
|
-
|
|
29
20
|
(0, _createClass2["default"])(Arrays, [{
|
|
30
21
|
key: "from",
|
|
31
22
|
value:
|
|
@@ -45,6 +36,7 @@ var Arrays = /*#__PURE__*/function () {
|
|
|
45
36
|
function from() {
|
|
46
37
|
return _from["default"].apply(Array, arguments);
|
|
47
38
|
}
|
|
39
|
+
|
|
48
40
|
/**
|
|
49
41
|
* Determines whether the passed value is an Array.
|
|
50
42
|
*
|
|
@@ -56,12 +48,12 @@ var Arrays = /*#__PURE__*/function () {
|
|
|
56
48
|
* @instance
|
|
57
49
|
* @function
|
|
58
50
|
*/
|
|
59
|
-
|
|
60
51
|
}, {
|
|
61
52
|
key: "isArray",
|
|
62
53
|
value: function isArray() {
|
|
63
54
|
return _isArray["default"].apply(Array, arguments);
|
|
64
55
|
}
|
|
56
|
+
|
|
65
57
|
/**
|
|
66
58
|
* Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments
|
|
67
59
|
*
|
|
@@ -73,12 +65,12 @@ var Arrays = /*#__PURE__*/function () {
|
|
|
73
65
|
* @instance
|
|
74
66
|
* @function
|
|
75
67
|
*/
|
|
76
|
-
|
|
77
68
|
}, {
|
|
78
69
|
key: "of",
|
|
79
70
|
value: function of() {
|
|
80
71
|
return _of["default"].apply(Array, arguments);
|
|
81
72
|
}
|
|
73
|
+
|
|
82
74
|
/**
|
|
83
75
|
* Shuffles the elements of the specified array.
|
|
84
76
|
*
|
|
@@ -90,12 +82,12 @@ var Arrays = /*#__PURE__*/function () {
|
|
|
90
82
|
* @instance
|
|
91
83
|
* @function
|
|
92
84
|
*/
|
|
93
|
-
|
|
94
85
|
}, {
|
|
95
86
|
key: "shuffle",
|
|
96
87
|
value: function shuffle(array) {
|
|
97
88
|
return knuthshuffle().knuthShuffle(this.from(array));
|
|
98
89
|
}
|
|
90
|
+
|
|
99
91
|
/**
|
|
100
92
|
* Sorts the elements of an array and (unlike returns a **new array** with the sorted elements. The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.
|
|
101
93
|
*
|
|
@@ -107,12 +99,10 @@ var Arrays = /*#__PURE__*/function () {
|
|
|
107
99
|
* @instance
|
|
108
100
|
* @function
|
|
109
101
|
*/
|
|
110
|
-
|
|
111
102
|
}, {
|
|
112
103
|
key: "sort",
|
|
113
104
|
value: function sort(array, compareFunction) {
|
|
114
105
|
var _context;
|
|
115
|
-
|
|
116
106
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
|
|
117
107
|
// https://stackoverflow.com/questions/9592740/how-can-you-sort-an-array-without-mutating-the-original-array
|
|
118
108
|
// https://stackoverflow.com/a/9592755
|
|
@@ -121,10 +111,8 @@ var Arrays = /*#__PURE__*/function () {
|
|
|
121
111
|
}]);
|
|
122
112
|
return Arrays;
|
|
123
113
|
}();
|
|
124
|
-
|
|
125
114
|
module.exports = Arrays;
|
|
126
115
|
var dependencies = {};
|
|
127
|
-
|
|
128
116
|
function knuthshuffle() {
|
|
129
117
|
return dependencies["knuth-shuffle"] || (dependencies["knuth-shuffle"] = require("knuth-shuffle"));
|
|
130
118
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Chris Topher <c@creemama.com>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@babel/runtime-corejs3": "7.
|
|
4
|
+
"@babel/runtime-corejs3": "7.21.0",
|
|
5
5
|
"knuth-shuffle": "1.0.8"
|
|
6
6
|
},
|
|
7
7
|
"dependencies-comments": [
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"type": "git",
|
|
31
31
|
"url": "https://github.com/creemama/utiljs/tree/master/packages/utiljs-arrays"
|
|
32
32
|
},
|
|
33
|
-
"version": "0.41.
|
|
34
|
-
"gitHead": "
|
|
33
|
+
"version": "0.41.3",
|
|
34
|
+
"gitHead": "e17139b7f85c3abec178d8facdacc2aa6c5bb553"
|
|
35
35
|
}
|