Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@dada-element/utils

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dada-element/utils - npm Package Compare versions

Comparing version
1.0.0
to
1.2.0
+0
-2
index.ts

@@ -1,3 +0,1 @@

export * from './src/with-install'
export * from './src/format'
+6
-2
{
"name": "@dada-element/utils",
"version": "1.0.0",
"version": "1.2.0",
"description": "utils for dada element",

@@ -17,3 +17,7 @@ "author": "gjssss",

"src"
]
],
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
}
}
import type { App, Component } from 'vue'
import { camelize } from './format'
export type WithInstall<T> = T & {
install(app: App): void
}
export function withInstall<T extends Component>(options: T) {
(options as Record<string, unknown>).install = (app: App) => {
const { name } = options
if (name) {
// 同时注册两种命名方式的组件
app.component(name, options)
app.component(camelize(`-${name}`), options)
}
}
return options as WithInstall<T>
}