From 03d56e788e5de649b535c6ccefad58d3a2e9bddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=8A=9B?= <3071730@qq.com> Date: Fri, 14 Dec 2018 11:13:15 +0800 Subject: [PATCH] feat(utils): Add the `uniqueId` method --- src/components/Base/Editor.js | 4 ++-- src/utils/index.js | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/Base/Editor.js b/src/components/Base/Editor.js index 93446dae..752d243e 100644 --- a/src/components/Base/Editor.js +++ b/src/components/Base/Editor.js @@ -1,5 +1,5 @@ import G6Editor from '@antv/g6-editor'; -import { createId } from '@utils'; +import { uniqueId } from '@utils'; import Global from '@common/Global'; export default class Editor extends G6Editor { @@ -16,6 +16,6 @@ export default class Editor extends G6Editor { G6Editor.track(false); } - this.id = createId(); + this.id = uniqueId(); } } diff --git a/src/utils/index.js b/src/utils/index.js index 2cab9d8e..1ebffff5 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,13 +1,11 @@ -import pick from 'lodash/pick'; import merge from 'lodash/merge'; +import pick from 'lodash/pick'; +import uniqueId from 'lodash/uniqueId'; import upperFirst from 'lodash/upperFirst'; -const createCounter = (count = 0) => () => count++; -const createId = createCounter(); - export { - createId, merge, pick, + uniqueId, upperFirst, };