How to use the shortid function in shortid

To help you get started, we’ve selected a few shortid 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 topcoder-platform / community-app / src / shared / containers / SubmissionPage.jsx View on Github external
getCommunitiesList: (auth) => {
      const uuid = shortId();
      dispatch(ca.getListInit(uuid));
      dispatch(ca.getListDone(uuid, auth));
    },
    submit: (tokenV3, tokenV2, submissionId, body, track) => {
github samuelmaddock / metastream / app / renderer / lobby / actions / mediaPlayer.ts View on Github external
try {
    res = await resolveMediaUrl(url)
  } catch (e) {
    console.error(e)
  }

  if (!res) {
    console.log(`Failed to fetch media for ${url}`)
    return null
  }

  console.log('Media response', res)

  const userId = context.client.id.toString()
  const media: IMediaItem = {
    id: shortid(),
    type: res.type,
    url: res.url,
    title: res.title || res.url,
    duration: res.duration,
    description: res.description,
    imageUrl: res.thumbnails && res.thumbnails[MediaThumbnailSize.Default],
    requestUrl: url,
    ownerId: userId,
    ownerName: getUserName(getState(), userId),
    hasMore: res.hasMore
  }

  if (res.state) {
    media.state = res.state
  }
github topcoder-platform / community-app / src / shared / containers / challenge-listing / Listing / index.jsx View on Github external
getReviewOpportunities: (page, token) => {
      const uuid = shortId();
      dispatch(a.getReviewOpportunitiesInit(uuid, page));
      dispatch(a.getReviewOpportunitiesDone(uuid, page, token));
    },
    selectBucket: bucket => dispatch(sa.selectBucket(bucket)),
github topcoder-platform / community-app / src / shared / components / Editor / MarkdownEditor / md-utils.js View on Github external
subTokens.forEach((st) => {
        switch (st.type) {
          case 'link_open': {
            const id = shortId().replace(/-/g, ':');
            this.hrefs[id] = st.attrs[0][1];
            styles.push(`a:${id}`);
            break;
          }

          case 'em_open':
          case 'strong_open':
            styles.push(st.tag);
            break;

          case 's_open':
            styles.push('strike');
            break;

          case 'em_close':
          case 'link_close':
github mjesuele / hitbtc-api-node / src / index.js View on Github external
cancelOrder = (params = {}) =>
    this.requestTrading(`/cancel_order`, `post`, {
      cancelRequestClientOrderId: shortid(),
      ...params,
    });
github johannesjo / super-productivity / src / app / features / bookmark / bookmark.service.ts View on Github external
addBookmark(bookmark: Bookmark) {
    this._store$.dispatch(new AddBookmark({
      bookmark: {
        ...bookmark,
        id: shortid()
      }
    }));
  }
github orbiting / publikator-frontend / components / editor / modules / teaser / index.js View on Github external
export const getData = data => ({
  url: null,
  textPosition: 'topleft',
  color: '#000',
  bgColor: '#fff',
  center: false,
  image: null,
  byline: null,
  kind: 'editorial',
  titleSize: 'standard',
  teaserType: 'frontImage',
  reverse: false,
  portrait: true,
  showImage: true,
  onlyImage: false,
  id: (data && data.id) || shortId(),
  ...data || {}
})
github johannesjo / super-productivity / src / app / tasks / task.reducer.ts View on Github external
return state.map((item) => {
        if (item.id === action.payload.id) {
          const updatedTask: Task = Object.assign({}, item);
          const newTask: Task = {
            id: shortid(),
            parentId: item.id,
            title: '',
            isDone: false
          };


          if (!updatedTask.subTasks) {
            updatedTask.subTasks = [newTask];
          } else {
            updatedTask.subTasks.push(newTask);
          }

          return updatedTask;
        } else {
          return item;
        }
github johannesjo / super-productivity / src / app / ui / duration / input-duration-slider / input-duration-slider.component.ts View on Github external
import * as moment from 'moment';
import {dotAnimation} from './dot.ani';
import {T} from '../../../t.const';

@Component({
  selector: 'input-duration-slider',
  templateUrl: './input-duration-slider.component.html',
  styleUrls: ['./input-duration-slider.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
  animations: [dotAnimation],
})
export class InputDurationSliderComponent implements OnInit, OnDestroy {
  T = T;
  minutesBefore = 0;
  dots: any[];
  uid: string = 'duration-input-slider' + shortid();
  el: HTMLElement;

  startHandler: (ev: any) => void;
  endHandler: () => void;
  moveHandler: (ev: any) => void;

  @ViewChild('circleEl', {static: true}) circleEl: ElementRef;

  @Input() label: string;
  @Output() modelChange: EventEmitter = new EventEmitter();

  constructor(
    private _el: ElementRef,
    private _cd: ChangeDetectorRef,
  ) {
    this.el = _el.nativeElement;
github vinz243 / cassette / src / server / models / job.js View on Github external
constructor(name, job) {
    this.name = name;
    this.id = shortid();
    this.progress = 0;
    this.status = {
      pending: true,
      string: 'pending'
    };
    this._job = job;
  }
  run() {

shortid

Amazingly short non-sequential url-friendly unique id generator.

MIT
Latest version published 4 years ago

Package Health Score

58 / 100
Full package analysis