@instructure/ui-utils 8.12.1-snapshot.7 → 8.13.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.
- package/CHANGELOG.md +4 -0
- package/es/createChainedFunction.js +10 -2
- package/es/hash.js +3 -1
- package/es/mergeDeep.js +6 -1
- package/es/within.js +2 -1
- package/lib/createChainedFunction.js +10 -2
- package/lib/hash.js +4 -2
- package/lib/index.js +20 -20
- package/lib/isEmpty.js +1 -1
- package/lib/mergeDeep.js +7 -2
- package/lib/ms.js +1 -1
- package/lib/parseUnit.js +1 -1
- package/lib/pascalize.js +1 -1
- package/lib/px.js +1 -1
- package/lib/shallowEqual.js +1 -1
- package/lib/within.js +3 -2
- package/package.json +6 -7
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-utils
|
|
9
|
+
|
|
6
10
|
# [8.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-utils
|
|
@@ -36,7 +36,11 @@
|
|
|
36
36
|
* @param {function} funcs to chain
|
|
37
37
|
* @returns {function|null}
|
|
38
38
|
*/
|
|
39
|
-
function createChainedFunction(
|
|
39
|
+
function createChainedFunction() {
|
|
40
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
41
|
+
funcs[_key] = arguments[_key];
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
return funcs.filter((f, i) => {
|
|
41
45
|
if (f == null) {
|
|
42
46
|
return false;
|
|
@@ -54,7 +58,11 @@ function createChainedFunction(...funcs) {
|
|
|
54
58
|
return f;
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
return function chainedFunction(
|
|
61
|
+
return function chainedFunction() {
|
|
62
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
63
|
+
args[_key2] = arguments[_key2];
|
|
64
|
+
}
|
|
65
|
+
|
|
58
66
|
acc.apply(this, args);
|
|
59
67
|
f.apply(this, args);
|
|
60
68
|
}; // TODO I think it can return null too
|
package/es/hash.js
CHANGED
|
@@ -58,7 +58,9 @@ function executeHash(input) {
|
|
|
58
58
|
return toBase64(String(hash));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function hash(value
|
|
61
|
+
function hash(value) {
|
|
62
|
+
let maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
63
|
+
|
|
62
64
|
if (typeof value === 'undefined') {
|
|
63
65
|
throw new Error('Cannot hash a value which is undefined');
|
|
64
66
|
}
|
package/es/mergeDeep.js
CHANGED
|
@@ -34,10 +34,15 @@
|
|
|
34
34
|
* @param {Object} args objects to merge
|
|
35
35
|
* @returns {Object} a new object with items from all arguments
|
|
36
36
|
*/
|
|
37
|
-
function mergeDeep(
|
|
37
|
+
function mergeDeep() {
|
|
38
38
|
// note: This could be typed as the union of its args, but since
|
|
39
39
|
// its barely used its not worth the effort currently
|
|
40
40
|
let target = {};
|
|
41
|
+
|
|
42
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
+
args[_key] = arguments[_key];
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
args.forEach(arg => {
|
|
42
47
|
target = mergeSourceIntoTarget(target, arg);
|
|
43
48
|
});
|
package/es/within.js
CHANGED
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
* @param {number} [diff=1]
|
|
36
36
|
* @returns {Boolean} Returns true if a is within the diff range of b
|
|
37
37
|
*/
|
|
38
|
-
function within(a, b
|
|
38
|
+
function within(a, b) {
|
|
39
|
+
let diff = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
|
39
40
|
return a + diff >= b && b >= a - diff;
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -44,7 +44,11 @@ exports.default = void 0;
|
|
|
44
44
|
* @param {function} funcs to chain
|
|
45
45
|
* @returns {function|null}
|
|
46
46
|
*/
|
|
47
|
-
function createChainedFunction(
|
|
47
|
+
function createChainedFunction() {
|
|
48
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
|
+
funcs[_key] = arguments[_key];
|
|
50
|
+
}
|
|
51
|
+
|
|
48
52
|
return funcs.filter((f, i) => {
|
|
49
53
|
if (f == null) {
|
|
50
54
|
return false;
|
|
@@ -62,7 +66,11 @@ function createChainedFunction(...funcs) {
|
|
|
62
66
|
return f;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
return function chainedFunction(
|
|
69
|
+
return function chainedFunction() {
|
|
70
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
71
|
+
args[_key2] = arguments[_key2];
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
acc.apply(this, args);
|
|
67
75
|
f.apply(this, args);
|
|
68
76
|
}; // TODO I think it can return null too
|
package/lib/hash.js
CHANGED
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.hash = hash;
|
|
9
8
|
exports.default = void 0;
|
|
9
|
+
exports.hash = hash;
|
|
10
10
|
|
|
11
11
|
var _jsonStableStringify = _interopRequireDefault(require("json-stable-stringify"));
|
|
12
12
|
|
|
@@ -68,7 +68,9 @@ function executeHash(input) {
|
|
|
68
68
|
return toBase64(String(hash));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
function hash(value
|
|
71
|
+
function hash(value) {
|
|
72
|
+
let maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
73
|
+
|
|
72
74
|
if (typeof value === 'undefined') {
|
|
73
75
|
throw new Error('Cannot hash a value which is undefined');
|
|
74
76
|
}
|
package/lib/index.js
CHANGED
|
@@ -9,16 +9,10 @@ Object.defineProperty(exports, "Browser", {
|
|
|
9
9
|
return _Browser.Browser;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _isEdge.isEdge;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "isIE11", {
|
|
12
|
+
Object.defineProperty(exports, "camelize", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
21
|
-
return
|
|
15
|
+
return _camelize.camelize;
|
|
22
16
|
}
|
|
23
17
|
});
|
|
24
18
|
Object.defineProperty(exports, "capitalizeFirstLetter", {
|
|
@@ -51,12 +45,24 @@ Object.defineProperty(exports, "hash", {
|
|
|
51
45
|
return _hash.hash;
|
|
52
46
|
}
|
|
53
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "isEdge", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _isEdge.isEdge;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
54
|
Object.defineProperty(exports, "isEmpty", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function () {
|
|
57
57
|
return _isEmpty.isEmpty;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "isIE11", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _isIE.isIE11;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
60
66
|
Object.defineProperty(exports, "mergeDeep", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function () {
|
|
@@ -75,6 +81,12 @@ Object.defineProperty(exports, "parseUnit", {
|
|
|
75
81
|
return _parseUnit.parseUnit;
|
|
76
82
|
}
|
|
77
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "pascalize", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _pascalize.pascalize;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
78
90
|
Object.defineProperty(exports, "px", {
|
|
79
91
|
enumerable: true,
|
|
80
92
|
get: function () {
|
|
@@ -93,18 +105,6 @@ Object.defineProperty(exports, "within", {
|
|
|
93
105
|
return _within.within;
|
|
94
106
|
}
|
|
95
107
|
});
|
|
96
|
-
Object.defineProperty(exports, "camelize", {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function () {
|
|
99
|
-
return _camelize.camelize;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(exports, "pascalize", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
get: function () {
|
|
105
|
-
return _pascalize.pascalize;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
108
|
|
|
109
109
|
var _Browser = require("./Browser");
|
|
110
110
|
|
package/lib/isEmpty.js
CHANGED
package/lib/mergeDeep.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.mergeDeep = mergeDeep;
|
|
7
6
|
exports.default = void 0;
|
|
7
|
+
exports.mergeDeep = mergeDeep;
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -42,10 +42,15 @@ exports.default = void 0;
|
|
|
42
42
|
* @param {Object} args objects to merge
|
|
43
43
|
* @returns {Object} a new object with items from all arguments
|
|
44
44
|
*/
|
|
45
|
-
function mergeDeep(
|
|
45
|
+
function mergeDeep() {
|
|
46
46
|
// note: This could be typed as the union of its args, but since
|
|
47
47
|
// its barely used its not worth the effort currently
|
|
48
48
|
let target = {};
|
|
49
|
+
|
|
50
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
|
+
args[_key] = arguments[_key];
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
args.forEach(arg => {
|
|
50
55
|
target = mergeSourceIntoTarget(target, arg);
|
|
51
56
|
});
|
package/lib/ms.js
CHANGED
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.ms = ms;
|
|
9
8
|
exports.default = void 0;
|
|
9
|
+
exports.ms = ms;
|
|
10
10
|
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
|
package/lib/parseUnit.js
CHANGED
package/lib/pascalize.js
CHANGED
package/lib/px.js
CHANGED
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.px = px;
|
|
9
8
|
exports.default = void 0;
|
|
9
|
+
exports.px = px;
|
|
10
10
|
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
|
package/lib/shallowEqual.js
CHANGED
package/lib/within.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.within = within;
|
|
7
6
|
exports.default = void 0;
|
|
7
|
+
exports.within = within;
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -43,7 +43,8 @@ exports.default = void 0;
|
|
|
43
43
|
* @param {number} [diff=1]
|
|
44
44
|
* @returns {Boolean} Returns true if a is within the diff range of b
|
|
45
45
|
*/
|
|
46
|
-
function within(a, b
|
|
46
|
+
function within(a, b) {
|
|
47
|
+
let diff = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
|
47
48
|
return a + diff >= b && b >= a - diff;
|
|
48
49
|
}
|
|
49
50
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.13.0",
|
|
4
4
|
"description": "A collection of utilities for UI components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.
|
|
27
|
-
"@instructure/ui-test-utils": "8.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.13.0",
|
|
27
|
+
"@instructure/ui-test-utils": "8.13.0",
|
|
28
28
|
"@types/json-stable-stringify": "^1.0.1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.13.10",
|
|
32
|
-
"@instructure/console": "8.
|
|
33
|
-
"@instructure/ui-dom-utils": "8.
|
|
32
|
+
"@instructure/console": "8.13.0",
|
|
33
|
+
"@instructure/ui-dom-utils": "8.13.0",
|
|
34
34
|
"bowser": "^1.9.4",
|
|
35
35
|
"fast-deep-equal": "^2",
|
|
36
36
|
"json-stable-stringify": "^1.0.1",
|
|
@@ -43,6 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"sideEffects": false
|
|
47
|
-
"gitHead": "1e7ac821932a91fe9ef761c96f747c7ea1f3925a"
|
|
46
|
+
"sideEffects": false
|
|
48
47
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The MIT License (MIT)
|
|
3
|
-
category: Getting Started
|
|
4
|
-
order: 9
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# The MIT License (MIT)
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
-
|
|
11
|
-
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions.**
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|