GithubHelp home page GithubHelp logo

lodash-lwc's Introduction

lodash-lwc

lodash (4.17.15) as a Lightning Web Component

Usage

  1. Copy the force-app/main/default/lwc/lodash directory into your org and deploy.
  2. Import lodash functions in your components and use as normal!
import {LightningElement} from 'lwc';
import {sortBy, groupBy, isNil} from 'c/lodash';

export default class MyComponent extends LightningElement {
  // use sortBy, groupBy, isNil...
}

Build Process

  1. Run the following command with the lodash CLI: lodash modularize exports=es -o ./
  2. Rename all default files from <filename>.default.js to <filename>Default.js, updating imports in each file appropriately. The component will fail to compile if a filename contains multiple .s—although not explicitly stated in the documentation, it seems that filenames have the same restrictions as directory names (excluding the extension).
  3. Create a new modules directory and move all files except lodash.js and lodashDefault.js into it, renaming imports in each file appropriately.

Future Considerations

  • Script the build process
  • Include lodash/fp modules

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.