New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

appolo-utils

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appolo-utils - npm Package Compare versions

Comparing version 0.0.51 to 0.0.52

lib/promises/deferred.js

5

index.js

@@ -17,5 +17,6 @@ "use strict";

exports.Hash = hash_1.Hash;
const promises_1 = require("./lib/promises");
exports.Deferred = promises_1.Deferred;
const promises_1 = require("./lib/promises/promises");
exports.Promises = promises_1.Promises;
const deferred_1 = require("./lib/promises/deferred");
exports.Deferred = deferred_1.Deferred;
const time_1 = require("./lib/time");

@@ -22,0 +23,0 @@ exports.Time = time_1.Time;

3

index.ts

@@ -8,3 +8,4 @@ import {Numbers} from "./lib/numbers"

import {Hash} from "./lib/hash"
import {Deferred, Promises} from "./lib/promises"
import {Promises} from "./lib/promises/promises"
import {Deferred} from "./lib/promises/deferred"
import {Time} from "./lib/time"

@@ -11,0 +12,0 @@ import {Files} from "./lib/files"

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const crypto = require("crypto");
const index_1 = require("../index");
class Guid {

@@ -16,4 +18,30 @@ static shortGuid() {

}
static uid(len = 11) {
let alphaNumeric = "zyxwvutsrqponmlkjihgfedcba9876543210";
let str = '';
while (len--) {
str += alphaNumeric[Math.random() * 36 | 0];
}
return str;
}
static nanoidUrl(size = 21) {
return Guid.nanoid(size, "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
static async nanoid(size = 21, alphabet = "0123456789abcdefghijklmnopqrstuvwxyz") {
let mask = (2 << 31 - Math.clz32((alphabet.length - 1) | 1)) - 1, step = Math.ceil(1.6 * mask * size / alphabet.length);
let id = '';
let buffer = Buffer.allocUnsafe(step);
while (true) {
let bytes = await index_1.Promises.fromCallback(c => crypto.randomFill(buffer, c));
let i = step;
while (i--) {
id += alphabet[bytes[i] & mask] || '';
if (id.length === +size) {
return id;
}
}
}
}
}
exports.Guid = Guid;
//# sourceMappingURL=guid.js.map

@@ -0,1 +1,5 @@

import crypto = require('crypto')
import {Promises, Util} from "../index";
export class Guid {

@@ -16,2 +20,39 @@ public static shortGuid(): string {

}
public static uid(len:number = 11): string {
let alphaNumeric = "zyxwvutsrqponmlkjihgfedcba9876543210"
let str = '';
while (len--) {
str += alphaNumeric[Math.random() * 36 | 0];
}
return str;
}
public static nanoidUrl(size = 21): Promise<string> {
return Guid.nanoid(size, "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
public static async nanoid(size: number = 21, alphabet: string = "0123456789abcdefghijklmnopqrstuvwxyz"): Promise<string> {
let mask = (2 << 31 - Math.clz32((alphabet.length - 1) | 1)) - 1,
step = Math.ceil(1.6 * mask * size / alphabet.length);
let id = '';
let buffer = Buffer.allocUnsafe(step);
while (true) {
let bytes = await Promises.fromCallback(c => crypto.randomFill(buffer, c));
let i = step;
while (i--) {
id += alphabet[bytes[i] & mask] || '';
if (id.length === +size) {
return id
}
}
}
}
}

@@ -9,3 +9,3 @@ "use strict";

const objects_1 = require("./objects");
const promises_1 = require("./promises");
const promises_1 = require("./promises/promises");
const strings_1 = require("./strings");

@@ -12,0 +12,0 @@ const time_1 = require("./time");

@@ -7,3 +7,3 @@ import {Numbers} from "./numbers";

import {Objects} from "./objects";
import {Promises} from "./promises";
import {Promises} from "./promises/promises";
import {Strings} from "./strings";

@@ -10,0 +10,0 @@ import {Time} from "./time";

@@ -17,3 +17,3 @@ {

"main": "./index.js",
"version": "0.0.51",
"version": "0.0.52",
"license": "MIT",

@@ -20,0 +20,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc