Socket
Socket
Sign inDemoInstall

@syncot/util

Package Overview
Dependencies
4
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.7 to 0.0.8

lib/taskRunner.d.ts

1

lib/index.d.ts

@@ -7,3 +7,4 @@ export * from './buffer';

export * from './stream';
export * from './taskRunner';
export * from './types';
export * from './validation';

@@ -7,2 +7,3 @@ export * from './buffer';

export * from './stream';
export * from './taskRunner';
export * from './validation';

9

lib/misc.d.ts

@@ -5,6 +5,11 @@ export declare function noop(): void;

*/
export declare function whenNextTick(): Promise<{}>;
export declare function whenNextTick(): Promise<unknown>;
/**
* Returns a Promise that resolves after the specified minimum number of milliseconds.
*/
export declare function delay(minDelayMilliseconds?: number): Promise<{}>;
export declare function delay(minDelayMilliseconds?: number): Promise<unknown>;
/**
* Generates a unique ID using an approach inspired by MongoDB ObjectID.
* See https://docs.mongodb.com/manual/reference/method/ObjectId/.
*/
export declare function generateId(): string;

@@ -0,1 +1,2 @@

import { randomFillSync } from 'crypto';
export function noop() {

@@ -16,1 +17,16 @@ // Do nothing.

}
const randomIdBuffer = Buffer.allocUnsafeSlow(12);
randomFillSync(randomIdBuffer, 4);
let randomIdCounter = randomIdBuffer.readUIntBE(9, 3);
/**
* Generates a unique ID using an approach inspired by MongoDB ObjectID.
* See https://docs.mongodb.com/manual/reference/method/ObjectId/.
*/
export function generateId() {
/* tslint:disable-next-line:no-bitwise */
randomIdBuffer.writeIntBE((Date.now() * 0.001) | 0, 0, 4);
randomIdBuffer.writeUIntBE(randomIdCounter, 9, 3);
/* tslint:disable-next-line:no-bitwise */
randomIdCounter = (randomIdCounter + 1) & 0x00ffffff;
return randomIdBuffer.toString('base64');
}
{
"name": "@syncot/util",
"version": "0.0.7",
"version": "0.0.8",
"description": "A collection of utilities required by other @syncot modules.",

@@ -29,3 +29,3 @@ "keywords": [

"dependencies": {
"@types/node": "^10.12.21",
"@types/node": "^12.0.4",
"@types/readable-stream": "^2.3.1",

@@ -35,3 +35,3 @@ "readable-stream": "^3.3.0",

},
"gitHead": "f42e7403c10d1236587af99fc13d35b2a27a55ad"
"gitHead": "888dd1570ed3023173b3b5bbafad0f29271b246f"
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc