Skip to content

Commit 06819db

Browse files
committed
refactor(BPlaceholder): use import type
refactor(BPlaceholderCard): use `import type` refactor(cssEscape): don't mutate param refactor(cssEscape): any -> unknown refactor(inspect): use type predicate refactor(props): import direct from file
1 parent 007c7a4 commit 06819db

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

packages/bootstrap-vue-3/src/components/BPlaceholder/BPlaceholder.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<script setup lang="ts">
66
import {computed, StyleValue} from 'vue'
7-
import {ColorVariant, PlaceholderAnimation, PlaceholderSize} from '../../types'
7+
import type {ColorVariant, PlaceholderAnimation, PlaceholderSize} from '../../types'
88
99
interface Props {
1010
tag?: string

packages/bootstrap-vue-3/src/components/BPlaceholder/BPlaceholderCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import BCard from '../BCard/BCard.vue'
3232
import BCardImg from '../BCard/BCardImg.vue'
3333
import BPlaceholder from './BPlaceholder.vue'
3434
import BPlaceholderButton from './BPlaceholderButton.vue'
35-
import {Booleanish, ColorVariant, PlaceholderAnimation, PlaceholderSize} from '../../types'
35+
import type {Booleanish, ColorVariant, PlaceholderAnimation, PlaceholderSize} from '../../types'
3636
import {computed, toRef} from 'vue'
3737
import {useBooleanish} from '../../composables'
3838

packages/bootstrap-vue-3/src/utils/cssEscape.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ const escapeChar = (value: string) => `\\${value}`
55
/**
66
* The `cssEscape()` util is based on this `CSS.escape()` polyfill: https://github.com/mathiasbynens/CSS.escape
77
*
8-
* @param {any} value
8+
* @param {unknown} value
99
*/
10-
export default (value: any): string => {
11-
value = toString(value)
10+
export default (value: unknown): string => {
11+
const val = toString(value)
1212

13-
const {length} = value
14-
const firstCharCode = value.charCodeAt(0)
13+
const {length} = val
14+
const firstCharCode = val.charCodeAt(0)
1515

16-
return value.split('').reduce((result: string, char: string, index: number) => {
17-
const charCode = value.charCodeAt(index)
16+
return val.split('').reduce((result: string, char: string, index: number) => {
17+
const charCode = val.charCodeAt(index)
1818

1919
// If the character is NULL (U+0000), use (U+FFFD) as replacement
2020
if (charCode === 0x0000) {

packages/bootstrap-vue-3/src/utils/inspect.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* @param obj
33
* @returns
44
*/
5-
export const isObject = (obj: unknown): boolean => obj !== null && typeof obj === 'object'
5+
export const isObject = (obj: unknown): obj is Record<PropertyKey, unknown> =>
6+
obj !== null && typeof obj === 'object'
67

78
/**
89
* @param value

packages/bootstrap-vue-3/src/utils/props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Suffix can be a falsey value so nothing is appended to string
22
// (helps when looping over props & some shouldn't change)
33

4-
import {upperFirst} from '.'
4+
import {upperFirst} from './stringUtils'
55

66
/**
77
* Use data last parameters to allow for currying

0 commit comments

Comments
 (0)