Performance: Standardize lodash imports to use destructured members (#33040)

* Performance: Standardize lodash imports to use destructured members
Changes lodash imports of the form `import x from 'lodash/x'` to
`import { x } from 'lodash'` to reduce bundle size.

* Remove unnecessary _ import from Graph component

* Enforce lodash import style

* Fix remaining lodash imports
This commit is contained in:
kay delaney
2021-04-21 08:38:00 +01:00
committed by GitHub
parent 2bb7eb18d1
commit bad048b7ba
299 changed files with 1135 additions and 1137 deletions

View File

@@ -1,4 +1,4 @@
import _ from 'lodash';
import { map } from 'lodash';
import { Observable, of, throwError } from 'rxjs';
import {
ArrayVector,
@@ -458,7 +458,7 @@ describe('ElasticDatasource', function (this: any) {
await expect(ds.getFields()).toEmitValuesWith((received) => {
expect(received.length).toBe(1);
const fieldObjects = received[0];
const fields = _.map(fieldObjects, 'text');
const fields = map(fieldObjects, 'text');
expect(fields).toEqual([
'@timestamp',
@@ -481,7 +481,7 @@ describe('ElasticDatasource', function (this: any) {
await expect(ds.getFields('number')).toEmitValuesWith((received) => {
expect(received.length).toBe(1);
const fieldObjects = received[0];
const fields = _.map(fieldObjects, 'text');
const fields = map(fieldObjects, 'text');
expect(fields).toEqual(['system.cpu.system', 'system.cpu.user', 'system.process.cpu.total']);
});
@@ -493,7 +493,7 @@ describe('ElasticDatasource', function (this: any) {
await expect(ds.getFields('date')).toEmitValuesWith((received) => {
expect(received.length).toBe(1);
const fieldObjects = received[0];
const fields = _.map(fieldObjects, 'text');
const fields = map(fieldObjects, 'text');
expect(fields).toEqual(['@timestamp', '__timestamp', '@timestampnano']);
});
@@ -556,7 +556,7 @@ describe('ElasticDatasource', function (this: any) {
await expect(ds.getFields(undefined, range)).toEmitValuesWith((received) => {
expect(received.length).toBe(1);
const fieldObjects = received[0];
const fields = _.map(fieldObjects, 'text');
const fields = map(fieldObjects, 'text');
expect(fields).toEqual(['@timestamp', 'beat.hostname']);
});
});
@@ -693,7 +693,7 @@ describe('ElasticDatasource', function (this: any) {
expect(received.length).toBe(1);
const fieldObjects = received[0];
const fields = _.map(fieldObjects, 'text');
const fields = map(fieldObjects, 'text');
expect(fields).toEqual([
'@timestamp_millis',
'classification_terms',
@@ -720,7 +720,7 @@ describe('ElasticDatasource', function (this: any) {
expect(received.length).toBe(1);
const fieldObjects = received[0];
const fields = _.map(fieldObjects, 'text');
const fields = map(fieldObjects, 'text');
expect(fields).toEqual([
'justification_blob.overall_vote_score',
'justification_blob.shallow.jsi.sdb.dsel2.bootlegged-gille.botness',
@@ -739,7 +739,7 @@ describe('ElasticDatasource', function (this: any) {
expect(received.length).toBe(1);
const fieldObjects = received[0];
const fields = _.map(fieldObjects, 'text');
const fields = map(fieldObjects, 'text');
expect(fields).toEqual(['@timestamp_millis']);
});
});