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 🙏

© 2026 – Pkg Stats / Ryan Hefner

flow-vect

v0.9.0

Published

Statically typed Vect

Downloads

26

Readme

flow-vect

Statically typed Vect

npm

Installation

$ npm i flow-vect

Usage

// @flow

import {
  createVect,
  push,
  unshift,
  shift,
  head,
  append,
  index,
  indexOf,

  type Vect,
  type GetLength,
  type IsEmpty,
  type IsNotEmpty
} from 'flow-vect'


const vect = createVect() // Vect<0, string>   (type inferred from usage)
// or
//   createVect<string>()
//   createVect('str')

const vect1 = push('foo', vect) // Vect<1, string>
const vect2 = push('bar', vect1) // Vect<2, string>


type Length = GetLength<typeof vect2>
;(2: Length)
// $ExpectError
;(3: Length) // error


;(true: IsNotEmpty<typeof vect2>)
// $ExpectError
;(true: IsEmpty<typeof vect2>) // error

;(true: IsEmpty<typeof vect>)
;(false: IsEmpty<typeof vect1>)


console.log(vect2) //=> Vect

const vect22: Vect<2, string> = vect2


const [ value, vect11 ] = shift(vect22)
console.log(value) //=> 'foo'
;(1: GetLength<typeof vect11>)
;(vect11: Vect<1, string>)


const vect3 = unshift('abc', vect22)
;(vect3: Vect<3, string>)


const el = head(vect3)
;(el: string)
console.log(el) //=> 'abc'


const vect50 = append(vect22, (vect3: Vect<3, string>))
;(vect50: Vect<5, string>)


const el0 = index(1, vect22)
;(el0: string)
console.log('index', el0) //=> 'bar'


;(indexOf('bar', vect22): number | void)


function sum2 (vect: Vect<2, number>): number {
  const [x, xs] = shift(vect)
  const [y] = shift(xs)
  return x + y
}

See also index.test.js.

Functions:

  • createVect
  • push
  • pop
  • unshift
  • shift
  • head
  • last
  • append
  • index
  • indexOf
  • equals
  • isVect

Types:

  • Vect<N, T>
  • GetLength<V>
  • IsEmpty<V>
  • IsNotEmpty<V>
  • IsVect<V>