Lodash for Nuxt
💡 About
Lodash auto-import module for Nuxt.
📦 Install
npm i nuxt-lodash -D
🔨 Config
Name | Default | Description |
---|
prefix | use | String to prepend before each Lodash function (false to disable) |
prefixSkip | ['is'] | Functions that starts with keywords in this array will be skipped by prefix |
exclude | [] | Array of Lodash functions to exlude from auto-imports |
alias | [] | Array of array pairs to rename specific Lodash functions (prefix is still added) |
💻 Usage
import { defineNuxtConfig } from 'nuxt3';
export default defineNuxtConfig({
buildModules: ['nuxt-lodash'],
lodash: {
prefix: 'use',
prefixSkip: ['is'],
exclude: ['map'],
alias: [
['camelCase', 'stringToCamelCase'],
['kebabCase', 'stringToKebabCase'],
]
}
});
💻 Example
<template>
<div>{{ text }}</div>
</template>
<script setup>
const text = useToUpper('it works!');
</script>
📄 License
MIT License © 2021 - Michal Čípa