Atinux / nuxt-lodash

Lodash module for Nuxt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lodash for Nuxt

Version License Types

💡 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)

💻 Example - Config

import { defineNuxtConfig } from 'nuxt3';

export default defineNuxtConfig({
  buildModules: ['nuxt-lodash'],
  lodash: {
    prefix: 'use',
    prefixSkip: ['is'],
    exclude: ['map'],
    alias: [
      ['camelCase', 'stringToCamelCase'], // => useStringToCamelCase
      ['kebabCase', 'stringToKebabCase'], // => useStringToKebabCase
    ]
  }
});

🚀 Example - Usage

<template>
  <div>{{ text }}</div>
</template>
<script setup>
const text = useToUpper('it works!');
</script>

📄 License

MIT License © 2021 - Michal Čípa

About

Lodash module for Nuxt

License:MIT License


Languages

Language:TypeScript 96.1%Language:Vue 3.9%