docs(readme): added node.js example#32
Closed
ShanTen wants to merge 2 commits intosqids:mainfrom
Closed
Conversation
|
There is a push to switch to use ESM, so using Actually, I think it would be better to have the |
Author
|
So something like..? 🚀 Getting startedyarn: yarn add sqidsnpm: npm install sqids<script src="https://cdnjs.cloudflare.com/ajax/libs/sqids/0.3.0/sqids.min.js"></script><script src="https://cdn.jsdelivr.net/npm/sqids/dist/sqids.min.js"></script>🛠️ Using Sqids in Node.jsCJS: const Sqids = require('sqids').default;
const sqids = new Sqids({
blocklist: new Set(['86Rf07']),
});ES6: import Sqids from 'sqids';
const sqids = new Sqids({
blocklist: new Set(['86Rf07']),
});👩💻 Examples... |
|
I'm thinking that's too busy. Over all, you just need the 👩💻 ExamplesNode.js import: Simple encode & decode: |
Member
|
@ShanTen @miquelfire I think I've been doing so many of these READMEs in diff languages, that I totally forgot about the import statement (and it should be there). I'll just use esm for now to keep it simple and close the PR, but thanks for the heads up! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Including the Node.js code snippet directly in the README would be convenient for quick reference.