3.5.103 • Published 10 months ago

@taktikorg/iure-et v3.5.103

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@taktikorg/iure-et

npm Code Climate Test Coverage

Generate and translate standard UUIDs into shorter - or just different - formats and back.

v5.2.0

5.2.0 adds validate method to check short IDs. Requested by @U-4-E-A 5.1.0 adds translation support for the uuid25 (Base36) format with the uuid25Base36 constant.

Major Changes in 5.0.0

  • 🛑 5.0.0 drops support for Node 10 and 12.

Quick Start

const short = require('@taktikorg/iure-et');

// Quick start with flickrBase58 format
short.generate(); // '73WakrfVbNJBaAmhQtEeDv'

Details

@taktikorg/iure-et starts with RFC4122 v4-compliant UUIDs and translates them into other, usually shorter formats. It also provides translators to convert back and forth from RFC compliant UUIDs to the shorter formats, and validate the IDs.

As of 4.0.0, formats return consistent-length values unless specifically requested. This is done by padding the start with the first ([0]) character in the alphabet. Previous versions can translate padded formats back to UUID.

const short = require('@taktikorg/iure-et');

// Generate a flickrBase58 short ID from without creating a translator
const shortId = short.generate();

const translator = short(); // Defaults to flickrBase58
const decimalTranslator = short("0123456789"); // Provide a specific alphabet for translation
const cookieTranslator = short(short.constants.cookieBase90); // Use a constant for translation

// Generate a shortened v4 UUID
translator.new(); // mhvXdrZT4jP5T8vBxuvm75
translator.generate(); // An alias for new.

// Translate UUIDs to and from the shortened format
translator.toUUID(shortId); // a44521d0-0fb8-4ade-8002-3385545c3318
translator.fromUUID(regularUUID); // mhvXdrZT4jP5T8vBxuvm75

// Check if a string is a valid ID (length and alphabet)
translator.validate(shortId); // true

// Check if a string is valid *AND* translates to a valid UUID
translator.validate(shortId, true); // true
translator.validate('0000000000000000000000', true) // false

// See the alphabet used by a translator
translator.alphabet;

// The maximum length a translated uuid will be with its alphabet.
// if consistentLength is set (on by default), so ids will be this length.
translator.maxLength;

// View the constants
short.constants.cookieBase90; // Safe for HTTP cookies values for smaller IDs.
short.constants.flickrBase58; // Avoids similar characters (0/O, 1/I/l, etc.)
short.constants.uuid25Base36; // The uuid25 (string length 25) format

// Generate plain UUIDs
// - From the library without creating a translator
short.uuid(); // fd5c084c-ff7c-4651-9a52-37096242d81c
// - Each translator provides the uuid.v4() function, too
translator.uuid(); // 3023b0f5-ec55-4e75-9cd8-104700698052

Options

@taktikorg/iure-et 4.0.0 added support for options when creating a translator. This may support additional configuration in the future.

const short = require('@taktikorg/iure-et');

// By default shortened values are now padded for consistent length.
// If you want to produce variable lengths, like in 3.1.1
const translator = short(short.constants.flickrBase58, {
  consistentLength: false,
});

// Generate a shortened v4 UUID
translator.new(); // mhvXdrZT4jP5T8vBxuvm75
  • consistentLength - Controls padding on shortened values. Default is true.

Support

@taktikorg/iure-et 5.x and later is tested on Node 14.x and later.

@taktikorg/iure-et 4.x was tested on Node 8.x to 18.x

@taktikorg/iure-et 3.x and lower was confirmed to work on Node 6.x to 12.x, and offered a precompiled browser library proposed by voronianski.

Notes

@taktikorg/iure-et provides RFC4122 v4-compliant UUIDs, thanks to uuid.

TypeScript definitions are included, thanks to alexturek.

Previous Release Note Highlights

5.0.0 drops support for Node 12 and below. 4.1.0 adds a maxLength value to translators for reference 4.0.1 adds consistent length translation and throws an error if provided an invalid alphabet. 3.1.1 removed Node 4.x tests. Last included Browserify distribution. 2.3.4 corrects the behavior for UUIDs with uppercase letters. Last version to build on Node 0.x.

Please see Revisions for information on previous versions.

