import { hash } from 'ohash' export { isVue } from '../../../nuxt/src/core/utils/plugins' export function uniq (arr: T[]): T[] { return Array.from(new Set(arr)) } // Copied from vue-bundle-renderer utils const IS_CSS_RE = /\.(?:css|scss|sass|postcss|pcss|less|stylus|styl)(?:\?[^.]+)?$/ export function isCSS (file: string) { return IS_CSS_RE.test(file) } export function hashId (id: string) { return '$id_' + hash(id) } export function matchWithStringOrRegex (value: string, matcher: string | RegExp) { if (typeof matcher === 'string') { return value === matcher } else if (matcher instanceof RegExp) { return matcher.test(value) } return false } /** @since 3.9.0 */ export function toArray (value: T | T[]): T[] { return Array.isArray(value) ? value : [value] }