Skip to content

Commit

Permalink
Convert to lodash-es
Browse files Browse the repository at this point in the history
  • Loading branch information
richgt committed Jun 11, 2019
1 parent b69fa19 commit c7c4053
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 51 deletions.
6 changes: 3 additions & 3 deletions addon/db-collection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _assign from 'lodash/assign';
import _map from 'lodash/map';
import _isEqual from 'lodash/isEqual';
import { assign as _assign } from 'lodash-es';
import { map as _map } from 'lodash-es';
import { isEqual as _isEqual } from 'lodash-es';

function duplicate(data) {
if (Array.isArray(data)) {
Expand Down
2 changes: 1 addition & 1 deletion addon/db.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DbCollection from './db-collection';
import IdentityManager from './identity-manager';
import { singularize } from './utils/inflector';
import _cloneDeep from 'lodash/cloneDeep';
import { cloneDeep as _cloneDeep } from 'lodash-es';

/**
Your Mirage server has a database which you can interact with in your route handlers. You’ll typically use models to interact with your database data, but you can always reach into the db directly in the event you want more control.
Expand Down
8 changes: 4 additions & 4 deletions addon/factory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _assign from 'lodash/assign';
import _isFunction from 'lodash/isFunction';
import _mapValues from 'lodash/mapValues';
import { assign as _assign } from 'lodash-es';
import { isFunction as _isFunction } from 'lodash-es';
import { mapValues as _mapValues } from 'lodash-es';
import referenceSort from './utils/reference-sort';
import _isPlainObject from 'lodash/isPlainObject';
import { isPlainObject as _isPlainObject} from 'lodash-es';

let Factory = function() {
this.build = function(sequence) {
Expand Down
2 changes: 1 addition & 1 deletion addon/orm/associations/belongs-to.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Association from './association';
import _assign from 'lodash/assign';
import { assign as _assign } from 'lodash-es';
import { capitalize, camelize } from 'ember-cli-mirage/utils/inflector';
import { toCollectionName } from 'ember-cli-mirage/utils/normalize-name';
import assert from 'ember-cli-mirage/assert';
Expand Down
4 changes: 2 additions & 2 deletions addon/orm/associations/has-many.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Association from './association';
import Collection from '../collection';
import PolymorphicCollection from '../polymorphic-collection';
import _assign from 'lodash/assign';
import _compact from 'lodash/compact';
import { assign as _assign } from 'lodash-es';
import { compact as _compact } from 'lodash-es';
import { capitalize, camelize, singularize } from 'ember-cli-mirage/utils/inflector';
import { toCollectionName } from 'ember-cli-mirage/utils/normalize-name';
import assert from 'ember-cli-mirage/assert';
Expand Down
2 changes: 1 addition & 1 deletion addon/orm/collection.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from '../assert';
import _invokeMap from 'lodash/invokeMap';
import { invokeMap as _invokeMap } from 'lodash-es';

/**
Collections represent arrays of models. They are returned by a hasMany association, or by one of the ModelClass query methods:
Expand Down
6 changes: 3 additions & 3 deletions addon/orm/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import extend from '../utils/extend';
import assert from '../assert';
import Collection from './collection';
import PolymorphicCollection from './polymorphic-collection';
import _values from 'lodash/values';
import _compact from 'lodash/compact';
import _assign from 'lodash/assign';
import { values as _values } from 'lodash-es';
import { compact as _compact } from 'lodash-es';
import { assign as _assign } from 'lodash-es';

/**
Models wrap your database and allow you to define relationships.
Expand Down
4 changes: 2 additions & 2 deletions addon/orm/polymorphic-collection.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _invokeMap from 'lodash/invokeMap';
import _isEqual from 'lodash/isEqual';
import { invokeMap as _invokeMap } from 'lodash-es';
import { isEqual as _isEqual } from 'lodash-es';

/**
* An array of models, returned from one of the schema query
Expand Down
6 changes: 3 additions & 3 deletions addon/orm/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { pluralize, camelize, dasherize } from '../utils/inflector';
import { toCollectionName, toModelName } from 'ember-cli-mirage/utils/normalize-name';
import Association from './associations/association';
import Collection from './collection';
import _assign from 'lodash/assign';
import _forIn from 'lodash/forIn';
import _includes from 'lodash/includes';
import { assign as _assign } from 'lodash-es';
import { forIn as _forIn } from 'lodash-es';
import { includes as _includes } from 'lodash-es';
import assert from '../assert';

/**
Expand Down
2 changes: 1 addition & 1 deletion addon/serializer-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import JsonApiSerializer from 'ember-cli-mirage/serializers/json-api-serializer'
import { pluralize, camelize } from './utils/inflector';
import assert from './assert';

import _assign from 'lodash/assign';
import { assign as _assign } from 'lodash-es';

/**
* @hide
Expand Down
18 changes: 9 additions & 9 deletions addon/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import PolymorphicCollection from './orm/polymorphic-collection';
import extend from './utils/extend';
import { singularize, pluralize, camelize } from './utils/inflector';
import assert from './assert';
import _isFunction from 'lodash/isFunction';
import _isArray from 'lodash/isArray';
import _isEmpty from 'lodash/isEmpty';
import _includes from 'lodash/includes';
import _assign from 'lodash/assign';
import _get from 'lodash/get';
import _flatten from 'lodash/flatten';
import _compact from 'lodash/compact';
import _uniqBy from 'lodash/uniqBy';
import { isFunction as _isFunction } from 'lodash-es';
import { isArray as _isArray } from 'lodash-es';
import { isEmpty as _isEmpty } from 'lodash-es';
import { includes as _includes } from 'lodash-es';
import { assign as _assign } from 'lodash-es';
import { get as _get } from 'lodash-es';
import { flatten as _flatten } from 'lodash-es';
import { compact as _compact } from 'lodash-es';
import { uniqBy as _uniqBy } from 'lodash-es';

/**
Serializers are responsible for formatting your route handler's response.
Expand Down
10 changes: 5 additions & 5 deletions addon/serializers/json-api-serializer.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Serializer from '../serializer';
import { dasherize, pluralize, camelize } from '../utils/inflector';
import _get from 'lodash/get';
import _flatten from 'lodash/flatten';
import _compact from 'lodash/compact';
import _uniqBy from 'lodash/uniqBy';
import _isEmpty from 'lodash/isEmpty';
import { get as _get } from 'lodash-es';
import { flatten as _flatten } from 'lodash-es';
import { compact as _compact } from 'lodash-es';
import { uniqBy as _uniqBy } from 'lodash-es';
import { isEmpty as _isEmpty } from 'lodash-es';
import assert from 'ember-cli-mirage/assert';

/**
Expand Down
10 changes: 5 additions & 5 deletions addon/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import SerializerRegistry from './serializer-registry';
import RouteHandler from './route-handler';
import BelongsTo from './orm/associations/belongs-to';

import _pick from 'lodash/pick';
import _assign from 'lodash/assign';
import _find from 'lodash/find';
import _isPlainObject from 'lodash/isPlainObject';
import _isInteger from 'lodash/isInteger';
import { pick as _pick } from 'lodash-es';
import { assign as _assign } from 'lodash-es';
import { find as _find } from 'lodash-es';
import { isPlainObject as _isPlainObject } from 'lodash-es';
import { isInteger as _isInteger } from 'lodash-es';

/**
* Creates a new Pretender instance.
Expand Down
2 changes: 1 addition & 1 deletion addon/start-mirage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getWithDefault } from '@ember/object';
import readModules from 'ember-cli-mirage/utils/read-modules';
import Server from 'ember-cli-mirage/server';
import _assign from 'lodash/assign';
import { assign as _assign } from 'lodash-es';

/**
Helper to start mirage. This should not be called directly. In rfc232/rfc268
Expand Down
2 changes: 1 addition & 1 deletion addon/utils/ember-data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global requirejs */

import _find from 'lodash/find';
import { find as _find } from 'lodash-es';

function _hasEmberData() {
let matchRegex = /^ember-data/i;
Expand Down
4 changes: 2 additions & 2 deletions addon/utils/extend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _assign from 'lodash/assign';
import _has from 'lodash/has';
import { assign as _assign } from 'lodash-es';
import { has as _has } from 'lodash-es';

/**
@hide
Expand Down
2 changes: 1 addition & 1 deletion addon/utils/is-association.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _isPlainObject from 'lodash/isPlainObject';
import { isPlainObject as _isPlainObject } from 'lodash-es';

/**
@hide
Expand Down
2 changes: 1 addition & 1 deletion addon/utils/read-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

import { assert } from '@ember/debug';
import _camelCase from 'lodash/camelCase';
import { camelCase as _camelCase } from 'lodash-es';
import { pluralize } from 'ember-cli-mirage/utils/inflector';
import require from 'require';

Expand Down
4 changes: 2 additions & 2 deletions addon/utils/reference-sort.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// jscs:disable disallowVar, requireArrayDestructuring
import _uniq from 'lodash/uniq';
import _flatten from 'lodash/flatten';
import { uniq as _uniq } from 'lodash-es';
import { flatten as _flatten } from 'lodash-es';

/**
@hide
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"ember-cli-babel": "^7.5.0",
"ember-get-config": "^0.2.2",
"ember-inflector": "^2.0.0 || ^3.0.0",
"lodash": "^4.17.11",
"lodash-es": "^4.17.11",
"pretender": "3.0.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { module, test } from 'qunit';
import { Model, Collection, ActiveModelSerializer } from 'ember-cli-mirage';
import Server from 'ember-cli-mirage/server';
import _uniqBy from 'lodash/uniqBy';
import { uniqBy as _uniqBy } from 'lodash-es';
import promiseAjax from '../../../helpers/promise-ajax';

module('Integration | Route handlers | Function handler | #serialize', function(hooks) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/serializers/base/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SerializerRegistry from 'ember-cli-mirage/serializer-registry';
import schemaHelper from '../schema-helper';
import { module, test } from 'qunit';

import _uniqBy from 'lodash/uniqBy';
import { uniqBy as _uniqBy } from 'lodash-es';

module('Integration | Serializers | Base | Basic', function(hooks) {
hooks.beforeEach(function() {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9255,6 +9255,11 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"

lodash-es@^4.17.11:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0"
integrity sha1-FFq0p6xcXlKjUx+08xAlWhUrS+A=

lodash._baseassign@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e"
Expand Down

0 comments on commit c7c4053

Please sign in to comment.