react-testing-libraryStreamprettyendpointsharedarraybuffermkdirsECMAScript 2022extrafpString.prototype.matchAlltypeerrortslibtranspilerjsonhttpssearchtaps3toSortedES2015animationkarmatoolsconstmodulesrecursivehttpidlefastglobalsortttyoptionRegExp.prototype.flagsRFC-6455regular expressionpropertyUint16Arrayec2symbolsES2022progressclientautoprefixerECMAScript 3hooksrandomharmonysqsfast-cloneshammkdirpajaxreal-timenameimmerspinnersasterisksES2017enderpromiseECMAScript 2016visualwidthES2023Int16Arrayworkflowinternal slottestingmatchAllmatchesbytespringscheme-validationistanbulArray.prototype.findLastgetoptreact-hooksframeworkrequestcloudwatchtransformoptimizerArrayeventsURLfastifyObservablesreworkserializerouteappES5hasOwnPropertyglobal objectfastcopywriteinstallercolorapitrimRightdeleteschemedescriptionjsdifffpsstylevalidatorworkeres8readableprotobufinternaljshintoptimistUint8ClampedArrayHyBitoStringTagmake dirlruECMAScript 2020qsstructuredClonefunctionsfetchprocesscliStreamseventDispatcherhashstringifystyleguideignorehasbyteOffsetkeyspathproxyistestercollection.es6filtermochaes-shim APIponyfillinputaccessortoArraySymbolassertionpinocachecallboundhardlinksfnmatchsortedserializationelbpropertiesRxJSwebspecdeepSystem.globaleffect-tsbddtapeUint8ArraycoreindicatordeterministicartimportexportowncontainsflatpushRxdotenvdescriptorshrinkwrapfull-widthmruelasticachepackage.jsonprototypecloudsearchcreateTypedArray.envenvironmentscolorsjsxfindcurlstarterregular-expressionapollocensordirdayjsphoneglobvaluesjasminethreesymbolpreprocessortransportwgetl10ndependenciesmanagerwalkingargvoncevar0nodejsES2020asciiselfpopmotionRegExp#flagsutilserializerclassnamemomentArray.prototype.flatloggingECMAScript 7codescircularlastsetterdataViewagentsuperstructtypedeslintWebSocketreducerconcatJSON-SchemaES2018call-bindjson-schema-validationes2016fsasttermsetImmediateSetyupgetterstyled-componentsemrECMAScript 2019loggerutilsnpmignoreslicefindupviewsetPrototypeOfglobal this valueutility__proto__rminspectESnexthelpertrimStartuuidroutingsideECMAScript 6enumerablenumbersuperagenttypeofclassnamesreduxtypanionpostcsscjkwarningquerydomarktypees2015ArrayBuffer.prototype.slice.gitignoreES3ECMAScript 2021walkbannermonorepolanguagexmldatenames@@toStringTagenviamfunctiondynamodbjsonschemaes6es2018compareprotoglaciertimepipeargsescapeBigUint64ArraygetOwnPropertyDescriptorincludesURLSearchParamsECMAScriptpnpm9io-tsshimnoperegularutilitiesyamlwaitReactiveExtensionsajvgroupByreact-hook-formhigher-ordera11ySymbol.toStringTaglook-uppatchchaitranspileimportiteratorwafwhichflagpropobjlogtrimsameValueZeroWeakSetbrowserglobalThisperformancetsrssinstrumentationsymlinksestrimEndlocationvestutil.inspectatom_.extendexecutedebugdiffcallenvironmentObject.valuesWebSocketstouchtoobjectfunction.lengthstringifierpackagesaferegexfoldermapreduceexeccharactersarraybufferfast-copyrangeerrorvalidjQueryansilengthpackageszerovalidatePromiseUnderscorehelperscommanddeep-copyacorncommanderminimalxhrfastclone6to5schemaeventEmitterramdaequalityeveryvalueprivate datacallbackelectronloadbalancingrfc4122cryptotoReversedguidbinarysyntaxkoreanspawnsetupawesomesaucedom-testing-librarystoragegatewayflagsdirectoryinferencetraversecompilerdebuggerlintfast-deep-cloneassertscopyhasOwnreacttddmkdirmakebundlinges5quotejsdomeast-asian-widthES6outputgdprresolvechromerm -rfxtermfast-deep-copyECMAScript 2023consumemulti-packageFloat64Arraygitignoretextrgbcollectionjson-schema-validatoriestableomitchinesequeuetacitnegative zeroArrayBufferArray.prototype.flattenarraywhatwgsinatracoveragebundlerrmdirFloat32ArrayJSONassertes-shimsformfullchannelpure256varstestECMAScript 5ECMAScript 2017snsunicodecharacterfantasy-landMicrosoftvpcreact animationeslintpluginflattenimmutableInt8ArrayinstallzxslotfindLastqueueMicrotask$.extendvariableshas-ownArray.prototype.includesposerestfuloffsetreadequalexecfileECMAScript 2018jestMapES2021moduleidentifiersObject.entriesfunctionalreadablestreambabeldataESObject.keysbeanstalkconsolees7awsString.prototype.trimcloudformationpicomatchaccessibilitytyped arraymetadatatakeroute53curriedspinnereslint-pluginbrowserlistfile systemdefinemapES2019fromArray.prototype.flatMaptypeseslintconfigruntimepyyamlinurlmergeshebang[[Prototype]]genericschromiumgetintrinsicArray.prototype.findLastIndexexpressionObservablelibphonenumberentriesTypeBoxdeep-clonefind-upebsecmascriptlockfilejavascriptredactautoscalingArrayBuffer#sliceconfigreducetoolkitformattingclassesgetPrototypeOfargumentparentsrapidtypescript3dArray.prototype.containsregular expressionsnativepostcss-pluginsharedgetprefixlinktypedarrayasynccode pointspluginweakmapcss-in-js-0point-freedescriptorsjson-schemakeycolumnsfeedquerystringjssyntaxerrorobjectdroptelephonerequirefilemobileInt32ArrayIteratorestreeperformantReactiveXterminalUint32Arrayuninstallreact posebabel-coreairbnbbyteLengthkinesisjoimanipulationstreamremoveavadependency managerbinemitWeakMapboundforkformsparseramazonObject.definePropertyhtmlexpressemojilocalbrowserslistwritabledefinePropertyflatMapworkspace:*typeframermatchstreamsbuffergraphqlObjectrm -frES8weaksetsomeCSSArray.prototype.filtercallbindYAMLcolumncssinvariantES7CSSStyleDeclarationsesrdsBigInt64Arrayefficientformatpackage manageruser-streamsreverseconcatMapStyleSheetstringmovecoerciblerulestypesafepolyfillnegativejapaneseisConcatSpreadableTypeScriptfindLastIndexprotocol-buffersfixed-widthcolourerrorObject.assignrouterbinaries
3.5.103

