@sj-distributor/react-iconfont-cli 2.4.0 → 2.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sj-distributor/react-iconfont-cli",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "iconfont",
@@ -15,8 +15,8 @@
15
15
  "license": "MIT",
16
16
  "bin": {
17
17
  "sj-iconfont": "./commands/help.js",
18
- "sj-iconfont-init": "./commands/createJson.js",
19
- "sj-iconfont-h5": "./commands/createIcon.js"
18
+ "sj-iconfont-h5": "./commands/createIcon.js",
19
+ "sj-iconfont-init": "./commands/createJson.js"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "react": "*"
@@ -7,11 +7,12 @@
7
7
  * @return {string}
8
8
  */
9
9
  export const getIconColor = (color, index, defaultColor) => {
10
- return color
11
- ? (
12
- typeof color === 'string'
13
- ? color
14
- : color[index] || defaultColor
15
- )
16
- : defaultColor;
10
+ if (!color) return defaultColor;
11
+
12
+ // When color is a single value, only tint the first path.
13
+ if (typeof color === 'string') {
14
+ return index === 0 ? color : defaultColor;
15
+ }
16
+
17
+ return color[index] || defaultColor;
17
18
  };
@@ -2,11 +2,12 @@
2
2
  /* eslint-disable */
3
3
 
4
4
  export const getIconColor = (color: string | string[] | undefined, index: number, defaultColor: string) => {
5
- return color
6
- ? (
7
- typeof color === 'string'
8
- ? color
9
- : color[index] || defaultColor
10
- )
11
- : defaultColor;
5
+ if (!color) return defaultColor;
6
+
7
+ // When color is a single value, only tint the first path.
8
+ if (typeof color === 'string') {
9
+ return index === 0 ? color : defaultColor;
10
+ }
11
+
12
+ return color[index] || defaultColor;
12
13
  };