Destructure Lodash requires

This commit is contained in:
Daniel Gasienica 2018-04-02 15:08:53 -04:00
parent b7b6195cfc
commit d9be6a0f94
13 changed files with 46 additions and 37 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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