npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cueing

v0.3.1

Published

Cue, seek, or cycle items

Downloads

19

Readme

cueing ►►|

Cue, seek, or cycle items in JavaScript in node or the browser

npm

npm install cueing --save

Basic usage

var cueing = require('cueing')
var letters = cueing(['a', 'b', 'c'])

// cue the last index and then read from there
letters.cue(-1) // => letters
letters.seek(0) // => 'c'
letters.seek(1) // => 'a'

// manually move the needle
letters.needle(0)

// seek backwards
letters.seek(-1) // => 'c'

// seeking (or cueing) will loop around
letters.seek(-4) // => 'b'

API

cueing(pool=[])

  • Get a new cueing instance
  • pool: number|{length:number} length or array(-like) of values
  • cueing instance

cueing() instances are array-like and inherit array methods

var tracks = cueing(['1.mp3', '2.mp3', '3.mp3'])
tracks.join() // '1.mp3,2.mp3,3.mp3'
tracks instanceof cueing // true
tracks instanceof Array // true
Array.isArray(tracks) // false

cueing(3).every(function(v, i, range) {
  // Cueing objects are made dense for use with array iterators
  return undefined === v && i in range && range instanceof cueing
}) // true

cueing() objects coerce to their needle position

var cueing = require('cueing')
var list = cueing(['a', 'b', 'c'])
+list // 0
isFinite(list) // true
list.needle(2) // move the needle to a new index
2 == list // true
+list // 2
String(list) // '2'
list[list] // 'c'

cueing() methods

.needle(index?)

  • Manually move the needle to index
  • index: number|cueing destination index
  • this

.cue(offset=0)

  • Move the needle by offset
  • offset: number|cueing +/- integer to move the needle by
  • this

.seek(offset=0)

  • .cue the offset and get the value there
  • offset: number|cueing +/- integer to move the needle by
  • *

.store()

  • Store the current needle position for recalling later
  • this

.recall(index?)

  • Recall stored cue point(s)
  • index: number|cueing +/- index to read. 0 reads the oldest point. -1 reads the newest.
  • cueing instance at recalled state

.clear()

  • Clear stored cue points
  • this

.clone()

  • Clone (copy) a cueing instance at its current state to a new instance
  • cueing clone

Static methods

cueing.cue(pool, start=0, offset=0)

  • Get the pool index that is offset away from start
  • number
cueing.cue(['a', 'b', 'c'], -1) // => 2
cueing.cue(['a', 'b', 'c'], 1, -2) // => 2

cueing.seek(pool, start=0, offset=0)

  • Get the pool value that is offset away from start
  • *
cueing.seek(['a', 'b', 'c'], 1, -1) // => 'a'
cueing.seek(['a', 'b', 'c'], 0, 5) // => 'b'

cueing.store(array, point)

  • Push point onto array if different from last point
  • array reference
cueing.store([1, 5], 3) // => [1, 5, 3]
cueing.store([1, 5], 5) // => [1, 5]
cueing.store([1, 5], 1) // => [1, 5, 1]

Playground

Try cueing in the browser