Skip to content

Commit 135fc18

Browse files
committed
Use lodash-es instead of lodash
1 parent 51de159 commit 135fc18

File tree

10 files changed

+16993
-16198
lines changed

10 files changed

+16993
-16198
lines changed

dist/vuex-orm-graphql.esm.js

Lines changed: 16976 additions & 16183 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
"@types/graphql": "^0.12.3",
4848
"@types/inflection": "^1.5.28",
4949
"@types/lodash-es": "^4.17.0",
50-
"@vuex-orm/core": "^0.25.1",
50+
"@vuex-orm/core": "^0.25.4",
5151
"apollo-cache-inmemory": "^1.1.7",
5252
"apollo-client": "^2.2.2",
5353
"apollo-link": "^1.2.0",
5454
"apollo-link-http": "^1.3.2",
5555
"graphql": "^0.12.3",
5656
"graphql-tag": "^2.6.1",
5757
"inflection": "^1.12.0",
58-
"lodash-es": "^4.17.5",
58+
"lodash-es": "^4.17.10",
5959
"normalizr": "^3.2.4",
6060
"vue": "^2.5.13"
6161
},

src/actions/simple-mutation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ActionParams } from '../support/interfaces';
22
import Action from './action';
33
import NameGenerator from '../graphql/name-generator';
44
import Context from '../common/context';
5+
import * as _ from 'lodash-es';
56

67
/**
78
* SimpleMutation action for sending a model unrelated simple mutation.
@@ -19,7 +20,7 @@ export default class SimpleMutation extends Action {
1920
const result = await Context.getInstance().apollo.simpleMutation(query, variables);
2021

2122
// remove the symbols
22-
return JSON.parse(JSON.stringify(result.data));
23+
return _.clone(result.data);
2324
} else {
2425
throw new Error("The simpleMutation action requires the 'query' to be set");
2526
}

src/actions/simple-query.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ActionParams } from '../support/interfaces';
22
import Action from './action';
33
import NameGenerator from '../graphql/name-generator';
44
import Context from '../common/context';
5+
import * as _ from 'lodash-es';
56

67
/**
78
* SimpleQuery action for sending a model unrelated simple query.
@@ -20,7 +21,7 @@ export default class SimpleQuery extends Action {
2021
const result = await Context.getInstance().apollo.simpleQuery(query, variables, bypassCache);
2122

2223
// remove the symbols
23-
return JSON.parse(JSON.stringify(result.data));
24+
return _.clone(result.data);
2425
} else {
2526
throw new Error("The simpleQuery action requires the 'query' to be set");
2627
}

src/common/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DocumentNode } from 'graphql';
22
import { Arguments } from '../support/interfaces';
33
import { FetchPolicy } from 'apollo-client';
44
import { prettify } from '../support/utils';
5-
import * as _ from 'lodash';
5+
import * as _ from 'lodash-es';
66

77
/**
88
* Vuex-ORM-Apollo Debug Logger.

src/graphql/query-builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { upcaseFirstLetter } from '../support/utils';
44
import gql from 'graphql-tag';
55
import Context from '../common/context';
66
import Schema from './schema';
7-
import * as _ from 'lodash';
7+
import * as _ from 'lodash-es';
88
const inflection = require('inflection');
99

1010
/**
@@ -106,7 +106,7 @@ export default class QueryBuilder {
106106
if (!model) throw new Error('No model provided to build the query!');
107107

108108
// args
109-
args = args ? JSON.parse(JSON.stringify(args)) : {};
109+
args = args ? _.clone(args) : {};
110110
if (!args) throw new Error('args is undefined');
111111

112112
Object.keys(args).forEach((key: string) => {

src/graphql/transformer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Data, Field } from '../support/interfaces';
22
import Model from '../orm/model';
33
import Context from '../common/context';
44
import { downcaseFirstLetter } from '../support/utils';
5-
import * as _ from 'lodash';
5+
import * as _ from 'lodash-es';
66
const inflection = require('inflection');
77

88
/**
@@ -108,6 +108,6 @@ export default class Transformer {
108108
}
109109

110110
// Make sure this is really a plain JS object. We had some issues in testing here.
111-
return JSON.parse(JSON.stringify(result));
111+
return _.clone(result);
112112
}
113113
}

src/vuex-orm-graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Destroy, Fetch, Mutate, Persist, Push } from './actions';
55
import Query from './actions/query';
66
import SimpleQuery from './actions/simple-query';
77
import SimpleMutation from './actions/simple-mutation';
8-
import * as _ from 'lodash';
8+
import * as _ from 'lodash-es';
99

1010
/**
1111
* Main class of the plugin. Setups the internal context, Vuex actions and model methods

test/support/mock-schema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { User, Profile, Video, Post, Comment, Tariff, TariffOption } from 'test/support/mock-data'
22
import inflection from 'inflection';
3-
import _ from 'lodash-es';
3+
import * as _ from 'lodash';
44

55

66
export const typeDefs = `

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
"@types/lodash" "*"
153153

154154
"@types/lodash@*":
155-
version "4.14.101"
156-
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.101.tgz#512f6c9e1749890f4d024e98cb995a63f562d458"
155+
version "4.14.110"
156+
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.110.tgz#fb07498f84152947f30ea09d89207ca07123461e"
157157

158158
"@types/node@*":
159159
version "9.4.0"
@@ -185,7 +185,7 @@
185185
source-map "^0.5.6"
186186
vue-template-es2015-compiler "^1.6.0"
187187

188-
"@vuex-orm/core@^0.25.1":
188+
"@vuex-orm/core@^0.25.4":
189189
version "0.25.4"
190190
resolved "https://registry.yarnpkg.com/@vuex-orm/core/-/core-0.25.4.tgz#0609e0df8a2ab2b614d53b8ce25e2c2bd562d0d3"
191191

@@ -4234,7 +4234,7 @@ locate-path@^2.0.0:
42344234
p-locate "^2.0.0"
42354235
path-exists "^3.0.0"
42364236

4237-
lodash-es@^4.17.5:
4237+
lodash-es@^4.17.10:
42384238
version "4.17.10"
42394239
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.10.tgz#62cd7104cdf5dd87f235a837f0ede0e8e5117e05"
42404240

0 commit comments

Comments
 (0)