How to use short-uuid - 10 common examples

To help you get started, we’ve selected a few short-uuid 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 AJInteractive / InterviewJS / packages / composer / src / partials / panes / interviewee / ImagePane.js View on Github external
const fileToKey = (data, storyId) => {
  const { name, type } = data;
  // console.log(name, type);

  let namespace = storyId;
  if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
  if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);

  const uuid = uuidv5(`${type},${name}`, namespace);
  return `${shortUuid().fromUUID(uuid)}-${name}`;
};
github AJInteractive / InterviewJS / packages / composer / src / partials / panes / interviewee / ImagePane.js View on Github external
const fileToKey = (data, storyId) => {
  const { name, type } = data;
  // console.log(name, type);

  let namespace = storyId;
  if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
  if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);

  const uuid = uuidv5(`${type},${name}`, namespace);
  return `${shortUuid().fromUUID(uuid)}-${name}`;
};
github AJInteractive / InterviewJS / packages / composer / src / partials / forms / MetaForm.js View on Github external
const fileToKey = (data, storyId) => {
  const { name, type } = data;
  // console.log(name, type);

  let namespace = storyId;
  if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
  if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);

  const uuid = uuidv5(`${type},${name}`, namespace);
  return `${shortUuid().fromUUID(uuid)}-${name}`;
};
github AJInteractive / InterviewJS / packages / composer / src / partials / panes / user / tabs / Image.js View on Github external
const fileToKey = (data, storyId) => {
  const { name, type } = data;
  // console.log(name, type);

  let namespace = storyId;
  if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
  if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);

  const uuid = uuidv5(`${type},${name}`, namespace);
  return `${shortUuid().fromUUID(uuid)}-${name}`;
};
github DecenterApps / MatchChannels / etherships / src / actions / userActions.js View on Github external
export const initAccount = () => (dispatch, getState) =>  {
    let peerId = localStorage.getItem('peer');

   console.log("Peerid: ", peerId);

    if(!peerId) {
      peerId = short.uuid();

      localStorage.setItem('peer', peerId);
    }

    const peer = webrtc.createPeer(peerId);

    const board = localStorage.getItem('board');
    let user = localStorage.getItem('user');

    peer.on('connection', (_conn) => {

      _conn.on('open', (d) => {
        console.log('Conn open - receiver side', d);
        // closeModal()(dispatch);
      });
github timhagn / gatsby-background-image / packages / gatsby-background-image / src / lib / StyleUtils.js View on Github external
export const fixClassName = ({ className, ...props }) => {
  // const escapedClassName = escapeClassNames(className)
  const convertedProps = convertProps(props)
  const elementExists = inComponentClassCache(className)

  // Extract imageData.
  const imageData = getCurrentSrcData(convertedProps)

  // Add an additional unique class for multiple s.
  const additionalClassname = uuid.generate()

  // Create random "uniquely hashed" additionalClass if needed.
  const randomClass = ` gbi-${hashString(
    (imageData && imageData.srcSet) || className
  )}-${additionalClassname}`

  // Should an element exist, add randomized class.
  const additionalClass = elementExists ? randomClass : ``
  const componentClassNames = `${className || ``}${additionalClass ||
    ``}`.trim()
  // Add it to cache if it doesn't exist.
  if (!elementExists) activateCacheForComponentClass(className)
  return [componentClassNames]
}
github AJInteractive / InterviewJS / packages / composer / src / partials / modals / PublishStoryModal.js View on Github external
const computeId = (userId, storyId) => {
  let namespace = userId;
  if (namespace.indexOf(":") > 0) namespace = namespace.split(":").pop();

  let id = storyId;
  if (id.indexOf("_")) id = id.split("_").pop();
  if (id.length < 36) id = shortUuid().toUUID(id);

  const uuid = uuidv5(id, namespace);
  return shortUuid().fromUUID(uuid);
};
github AJInteractive / InterviewJS / packages / lambda / story.js View on Github external
const computeId = (userId, storyId) => {
  let namespace = userId;
  if (namespace.indexOf(":") > 0) namespace = namespace.split(":").pop();

  let id = storyId;
  if (id.indexOf("_")) id = id.split("_").pop();
  if (id.length < 36) id = shortUuid().toUUID(id);

  const uuid = uuidv5(id, namespace);
  return shortUuid().fromUUID(uuid);
};
github AJInteractive / InterviewJS / packages / lambda / story.js View on Github external
const computeId = (userId, storyId) => {
  let namespace = userId;
  if (namespace.indexOf(":") > 0) namespace = namespace.split(":").pop();

  let id = storyId;
  if (id.indexOf("_")) id = id.split("_").pop();
  if (id.length < 36) id = shortUuid().toUUID(id);

  const uuid = uuidv5(id, namespace);
  return shortUuid().fromUUID(uuid);
};
github DecenterApps / MatchChannels / etherships / src / services / webrtcService.js View on Github external
peer.on('error', (err) => {
      console.log('error', err);

      if(err.message.indexOf('is taken') !== -1) {
        localStorage.setItem('peer', short.uuid());
        window.location.reload();
      } else if(err.message.indexOf('Could not connect to peer ') !== -1) {
         localStorage.removeItem('user');
         localStorage.removeItem('board');
      }
    });

short-uuid

Create and translate standard UUIDs with shorter formats.

MIT
Latest version published 7 months ago

Package Health Score

63 / 100
Full package analysis