Destructure Lodash `require`s

pull/1/head
Daniel Gasienica 7 years ago
parent b7b6195cfc
commit d9be6a0f94

@ -1,9 +1,9 @@
const crypto = require('crypto'); const crypto = require('crypto');
const fse = require('fs-extra');
const isArrayBuffer = require('lodash/isArrayBuffer');
const isString = require('lodash/isString');
const path = require('path'); const path = require('path');
const fse = require('fs-extra');
const toArrayBuffer = require('to-arraybuffer'); const toArrayBuffer = require('to-arraybuffer');
const { isArrayBuffer, isString } = require('lodash');
const PATH = 'attachments.noindex'; const PATH = 'attachments.noindex';

@ -1,4 +1,4 @@
const isString = require('lodash/isString'); const { isString } = require('lodash');
exports.createTemplate = (options, messages) => { exports.createTemplate = (options, messages) => {

@ -4,7 +4,7 @@
// and using promises. Revisit use of `idb` dependency as it might cover // and using promises. Revisit use of `idb` dependency as it might cover
// this functionality. // this functionality.
const isObject = require('lodash/isObject'); const { isObject } = require('lodash');
exports.open = (name, version) => { exports.open = (name, version) => {

@ -1,10 +1,12 @@
const isFunction = require('lodash/isFunction'); const {
const isNumber = require('lodash/isNumber'); isFunction,
const isObject = require('lodash/isObject'); isNumber,
const isString = require('lodash/isString'); isObject,
const random = require('lodash/random'); isString,
const range = require('lodash/range'); random,
const sample = require('lodash/sample'); range,
sample,
} = require('lodash');
const Message = require('./types/message'); const Message = require('./types/message');
const { deferredToPromise } = require('./deferred_to_promise'); const { deferredToPromise } = require('./deferred_to_promise');

@ -6,11 +6,13 @@
/* global IDBKeyRange */ /* global IDBKeyRange */
const isFunction = require('lodash/isFunction'); const {
const isNumber = require('lodash/isNumber'); isFunction,
const isObject = require('lodash/isObject'); isNumber,
const isString = require('lodash/isString'); isObject,
const last = require('lodash/last'); isString,
last,
} = require('lodash');
const database = require('./database'); const database = require('./database');
const Message = require('./types/message'); const Message = require('./types/message');

@ -1,4 +1,4 @@
const last = require('lodash/last'); const { last } = require('lodash');
const { runMigrations } = require('./run_migrations'); const { runMigrations } = require('./run_migrations');

@ -1,10 +1,13 @@
/* eslint-env browser */ /* eslint-env browser */
const isFunction = require('lodash/isFunction'); const {
const isObject = require('lodash/isObject'); head,
const isString = require('lodash/isString'); isFunction,
const head = require('lodash/head'); isObject,
const last = require('lodash/last'); isString,
last,
} = require('lodash');
const db = require('../database'); const db = require('../database');
const { deferredToPromise } = require('../deferred_to_promise'); const { deferredToPromise } = require('../deferred_to_promise');

@ -2,10 +2,12 @@
const Path = require('path'); const Path = require('path');
const compose = require('lodash/fp/compose'); const {
const escapeRegExp = require('lodash/escapeRegExp'); escapeRegExp,
const isRegExp = require('lodash/isRegExp'); isRegExp,
const isString = require('lodash/isString'); isString,
} = require('lodash');
const { compose } = require('lodash/fp');
const PHONE_NUMBER_PATTERN = /\+\d{7,12}(\d{3})/g; const PHONE_NUMBER_PATTERN = /\+\d{7,12}(\d{3})/g;

@ -1,5 +1,4 @@
const isObject = require('lodash/isObject'); const { isObject, isString } = require('lodash');
const isString = require('lodash/isString');
const ITEMS_STORE_NAME = 'items'; const ITEMS_STORE_NAME = 'items';

@ -1,5 +1,4 @@
const isFunction = require('lodash/isFunction'); const { isFunction, isString } = require('lodash');
const isString = require('lodash/isString');
const MIME = require('./mime'); const MIME = require('./mime');
const { arrayBufferToBlob, blobToArrayBuffer, dataURLToBlob } = require('blob-util'); const { arrayBufferToBlob, blobToArrayBuffer, dataURLToBlob } = require('blob-util');

@ -1,7 +1,9 @@
const isArrayBuffer = require('lodash/isArrayBuffer'); const {
const isFunction = require('lodash/isFunction'); isArrayBuffer,
const isUndefined = require('lodash/isUndefined'); isFunction,
const omit = require('lodash/omit'); isUndefined,
omit,
} = require('lodash');
// type Context :: { // type Context :: {

@ -1,4 +1,4 @@
const isFunction = require('lodash/isFunction'); const { isFunction } = require('lodash');
const Attachment = require('./attachment'); const Attachment = require('./attachment');
const Errors = require('./errors'); const Errors = require('./errors');

@ -1,4 +1,4 @@
const isNumber = require('lodash/isNumber'); const { isNumber } = require('lodash');
exports.isValid = value => exports.isValid = value =>

Loading…
Cancel
Save