radash-nuxt

Nuxt module for Radash
21,103
Install
npm install radash-nuxt
Latest Version:1.0.2
Vue:3
License:MIT
Last Updated:Feb 21, 2024
Links: GitHub  ·  npm
Maintainer: reddexter

Radash for Nuxt

Radash auto-import module for Nuxt.

πŸ“¦ Install

Install radash-nuxt as development dependency:

npm i radash-nuxt -D

Add it to the modules section of your nuxt.config:

export default defineNuxtConfig({
  modules: ["radash-nuxt"],
});

πŸš€ Example

Use any Radash methods in your Nuxt application, they will be auto-imported!

<script setup>
  const fish = [
    {
      name: "Marlin",
      weight: 105,
      source: "ocean",
    },
    {
      name: "Bass",
      weight: 8,
      source: "lake",
    },
    {
      name: "Trout",
      weight: 1,
      source: "lake",
    },
  ];

  const ra = {
    Mode: "god",
    Power: "sun",
  };

  const min = useMin(fish, (f) => f.weight);
  const text = usePascal("It works!");
  const lowerize = useLowerize(ra);
  const snake = stringToSnake("green fish blue fish");
</script>

<template>
  <div>
    <div>{{ text }}</div>
    <pre>{{ min }}</pre>
    <pre>{{ lowerize }}</pre>
    <pre>{{ snake }}</pre>
  </div>
</template>

πŸ”¨ Config

Name Default Description
prefix 'use' String to prepend before each Radash function (false to disable)
prefixSkip 'is' Functions that starts with this keywords will be skipped by prefix (false to disable)
upperAfterPrefix true If true it will automatically uppercase first letter after prefix (false to disable)
alias [] Array of array pairs to rename specific Radash functions (prefix is still added)

πŸ’» Example - Config

export default defineNuxtConfig({
  modules: ["radash-nuxt"],
  imports: {
    autoImport: true,
  },
  radash: {
    prefix: "_",
    prefixSkip: ["string"],
    upperAfterPrefix: true,
    alias: [
      ["snake", "stringToSnake"], // => stringToSnake
    ],
  },
});

Acknowledgement

The development of radash-nuxt was made possible thanks to the inspiration and code base from nuxt-lodash.

πŸ“„ License

MIT License Β© 2023 - Batuhan GΓΆksu

Version History

Version Released License
1.0.2 MIT