How to use the uuid function in uuid

To help you get started, we’ve selected a few 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 strathausen / dracula / src / Dracula.js View on Github external
addNode(id, nodeData) {
    // Node initialisation shorthands
    if (!nodeData) {
      nodeData = isId(id) ? { id } : id
    } else {
      nodeData.id = id
    }
    if (!nodeData.id) {
      nodeData.id = uuid()
      // Don't create a new node if it already exists
    } else if (this.nodes[nodeData.id]) {
      return this.nodes[nodeData.id]
    }
    nodeData.edges = []
    this.nodes[nodeData.id] = nodeData
    return nodeData
  }
github SomeoneWeird / bkrun / src / bkrun.js View on Github external
import uuid from 'uuid'
import 'colors'

import loadFile from './loadFile'
import promptForConfirm from './promptForConfirm'

import {
  setMetadata
} from './metadata'

import {
  getPipeline,
  deletePipeline
} from './pipeline'

const buildId = uuid().replace(/-/g, '')

let [ , , fileName, startIndex = 0 ] = process.argv

if (!fileName) {
  console.error('Please run again with a filename')
  process.exit(1)
}

let filePath = path.resolve(process.cwd(), fileName)

let file = loadFile(filePath)

if (!file.steps || file.steps.length === 0) {
  console.error('Oops, your pipeline doesn\'t seem to have any steps!')
  process.exit(1)
}
github bbc / simorgh / src / app / lib / utilities / preprocessor / rules / addIdsToItems.js View on Github external
const addIdToItem = ({ id, ...item }) => ({ ...item, id: id || uuid() });
github openmobilityfoundation / mds-core / packages / mds-provider / event-processor / index.ts View on Github external
const readStreamEntries = async (options: ReadStreamOptions) => {
  const [name, entries] = await stream.readStreamGroup('provider:event', 'event-processor', uuid(), '>', options)
  return {
    name,
    entries: entries.map(asStreamEntry)
  }
}
github ForbesLindesay / taxi-rank / src / browser-api.js View on Github external
function storeElement(element) {
    if (!element) {
      throwError(7, 'No element found');
    }
    const elementID = uuid();
    elements.set(elementID, element);
    return {ELEMENT: elementID};
  }
  const driver = {
github danielstern / express-react-fullstack / src / app / components / TaskDetail.jsx View on Github external
addTaskComment(taskID, ownerID, e) {
            let input = e.target[`commentContents`];
            let commentID = uuid();
            let content = input.value;
            e.preventDefault();
            if (content !== ``) {
                input.value = ``;
                dispatch(addTaskComment(commentID, taskID, ownerID, content));
            }
        }
    }
github aiham / webrtc-blockchain / client / src / Wallet.js View on Github external
.then(_keys => {
      id = uuid();
      keys = _keys;
      return Promise.all([
        CryptoHelper.export(keys.publicKey),
        CryptoHelper.export(keys.privateKey),
      ]);
    })
    .then(([ publicKey, privateKey ]) => ({ publicKey, privateKey }))
github guardian / support-frontend / support-frontend / assets / components / ctaLink / ctaLink.jsx View on Github external
export default function CtaLink(props: PropTypes) {

  const accessibilityHintId = props.id ? `accessibility-hint-${props.id}` : uuidv4();

  return (
    <a aria-describedby="{accessibilityHintId}" tabindex="{props.tabIndex}" href="{props.url}" id="{props.id}">
      <span>{props.text}</span>
      {props.svg}
      <p id="{accessibilityHintId}">{props.accessibilityHint}</p>
    </a>
  );
github helion3 / inspire-tree / src / dom.js View on Github external
createLoadingTextNode() {
        return new VCache({
            text: uuid()
        }, VStateCompare, function() {
            return h('li.leaf', [
                h('span.title.icon.icon-more', ['Loading...'])
            ]);
        });
    }
github tabixio / tabix / app / src / models / EditorTabModel.ts View on Github external
static from({
    id = uuid(),
    title,
    content = '',
    currentDatabase,
    pinnedResult = true,
  }: Partial&gt; &amp;
    Pick, 'title'&gt;): EditorTabModel {
    return new EditorTabModel({
      type: TabType.Editor,
      id,
      title,
      content,
      currentDatabase: Option.of(currentDatabase),
      codeEditor: None,
      queriesResult: None,
      pinnedResult,
      tableData: None,