Socket
Socket
Sign inDemoInstall

ember-cli-guid

Package Overview
Dependencies
291
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ember-cli-guid

GUID / UUID generator, compactor and expander.


Version published
Weekly downloads
119
increased by6.25%
Maintainers
1
Install size
29.5 MB
Created
Weekly downloads
 

Readme

Source

ember-cli-guid

Utility addon for randomly generating GUID / UUID.

The utility can also compact and expand a GUID into and from a string using base64.

A compact GUID is beneficial for shorter urls and for smaller transfers.

Example

import { compactGuid, createGuid, expandGuid } from 'ember-cli-guid';

let myGuid = createGuid(); // '13ab9d6a-9aa4-40da-ae0d-21181c373e18'
let myCompactedGuid = compactGuid(myGuid); // 'ap2rE6Sa2kCuDSEYHDc-GA'
let myExpandedGuid = expandGuid(myCompactedGuid); // '13ab9d6a-9aa4-40da-ae0d-21181c373e18'

Note: createGuid can return a compact GUID:

createGuid(true); // 'kFy4uun_BkaUdbSGYW1PYQ'

Serverside Use (C#)

A compacted GUID can be easily expanded:

new Guid(Convert.FromBase64String(input.Replace("_", "/").Replace("-", "+") + "=="));

Similarly, a GUID can be compacted:

Convert.ToBase64String(input.ToByteArray()).Substring(0, 22).Replace("/", "_").Replace("+", "-");

Keywords

FAQs

Last updated on 16 Oct 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc