zgg-ui
Version:
2.0.1 正式版本 基于 Vue 3、UniApp 和 TypeScript 开发的多端适配移动端 UI 组件库,旨在提供丰富的组件集合,帮助开发者快速构建多端响应式的移动应用界面
22 lines (18 loc) • 545 B
text/typescript
import { toString } from './_toString'
import { reEscapeChar, reLeadingDot, rePropName } from './_common'
import type { PropertyName } from './_common'
export const stringToPath = function (string: PropertyName) {
string = toString(string)
const result = []
if (reLeadingDot.test(string)) {
result.push('')
}
string.replace(
rePropName,
(match: string, number: any, quote: any, string: any) => {
result.push(quote ? string.replace(reEscapeChar, '$1') : number || match)
return ''
}
)
return result
}