1 thought on “Consider using `lodash`.

  1. Another use case that came up when looking into #3213. A lot of webpack is dealing with arrays; consequently, a lot of webpack is dealing with for loops.
    An example from Entrypoint.js

    getFiles() {
    	let files = [];
    
    	for(let chunkIdx = 0; chunkIdx < this.chunks.length; chunkIdx++) {
    		for(let fileIdx = 0; fileIdx < this.chunks[chunkIdx].files.length; fileIdx++) {
    			if(files.indexOf(this.chunks[chunkIdx].files[fileIdx]) === -1) {
    				files.push(this.chunks[chunkIdx].files[fileIdx]);
    			}
    		}
    	}
    
    	return files;
    }
    

    could be rewritten as

    getFiles() {
      const files = _flatMap(this.chunks, chunk => chunk.files);
      return _.uniq(files);
    }
    

Comments are closed.

Consider using `lodash`.

Do you want to request a feature or report a bug?
I don’t think it counts as either. Reworking internals?

What is the current behavior?
lodash is not used. It’s in the dependency tree, so it’s already there, it’s just not being used.
If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
lodash is used over specific libraries (camelcase, defaults, object-path).
Please mention your node.js, yarn and operating system version.

Author: Fantashit

1 thought on “Consider using `lodash`.

  1. We had lodash as direct dependency in the beginning but ended up replacing it with those few smaller libs.
    I don’t think we want to bring lodash as a dependency, considering its size, just because some sub dependencies use it.
    After all inquierer may decide to depend on a subset of lodash then Yarn would have to replace it again.

Comments are closed.