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

@adamduffy/anonymize

v1.0.1

Published

Anonymize a SQL database

Downloads

7

Readme

anonymize

Anonymize a SQL database (currently only postgresql)

simple usage

./anonymize.sh [psql_command] [config_filename]

see anonymize.sh for implementation details.

how it works

anonymize will analyze your sql schema to generate a set of update statements and apply to the given database. All nullable fields become null, all character based fields become CONCAT(table_name, column_name, id), all numerics become 1, etc. primary key fields and relationships will remain intact. there is only one update statement per table (i.e. bulk update). defaults and specific table/column values can be customized.

configuration

anonymize requires a config file to run (example provided). the config is a javascript object that consists of 3 parts:

  1. _default_type_values format: [ {types: [string], value: string}, ... ]. types is a list of sql data types, value is a sql expression.
  2. _skip_all format: {tables: [string], types: [string], columns: [string]}. skips anonymizing specified tables, types, or columns.
  3. custom table and column values: format: table_name: {column_name: value, ...}. value must be a sql expression that will apply to all rows in the column. optional: table_name: {_skip: [string]} to skip specified columns.

when working with the config file, keep in mind you can and should use raw sql statements on the value properties. for example: {email: "CONCAT('user', id, '@domain.com')"} will be per row, whereas {email: 'user${id}@domain.com'} will be per table (and id is undefined).

debugging

anonymize.sh is a three step process:

  1. generate the schema template json.
  2. generate the update statements.
  3. apply the update statements.

these can be broken down during initial setup and debugging:

  1. psql -d my_database -t -c "$(node anonymize.js -gen postgres)" > _schema.json should create a recognizable json file of your schema
  2. node anonymize.js _schema.json ./config.js > _updates.sql should generate a list of update statements.
  3. psql -d my_database -c "$(cat _updates.sql)" should run the updates.