@folklore/utils 0.1.3 → 0.1.4
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/cjs.js +5 -7
- package/dist/es.js +5 -7
- package/package.json +3 -3
package/dist/cjs.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
var isString = require('lodash/isString');
|
|
4
4
|
var pascalCase = require('pascal-case');
|
|
5
5
|
|
|
6
|
-
function getComponentFromName(components, name) {
|
|
7
|
-
let defaultComponentName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
6
|
+
function getComponentFromName(components, name, defaultComponentName = null) {
|
|
8
7
|
const defaultComponent = (isString(defaultComponentName) ? components[pascalCase.pascalCase(defaultComponentName)] : defaultComponentName) || null;
|
|
9
8
|
if (name === null) {
|
|
10
9
|
return defaultComponent;
|
|
@@ -13,11 +12,10 @@ function getComponentFromName(components, name) {
|
|
|
13
12
|
return components[componentName] || defaultComponent;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
function getDisplayName(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
15
|
+
function getDisplayName({
|
|
16
|
+
displayName = null,
|
|
17
|
+
name = null
|
|
18
|
+
}) {
|
|
21
19
|
return displayName || name || 'Component';
|
|
22
20
|
}
|
|
23
21
|
|
package/dist/es.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import isString from 'lodash/isString';
|
|
2
2
|
import { pascalCase } from 'pascal-case';
|
|
3
3
|
|
|
4
|
-
function getComponentFromName(components, name) {
|
|
5
|
-
let defaultComponentName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
4
|
+
function getComponentFromName(components, name, defaultComponentName = null) {
|
|
6
5
|
const defaultComponent = (isString(defaultComponentName) ? components[pascalCase(defaultComponentName)] : defaultComponentName) || null;
|
|
7
6
|
if (name === null) {
|
|
8
7
|
return defaultComponent;
|
|
@@ -11,11 +10,10 @@ function getComponentFromName(components, name) {
|
|
|
11
10
|
return components[componentName] || defaultComponent;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
function getDisplayName(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
13
|
+
function getDisplayName({
|
|
14
|
+
displayName = null,
|
|
15
|
+
name = null
|
|
16
|
+
}) {
|
|
19
17
|
return displayName || name || 'Component';
|
|
20
18
|
}
|
|
21
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"clean": "rm -rf dist",
|
|
38
38
|
"build": "rollup --bundleConfigAsCjs --config ../../rollup.config.js",
|
|
39
|
-
"
|
|
39
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.4.3",
|
|
43
43
|
"lodash": "^4.17.4",
|
|
44
44
|
"pascal-case": "^3.1.2"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "a04cfaacb364f3b35307d65d8778b078dace4491"
|
|
47
47
|
}
|