Skip to content

Commit

Permalink
Merge 769e281 into 57e2412
Browse files Browse the repository at this point in the history
  • Loading branch information
MasatoMakino committed Apr 18, 2021
2 parents 57e2412 + 769e281 commit 4c7eec3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/PUID.js
Expand Up @@ -2,7 +2,7 @@ export default {
_id: 0,
_uids: new Map(),
getNewId: function() {
return `PUID_${this._id++}`;
return `PUID_${++this._id}`;
},
id: function(functionOrObject) {
if (this._uids.has(functionOrObject)) {
Expand Down
4 changes: 2 additions & 2 deletions test/utils/PUID.spec.js
Expand Up @@ -20,12 +20,12 @@ describe('utils -> PUID', () => {
const nid1 = NewPUID.id(myObject);

assert.strictEqual(NewPUID._id, 1);
assert.strictEqual(nid1, 'PUID_0');
assert.strictEqual(nid1, 'PUID_1');

const nid2 = NewPUID.id(myFunction);

assert.strictEqual(NewPUID._id, 2);
assert.strictEqual(nid2, 'PUID_1');
assert.strictEqual(nid2, 'PUID_2');
assert.isTrue(NewPUID._uids.has(myObject));
assert.isTrue(NewPUID._uids.has(myFunction));
});
Expand Down

0 comments on commit 4c7eec3

Please sign in to comment.