![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
distributable, serverless, and customizable unique ID generator based on Snowflake
distributable, serverless, and customizable unique ID generator based on Snowflake
Install by npm
.
npm install -S maylily
No external servers needed.
Just import and call maylily()
!
Traditional syntax. This code will run on most JavaScript engine.
var maylily = require("maylily");
(function() {
// returns a Promise object
maylily()
.then(function(id) {
// do something...
})
.catch(function(err) {
// err is instance of Error
});
}();
Modern syntax. Async/await syntax is easy to read
const maylily = require("maylily");
(async() => { // async syntax / arrow function
try {
const id = await maylily(); // await syntax
// do something...
}
catch(err) {
// err is instance of Error
}
})();
VERY modern syntax!
import maylily from "maylily"; // import syntax
(async() => {
try {
const id = await maylily();
// do something...
}
catch(err) {
// err is instance of Error
}
})();
name | description | default |
---|---|---|
radix | radix of generated ID (2-36) | 10 |
timeBase | base time in unixtime(millisec) | 946684800000 (2000-01-01T00:00:00Z) |
machineId | identifier of machine; must be unique in service | 0 |
machineBits | required bits to represent machineId | 3 |
generatorId | identifier of generator; must be unique in machine | process ID |
generatorBits | required bits to represent generatorId | 10 |
sequenceBits | required bits to represent sequence | 8 |
Generated value is stringified multiple precision integer (in specified radix).
000001011100000101111010101110101010111101 001 1101101010 00000110
|------------------------------------------| current time from timeBase in millisec
|---| machineId (uses machineBits bits)
|----------| generatorId (uses generatorBits bits)
|--------| sequence number (uses sequenceBits bits)
example:
// keeps options until next change
maylily({
timeBase: Date.parse("2017-01-01T00:00:00Z"), // if your service starts in 2017, this is enough.
machineBits: 1 // if required number machines are up to 2, this is enough.
});
See CHANGELOG.md.
[2.2.0] - 2019-07-21
FAQs
distributable, serverless, and customizable unique ID generator based on Snowflake
The npm package maylily receives a total of 9 weekly downloads. As such, maylily popularity was classified as not popular.
We found that maylily demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.