How to use the any-base.HEX function in any-base

To help you get started, we’ve selected a few any-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oculus42 / short-uuid / index.js View on Github external
function MakeConvertor(toAlphabet) {

        // Default to Flickr 58
        var useAlphabet = toAlphabet || flickrBase58;

        // UUIDs are in hex, so we translate to and from.
        var fromHex = anyBase(anyBase.HEX, useAlphabet);
        var toHex = anyBase(useAlphabet, anyBase.HEX);

        return {
            new: function() { return shortenUUID(uuidV4(), fromHex); },
            uuid: uuidV4,
            fromUUID: function(uuid) { return shortenUUID(uuid, fromHex); },
            toUUID: function(shortUuid) { return enlargeUUID(shortUuid, toHex); },
            alphabet: useAlphabet
        };
    }
github oculus42 / short-uuid / index.js View on Github external
function MakeConvertor(toAlphabet) {

        // Default to Flickr 58
        var useAlphabet = toAlphabet || flickrBase58;

        // UUIDs are in hex, so we translate to and from.
        var fromHex = anyBase(anyBase.HEX, useAlphabet);
        var toHex = anyBase(useAlphabet, anyBase.HEX);

        return {
            new: function() { return shortenUUID(uuidV4(), fromHex); },
            uuid: uuidV4,
            fromUUID: function(uuid) { return shortenUUID(uuid, fromHex); },
            toUUID: function(shortUuid) { return enlargeUUID(shortUuid, toHex); },
            alphabet: useAlphabet
        };
    }

any-base

Converter from any base to other any base

MIT
Latest version published 7 years ago

Package Health Score

65 / 100
Full package analysis