1.0.8 • Published 4 years ago

jscombguid v1.0.8

Weekly downloads
14
License
MIT
Repository
github
Last release
4 years ago

JsCombGuid

npm version

A simple JavaScript Comb Guid Generator.

No guarantees it's perfect!

That being said, we have run tests generating 100,000 ids and not having any duplicates. Guids are generated based on current date/ time and this data is used to create the sequential unique identifiers.

Primary concept of the code was sparked within this discussion http://stackoverflow.com/a/8809472/173949.

Getting Started

Installing

Pretty simple implementation, simply import the module, and you're off an running!

npm install jscombguid

And cheap node example usage;

const comb = require("jscombguid");

console.log(comb.generateCombGuid());

Running the tests

The library source includes some straight forward mocha tests and a duplicate check test which executes 10,000 cycles of guid generation check for duplicates being created. These tests sre located in the test/index.test.js file.

To execute the tests fire off the following line of code in your fav tool.

npm run test

.nyc_output directory will have the coverage reports outputted to the coverage directory. To view this report, and you have http-server, a handy basic insta web server, you can instal it and simply run; Total overkill for this small package, but a good example of code coverage reporting.

npm i -g http-server

Then fire it up and run it post the test execution;

http-server ./coverage/lcov-report/

and check out the server site at http://127.0.0.1:8080

Built With

  • momentjs - used in working with date time to generate the combs (direct dependency)
  • mocha - unsed in the unit testing of the simple function
  • instabul - used to validate test coverage and reporting
  • eslint - used for housekeeping and sanity
  • babel - used to bust down the code, we aren't doing anything that would fully constitute this however

Development

After cloning the repo run;

npm install

From that point, there are 3 possible scripts to run;

  1. build - runs lint, tests, then babel
  2. lint - runs eslint
  3. test - runs the mocha tests

To start, just run a build;

npm run build

And away you go. This is an overblown project repo, with probably more going on than necessary, however, it is a proof of concept on all aspects of npm package development. That being said, there are a few references which are worth mentioning here;

  1. Developing and Publishing an NPM Package
  2. BadgeFury
  3. How to Build and Publish an NPM Package
  4. Automate your NPM publish with GitHub Actions

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Big thanks to @thetinomen he refactored out the sophmoric code...
1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

2.0.3

5 years ago