nuxt-lodash

Lodash for Nuxt

Usage no npm install needed!

<script type="module">
  import nuxtLodash from 'https://cdn.skypack.dev/nuxt-lodash';
</script>

README

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)

💻 Usage

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

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

📄 License

MIT License © 2021 - Michal Čípa