use custom kebabcase function

This commit is contained in:
Timothy
2021-01-16 18:07:08 +08:00
parent 6f90fc50db
commit fdda4c2042
7 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
import fs from 'fs'
import matter from 'gray-matter'
import path from 'path'
import kebabCase from 'just-kebab-case'
import { kebabCase } from './utils'
const root = process.cwd()

6
lib/utils.js Normal file
View File

@ -0,0 +1,6 @@
export const kebabCase = (str) =>
str &&
str
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
.map((x) => x.toLowerCase())
.join('-')