Gathering detailed insights and metrics for nehoid
Gathering detailed insights and metrics for nehoid
Gathering detailed insights and metrics for nehoid
Gathering detailed insights and metrics for nehoid
npm install nehoid
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (84.97%)
JavaScript (15.03%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
12 Commits
1 Watchers
1 Branches
1 Contributors
Updated on May 20, 2025
Latest Version
2.0.0
Package Id
nehoid@2.0.0
Unpacked Size
458.08 kB
Size
90.49 kB
File Count
102
NPM Version
11.3.0
Node Version
22.12.0
Published on
May 20, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
Unlike other ID generators, NehoID provides:
1npm install nehoid 2# or 3yarn add nehoid 4# or 5bun add nehoid
1import { NehoID } from "nehoid"; 2 3// Basic usage 4const id = NehoID.generate(); 5console.log(id); // "6a617977416b714d-7938716a56515a52-79764d5a50775555" 6 7// Advanced usage with collision detection 8const safeId = await NehoID.safe({ 9 strategy: "retry", 10 maxAttempts: 3, 11 checkFunction: async (id) => !(await database.exists(id)), 12}); 13 14// Context-aware ID 15const contextId = NehoID.contextual({ 16 includeDevice: true, 17 includeLocation: true, 18 userBehavior: "returning-customer", 19});
1// Standard formats 2NehoID.uuid(); // Standard UUID v4 3NehoID.nanoid(); // NanoID compatible 4NehoID.short(); // URL-safe short ID 5NehoID.hex(); // Hexadecimal ID 6 7// Advanced formats 8NehoID.hierarchical(); // Parent-child relationships 9NehoID.temporal(); // Time-ordered IDs 10NehoID.semantic(); // Meaningful prefixes 11NehoID.sequential(); // Database-friendly sequence
1const collisionSafeId = await NehoID.safe({ 2 strategy: "exponential-backoff", 3 maxAttempts: 5, 4 checkFunction: async (id) => { 5 return !(await yourDatabase.exists("users", id)); 6 }, 7});
1NehoID.generate({ 2 encoding: ["base64", "hex", "rot13"], // Multi-layer encoding 3 compression: "lz77", // Optional compression 4 alphabet: "ABCDEFGHIJKLMNOPQR", // Custom alphabet 5 reversible: true, // Enable reverse engineering 6});
1// Generate thousands of IDs efficiently 2const batchIds = NehoID.batch({ 3 count: 10000, 4 format: "nano", 5 parallel: true, 6 ensureUnique: true, 7}); 8 9// Bulk validation 10const validation = NehoID.validateBatch(existingIds, { 11 checkFormat: true, 12 checkCollisions: true, 13 repairCorrupted: true, 14});
1// Performance monitoring 2NehoID.startMonitoring(); 3const stats = NehoID.getStats(); 4/* 5{ 6 generated: 15420, 7 collisions: 0, 8 averageGenerationTime: '0.12ms', 9 memoryUsage: '2.1MB', 10 distributionScore: 0.98 11} 12*/ 13 14// ID health scoring 15const health = NehoID.healthCheck("your-id-here"); 16/* 17{ 18 score: 0.95, 19 entropy: 'high', 20 predictability: 'low', 21 recommendations: ['increase_length'] 22} 23*/
1// Device-aware IDs 2const deviceId = NehoID.contextual({ 3 includeDevice: true, // Device fingerprint 4 includeTimezone: true, // User timezone 5 includeBrowser: true, // Browser info 6 includeScreen: true, // Screen resolution 7}); 8 9// Business context 10const businessId = NehoID.semantic({ 11 prefix: "ORDER", 12 region: "US-WEST", 13 department: "SALES", 14 year: 2024, 15}); // Result: "ORDER-USWEST-SALES-2024-a7b9c2d4"
1// Migrate old IDs to new format 2const migrated = NehoID.migrate({ 3 from: "uuid", 4 to: "nehoid-v2", 5 preserveOrder: true, 6 batchSize: 1000, 7}); 8 9// Cross-platform compatibility 10const compatible = NehoID.compatible({ 11 platform: ["javascript", "python", "go"], 12 format: "base64", 13 length: 16, 14});
1import { NehoID, CollisionStrategy, EncodingPipeline } from "nehoid"; 2 3// Custom collision strategy 4const customStrategy: CollisionStrategy = { 5 name: "database-check", 6 maxAttempts: 3, 7 backoffType: "exponential", 8 checkFunction: async (id) => { 9 return !(await myDatabase.findById(id)); 10 }, 11}; 12 13// Custom encoding pipeline 14const pipeline = new EncodingPipeline() 15 .addEncoder("base64") 16 .addCompression("gzip") 17 .addEncoder("hex") 18 .enableReversibility(); 19 20const id = NehoID.generate({ 21 strategy: customStrategy, 22 pipeline: pipeline, 23 metadata: { 24 createdBy: "user-service", 25 version: "2.1.0", 26 }, 27});
Operation | NehoID | uuid | nanoid | shortid |
---|---|---|---|---|
Generate 1K IDs | 0.8ms | 1.2ms | 1.0ms | 2.1ms |
Batch 100K IDs | 45ms | 78ms | 62ms | 180ms |
Collision Check | 0.1ms | N/A | N/A | N/A |
Memory Usage | 1.2MB | 2.1MB | 1.8MB | 3.2MB |
NehoID.generate(options?)
- Generate basic IDNehoID.safe(options)
- Generate with collision detectionNehoID.batch(options)
- Bulk generationNehoID.validate(id, options?)
- Validate ID formatNehoID.healthCheck(id)
- Score ID qualityNehoID.uuid()
- Standard UUIDNehoID.nanoid(length?)
- NanoID formatNehoID.short(length?)
- Short URL-safe IDNehoID.hex(length?)
- Hexadecimal IDNehoID.contextual(options)
- Context-aware IDNehoID.semantic(options)
- Semantic/meaningful IDNehoID.decode(id)
- Reverse engineer ID (if reversible)NehoID.migrate(options)
- Migrate ID formatsNehoID.compatible(options)
- Cross-platform compatible IDsNehoID.startMonitoring()
- Enable performance monitoringNehoID.getStats()
- Get generation statistics1// Express.js middleware 2app.use( 3 NehoID.middleware({ 4 header: "X-Request-ID", 5 format: "short", 6 }) 7); 8 9// Database ORM integration 10const User = model("User", { 11 id: { 12 type: String, 13 default: () => NehoID.generate({ prefix: "usr" }), 14 }, 15});
NehoID V2 introduces a set of advanced ID generation capabilities for specialized use cases:
1import { NehoId } from "nehoid"; 2 3// Quantum-entangled IDs 4const quantumId = NehoId.quantum({ 5 entanglementGroup: "user-session", 6 coherenceTime: 60000 // 1 minute 7}); 8 9// Biometric-based IDs 10const bioId = NehoId.biometric({ 11 fingerprint: "fp_data_hash", 12 keystrokeDynamics: [0.32, 0.45, 0.67] 13}); 14 15// Blockchain-verified IDs 16const blockchainId = NehoId.blockchain({ 17 networkId: "main-net", 18 consensusType: "proof-of-stake" 19}); 20 21// Pattern-embedded IDs 22const patternId = NehoId.patternEmbedded("user-behavior-pattern"); 23 24// Recursive IDs (nested structure) 25const recursiveId = NehoId.recursive(3); // depth of 3 26 27// Fractal IDs (self-similar patterns) 28const fractalId = NehoId.fractal(4, 0.8); // 4 iterations, 0.8 complexity
1// Ultimate ID: combines quantum, biometric, and ML features 2const ultimateId = NehoId.ultimate({ 3 quantumGroup: "secure-session", 4 biometricData: { fingerprint: "fp_hash", voicePrint: "vp_hash" }, 5 mlFeatures: [0.7, 0.2, 0.9] 6}); 7 8// Cosmic DNA ID: combines astronomical and genetic features 9const cosmicDnaId = NehoId.cosmicDNA("orion", 5); 10 11// Predictive sequence: time-series based IDs 12const predictiveSequence = NehoId.predictiveSequence(5); 13console.log(predictiveSequence.baseId); // Base ID 14console.log(predictiveSequence.sequenceIds); // Array of sequence IDs 15const materializedId = predictiveSequence.materialize(2); // Materialize the 3rd ID
1// Adaptive ID system that evolves over time 2const adaptiveSystem = NehoId.createAdaptiveSystem({}); 3const adaptiveId1 = adaptiveSystem.generateNext(); 4const adaptiveId2 = adaptiveSystem.generateNext("user-login"); 5console.log(adaptiveSystem.getEvolutionHistory()); 6 7// Fluid ID pool with transformations 8const fluidPool = NehoId.createFluidPool(50); 9const fluidId = fluidPool.draw(); 10fluidPool.replenish(10);
MIT License - see LICENSE file for details
We welcome contributions! See CONTRIBUTING.md for guidelines.
No vulnerabilities found.
No security vulnerabilities found.