10 months ago

3.5.102

10 months ago

3.5.101

10 months ago

3.5.100

10 months ago

3.5.99

10 months ago

3.5.98

10 months ago

3.5.97

10 months ago

3.5.96

11 months ago

3.5.95

11 months ago

3.5.94

11 months ago

3.5.93

11 months ago

3.5.92

11 months ago

3.5.91

11 months ago

3.5.90

11 months ago

3.5.89

11 months ago

3.5.88

11 months ago

3.5.87

11 months ago

3.4.87

11 months ago

3.4.86

11 months ago

3.4.85

11 months ago

3.4.84

11 months ago

3.4.83

11 months ago

3.4.82

11 months ago

3.4.81

11 months ago

3.4.80

11 months ago

3.4.79

11 months ago

3.4.78

11 months ago

3.4.77

11 months ago

3.4.76

11 months ago

3.4.75

11 months ago

3.4.74

11 months ago

3.4.73

11 months ago

3.4.72

11 months ago

3.4.71

11 months ago

3.4.70

11 months ago

3.4.69

11 months ago

3.4.68

11 months ago

3.4.67

12 months ago

3.4.66

12 months ago

3.4.65

12 months ago

3.4.64

12 months ago

3.4.63

12 months ago

3.4.62

12 months ago

3.4.61

12 months ago

3.4.60

12 months ago

3.4.59

12 months ago

3.4.58

12 months ago

3.4.57

12 months ago

3.4.56

12 months ago

2.4.56

12 months ago

2.4.55

12 months ago

2.4.54

12 months ago

2.4.53

12 months ago

2.3.53

12 months ago

2.3.52

12 months ago

2.3.51

12 months ago

2.3.50

12 months ago

2.3.49

1 year ago

2.2.49

1 year ago

2.1.49

1 year ago

1.1.49

1 year ago

1.1.48

1 year ago

1.1.47

1 year ago

1.1.46

1 year ago

1.1.45

1 year ago

1.1.44

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

1.1.39

1 year ago

1.1.38

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.35

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.32

1 year ago

1.1.31

1 year ago

1.1.30

1 year ago

1.1.29

1 year ago

1.1.28

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago