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 🙏

© 2024 – Pkg Stats / Ryan Hefner

well-id-formatter

v1.2.4

Published

Convert between well ID formats. For example: A1 => A01

Downloads

20

Readme

well-id-formatter

:star2: Supports Well IDs from 384-, 96-, 48-, 24-, 12- and 6-well-plates :star2:

wellIDFormatter(inputWells, toFormat, plateSize = null)

inputWells: string, number, strings array or numbers array

toFormat: "padded", "unpadded", "number", "row" or "col"

plateSize : null, 6, 12, 24, 48, 96 or 384

Install

$ npm install well-id-formatter

Usage

import { wellIDFormatter, getPlate, getPlateWells } from "well-id-formatter";

//wellIDFormatter converts between different well ID formats

wellIDFormatter(["A1", "A12"], "padded"); // => ['A01', 'A12']
wellIDFormatter(["A01", "A12"], "unpadded"); // => ['A1', 'A12']
wellIDFormatter(["A01", "A12"], "row"); // => ['A', 'A']
wellIDFormatter(["A1", "A12"], "col"); // => ['1', '12']
wellIDFormatter(["A1", "A12"], "number", 96); // => ['1','12']

//plateSize required for number formatting
wellIDFormatter(["A1", "A2", "B1", "B12"], "number", 96); // => ['1', '2', '13', '24']
wellIDFormatter(["A1", "A2", "B1", "B12"], "number", 384); // => ['1', '2', '25', '36']
wellIDFormatter(["A1", "A2", "B1", "B12"], "number"); // => [null, null, null, null]
wellIDFormatter([1, 2, 13, 24], "padded", 96); // => ["A01", "A02", "B01", "B12"]

//plateSize provides stricter conversions
wellIDFormatter(["A1", "P12"], "padded"); // => ['A01','P12']
wellIDFormatter(["A1", "P12"], "padded", 96); // => ['A01',null] 'P12' does not exist in 96-well plate

//unrecognized formats return null
wellIDFormatter([null, undefined, "-", "A1"], "padded"); // => [null, null, null, "A01"]

//also accepts single well IDs
wellIDFormatter("J20", "number", 384); // => 236
wellIDFormatter(236, "row", 384); // => "J"

//getPlate(plateSize)
getPlate(6);
// =>
// [
//   { padded: 'A01', unpadded: 'A1', number: '1', row: 'A', column: '1' },
//   { padded: 'A02', unpadded: 'A2', number: '2', row: 'A', column: '2' },
//   { padded: 'A03', unpadded: 'A3', number: '3', row: 'A', column: '3' },
//   { padded: 'B01', unpadded: 'B1', number: '4', row: 'B', column: '1' },
//   { padded: 'B02', unpadded: 'B2', number: '5', row: 'B', column: '2' },
//   { padded: 'B03', unpadded: 'B3', number: '6', row: 'B', column: '3' }
// ]

//getPlateWells(plateSize, format)
getPlateWells(6, "padded"); // => [ 'A01', 'A02', 'A03', 'B01', 'B02', 'B03' ]
getPlateWells(6, "all_rows"); // => [ 'A', 'A', 'A', 'B', 'B', 'B' ]
getPlateWells(6, "unique_rows"); // => ['A', 'B']
// accepted formats = 'padded', 'unpadded', 'all_columns', 'unique_columns', 'all_rows', 'unique_rows' or 'number'

For Browser and NodeJS

Zero Dependencies!