Git Product home page Git Product logo

flakeid's People

Contributors

jacbop avatar pwnsrma avatar s-yadav avatar zhenghan-fsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

flakeid's Issues

ReferenceError: c is not defined

This code in flakeid.js

    const a = {
      b: c,
      d: 2
    }

    //const d = {...a};

is causing the following errors when trying to use in node.js

$ npm test

> [email protected] test C:\Users\tom\code\digitizer-apex
> mocha --colors --recursive --require ts-node/register --watch-extensions ts "**/*spec.ts"


C:\Users\tom\code\digitizer-apex\node_modules\flakeid\lib\flakeid.js:68
        b: c,
           ^
ReferenceError: c is not defined
    at FlakeId.gen (C:\Users\tom\code\digitizer-apex\node_modules\flakeid\lib\flakeid.js:68:12)
    at Object.get (C:\Users\tom\code\digitizer-apex\src\util\mockId.ts:24:29)
    at Object.<anonymous> (C:\Users\tom\code\digitizer-apex\src\util\mockId.spec.ts:6:20)
    at Module._compile (module.js:643:30)
    at Module.m._compile (C:\Users\tom\code\digitizer-apex\node_modules\ts-node\src\index.ts:430:23)
    at Module._extensions..js (module.js:654:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\Users\tom\code\digitizer-apex\node_modules\ts-node\src\index.ts:433:12)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at C:\Users\tom\code\digitizer-apex\node_modules\mocha\lib\mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (C:\Users\tom\code\digitizer-apex\node_modules\mocha\lib\mocha.js:247:14)
    at Mocha.run (C:\Users\tom\code\digitizer-apex\node_modules\mocha\lib\mocha.js:576:10)
    at Object.<anonymous> (C:\Users\tom\code\digitizer-apex\node_modules\mocha\bin\_mocha:637:18)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! Test failed.  See above for more details.

This seems like cruft code that can be removed.

Bump version to 1.0.0

Is this module stable? Would it be appropriate to bump the major version to 1.0.0?

How do you even use this?

I'm trying to include it in-browser.
I downloaded the minified file, included it in my file header, and tried to call
new FlakeId().gen()

but I get

Uncaught TypeError: FlakeId is not a constructor

How am I supposed to use it?

Optionally Return BigInt

It would be great to have a bigint return type if user wants to. It is not possible for me to cast integer from id.gen() to bigint in mongodb.

BigInt Constructor Support

Thanks a lot for this package. However I gained a huge performance boost if instead of returning hexToDec(hex), BigInt(hex).
For comparison BigInt constructor yields around 0.05 ms consistently. Whereas hexToDec yields around 0.35 ms - 0.9 ms varying randomly. A BigInt constructor with fallback to hexToDec would be great, I can do it if you want to

logical error in substring

When bid is "1100000010000101111100010101000010011111000000000000"
It ends up the id became null
The for statement is for (var i = bid.length; i >= 0; i -= 4)
I think it should be for (var i = bid.length; i > 0; i -= 4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.