ut2 1.9.4 → 1.9.5
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/ut2.js +6 -6
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/internals/helpers.js +1 -1
- package/es/invert.js +2 -2
- package/es/isTypedArray.js +2 -3
- package/es/nth.js +2 -2
- package/lib/internals/helpers.js +1 -1
- package/lib/invert.js +2 -2
- package/lib/isTypedArray.js +2 -3
- package/lib/nth.js +2 -2
- package/package.json +1 -1
- package/types/nth.d.ts +5 -1
package/es/internals/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import getTag from './getTag.js';
|
|
2
2
|
import { argumentsTag, functionProtoToString } from './native.js';
|
|
3
3
|
|
|
4
|
-
var VERSION = "1.9.
|
|
4
|
+
var VERSION = "1.9.5";
|
|
5
5
|
var supportedArgumentsType = getTag((function () { return arguments; })()) === argumentsTag;
|
|
6
6
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
7
7
|
function toSource(func) {
|
package/es/invert.js
CHANGED
|
@@ -9,8 +9,8 @@ function invert(object, predicate) {
|
|
|
9
9
|
_keys.forEach(function (key) {
|
|
10
10
|
var value = object[key];
|
|
11
11
|
if (predicate(value, key)) {
|
|
12
|
-
var
|
|
13
|
-
result[
|
|
12
|
+
var valueProp = value != null && typeof value.toString != 'function' ? objectProtoToString.call(value) : value;
|
|
13
|
+
result[valueProp] = key;
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
result[key] = value;
|
package/es/isTypedArray.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import getTag from './internals/getTag.js';
|
|
2
2
|
import { nodeIsTypedArray } from './internals/nodeUtil.js';
|
|
3
|
-
import
|
|
4
|
-
import isObjectLike from './isObjectLike.js';
|
|
3
|
+
import isArrayLikeObject from './isArrayLikeObject.js';
|
|
5
4
|
|
|
6
5
|
var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
|
|
7
6
|
function isTypedArray(value) {
|
|
8
7
|
if (nodeIsTypedArray) {
|
|
9
8
|
return nodeIsTypedArray(value);
|
|
10
9
|
}
|
|
11
|
-
if (
|
|
10
|
+
if (isArrayLikeObject(value)) {
|
|
12
11
|
return typedArrayPattern.test(getTag(value));
|
|
13
12
|
}
|
|
14
13
|
return false;
|
package/es/nth.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { nativeUndefined } from './internals/native.js';
|
|
2
2
|
import isArrayLike from './isArrayLike.js';
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
var nth = function (array, n) {
|
|
5
5
|
if (n === void 0) { n = 0; }
|
|
6
6
|
if (!isArrayLike(array)) {
|
|
7
7
|
return nativeUndefined;
|
|
8
8
|
}
|
|
9
9
|
n += n < 0 ? array.length : 0;
|
|
10
10
|
return array[n];
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
export { nth as default };
|
package/lib/internals/helpers.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var getTag = require('./getTag.js');
|
|
4
4
|
var native = require('./native.js');
|
|
5
5
|
|
|
6
|
-
var VERSION = "1.9.
|
|
6
|
+
var VERSION = "1.9.5";
|
|
7
7
|
var supportedArgumentsType = getTag((function () { return arguments; })()) === native.argumentsTag;
|
|
8
8
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
9
9
|
function toSource(func) {
|
package/lib/invert.js
CHANGED
|
@@ -11,8 +11,8 @@ function invert(object, predicate) {
|
|
|
11
11
|
_keys.forEach(function (key) {
|
|
12
12
|
var value = object[key];
|
|
13
13
|
if (predicate(value, key)) {
|
|
14
|
-
var
|
|
15
|
-
result[
|
|
14
|
+
var valueProp = value != null && typeof value.toString != 'function' ? native.objectProtoToString.call(value) : value;
|
|
15
|
+
result[valueProp] = key;
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
18
|
result[key] = value;
|
package/lib/isTypedArray.js
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var getTag = require('./internals/getTag.js');
|
|
4
4
|
var nodeUtil = require('./internals/nodeUtil.js');
|
|
5
|
-
var
|
|
6
|
-
var isObjectLike = require('./isObjectLike.js');
|
|
5
|
+
var isArrayLikeObject = require('./isArrayLikeObject.js');
|
|
7
6
|
|
|
8
7
|
var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
|
|
9
8
|
function isTypedArray(value) {
|
|
10
9
|
if (nodeUtil.nodeIsTypedArray) {
|
|
11
10
|
return nodeUtil.nodeIsTypedArray(value);
|
|
12
11
|
}
|
|
13
|
-
if (
|
|
12
|
+
if (isArrayLikeObject(value)) {
|
|
14
13
|
return typedArrayPattern.test(getTag(value));
|
|
15
14
|
}
|
|
16
15
|
return false;
|
package/lib/nth.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var native = require('./internals/native.js');
|
|
4
4
|
var isArrayLike = require('./isArrayLike.js');
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
var nth = function (array, n) {
|
|
7
7
|
if (n === void 0) { n = 0; }
|
|
8
8
|
if (!isArrayLike(array)) {
|
|
9
9
|
return native.nativeUndefined;
|
|
10
10
|
}
|
|
11
11
|
n += n < 0 ? array.length : 0;
|
|
12
12
|
return array[n];
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
|
|
15
15
|
module.exports = nth;
|
package/package.json
CHANGED
package/types/nth.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
interface Nth {
|
|
2
|
+
(array: [], n?: number): undefined;
|
|
3
|
+
<T>(array: T[], n?: number): T;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* 获取数组的第 `n` 个元素。如果 `n` 为负数,则返回从数组结尾开始的第 `n` 个元素。
|
|
3
7
|
*
|
|
@@ -18,5 +22,5 @@
|
|
|
18
22
|
* nth(arr, -2); // 'c'
|
|
19
23
|
*
|
|
20
24
|
*/
|
|
21
|
-
declare
|
|
25
|
+
declare const nth: Nth;
|
|
22
26
|
export default nth;
|