Socket
Socket
Sign inDemoInstall

ddd-es-node

Package Overview
Dependencies
14
Maintainers
1
Versions
211
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.15 to 0.0.16

2

package.json
{
"name": "ddd-es-node",
"version": "0.0.15",
"version": "0.0.16",
"description": "ddd-es-node",

@@ -5,0 +5,0 @@ "main": "./dist/src/index.js",

@@ -16,5 +16,4 @@ import {

});
it('uses incremental uuids', () => {
expect(uuid()).toEqual('0');
expect(uuid()).toEqual('1');
it('uses freezes the uuid', () => {
expect(uuid()).toEqual(uuid());
});

@@ -31,4 +30,3 @@ });

it('uses random uuids', () => {
console.log(uuid());
expect(uuid()).toMatch(/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/);
expect(uuid()).not.toEqual(uuid());
});

@@ -35,0 +33,0 @@ });

import { v4 } from 'uuid';
import { Clock } from './../index';
let incrementalUUID : boolean = false;
let uidCount : number = 0;
let frozenUUID : string = null;
export const useIncrementalUUID = (value : boolean) => {
incrementalUUID = value;
export const freezeUUID = (value? : string) => {
frozenUUID = value || v4();
};
export const unfreezeUUID = () => {
frozenUUID = null;
};
export const uuid = () : string => {
return incrementalUUID ? `${uidCount++}` : v4();
return frozenUUID === null ? v4() : frozenUUID;
};

@@ -14,0 +17,0 @@

@@ -6,3 +6,4 @@ import {

import {
useIncrementalUUID
freezeUUID,
unfreezeUUID
} from './core/entity';

@@ -25,3 +26,4 @@

export {
useIncrementalUUID
freezeUUID,
unfreezeUUID
};

@@ -42,7 +44,7 @@

Clock.freeze();
useIncrementalUUID(true);
freezeUUID();
} else {
Clock.unfreeze();
useIncrementalUUID(false);
unfreezeUUID();
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc