Skip to content

Commit

Permalink
refactor: replace with @varlet/shared
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Jun 20, 2022
1 parent ca5a573 commit 7510cbf
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/varlet-ui/src/utils/shared.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { removeItem } from '@varlet/shared'

export interface CacheInstance<T> {
cache: T[]

Expand Down Expand Up @@ -26,15 +28,6 @@ export const isHTMLSupportVideo = (val: string | undefined | null) => {
return val.startsWith('data:video') || /\.(mp4|webm|ogg)$/.test(val)
}

export const removeItem = (arr: Array<unknown>, item: unknown) => {
if (arr.length) {
const index: number = arr.indexOf(item)
if (index > -1) {
return arr.splice(index, 1)
}
}
}

export const createCache = <T>(max: number): CacheInstance<T> => {
const cache: T[] = []

Expand Down

0 comments on commit 7510cbf

Please sign in to comment.