Skip to content

Commit

Permalink
Drop deepClone for speed boost!
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsJonQ committed Nov 2, 2017
1 parent 6d9595f commit 4b326d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/Spec/index.js
@@ -1,6 +1,5 @@
import faker from 'faker'
import {
cloneDeep,
isArray,
isFunction,
isNumber,
Expand Down Expand Up @@ -58,10 +57,10 @@ class HelixSpec {
* @returns object
*/
const generateSpecs = (shape) => {
return mapValues(cloneDeep(shape), (value, key) => {
return mapValues(shape, (value, key) => {
// Preserve array structures
if (isArray(value)) {
return value.map(v => generateSpecs(v))
return value.map(val => generateSpecs(val))
}
// Recurse
if (isObject(value) && !isFunction(value)) {
Expand Down
4 changes: 2 additions & 2 deletions src/faker/index.js
@@ -1,4 +1,4 @@
import { cloneDeep, isObject, isFunction, mapValues } from 'lodash'
import { isObject, isFunction, mapValues } from 'lodash'
import fakerLib from 'faker'

/**
Expand Down Expand Up @@ -26,7 +26,7 @@ const remapFakerObject = (object) => {
* Clones/enhances the Faker object
* @returns object
*/
const faker = remapFakerObject(cloneDeep(fakerLib))
const faker = remapFakerObject(Object.assign({}, fakerLib))

// Required to mention Faker functionality
faker.seed = (...args) => fakerLib.seed(...args)
Expand Down

0 comments on commit 4b326d7

Please sign in to comment.