How to use just-shuffle - 2 common examples

To help you get started, we’ve selected a few just-shuffle 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 puckey / dance-tonite / src / storage.js View on Github external
const loadPlaylist = async () => {
  let data;
  if (process.env.FLAVOR === 'cms') {
    const response = await cms.getDraftPlaylist();
    data = response.data;
  } else {
    const response = await fetch(`${settings.playlistsUrl}playlist.json`);
    data = await response.json();
  }
  const playlist = data.playlist;
  const megaGrid = data.megagrid
    ? shuffle(data.megagrid)
    : null;
  const list = [];
  let megaGridIndex = 0;
  for (let i = 0; i < layout.roomCount; i++) {
    const entry = layout.insideMegaGrid(i)
      ? megaGrid
        ? megaGrid[megaGridIndex++ % megaGrid.length]
        : null
      : playlist.shift();
    list.push(entry);
  }
  return list;
};
github puckey / dance-tonite / src / components / ThanksTimeline / index.js View on Github external
const { room } = this.context;
      if (!room) return;
      const count = room.frame.count;
      if (!count) return;
      return (
        room &&
        room.getHeadPosition(
          index !== undefined
            ? (index + Math.floor(audio.totalProgress * 0.5)) % count
            : count - 1
        )
      );
    };
    let time = 0;
    const randomIndex = () => Math.floor(Math.random() * 100);
    const compliments = shuffle([
      'Nice moves.',
      'Killer steps.',
      'Sh.. Sh.. Shake it!',
      'So elegant.',
      'Remarkable.',
      'You monster, you!',
      'Cut that rug up!',
      'Exactly!',
      'Yes!',
      'You the best!',
      'Yes. Yes. Yes!',
      'Get your freak on.',
      'Loved this bit.',
      'E-l-e-c-t-r-i-f-y-i-n-g!',
      'Put that foot down.',
      'Get down with it.',

just-shuffle

return the elements of an array in random order

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis

Popular just-shuffle functions