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

@speakingsoftware/anonimizer

v1.2.2

Published

A lib to anonimize text and later rehydrate derived text

Downloads

14

Readme

Description

The intended use is to sanitize input that will be passed to public 3rd-party Services, and then be able to replace the sanitized value in the output with the original safe values. A prime example of this would be creating prompts to send to ChatGPT (or similiar). See Use Case Example below.

Usage

Example

// Import via ESM
import { Anonimizer } from '@speakingsoftware/anonimizer'
// or Require via CJS
// const Anonimizer = require('@speakingsoftware/anonimizer').Anonimizer

// Create instance
const anonimizer = new Anonimizer();

/**
 * Anonimize
 * Pass the string to be sanitize, along as the list of features to be replaced.
 * Will return the sanitized version, and a map of what features/values were replaced.
 */
const featuresToReplace = new Array(Features.People, Features.Emails, Features.Urls, Features.HashTags);
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace);

/**
 * Rehydrate
 * Pass the string to to have the values rehydrated, as well as the map used in the original anonimzation.
 * Will return the text with sanitized values replaced with their original values.
 */
let rehydratedText = anonimizer.reHydrate(safeText, runValueMap);

Example Usecase

Original Prompt:

Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal.

Sanitized Prompt (via anonomize method) safe to send to 3rd/party Service:

Write an email to Ava asking them to email Benjamin at [email protected] to call Charlotte about getting that PO sorted. Also ask about the progress of the #Alligator Deal.

Response from 3rd-party Service:

Dear Ava, I hope this email finds you well. I have an important request on behalf of Charlotte from our team. Charlotte would greatly appreciate it if you could reach out to Benjamin at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently. Additionally, Charlotte would like to inquire about the progress and any updates regarding the #Alligator Deal. She would like to stay informed and ensure everything is on track. Best Regards,

Context and values restored, via the reHydrate method:

Dear Jim, I hope this email finds you well. I have an important request on behalf of Maria from our team. Maria would greatly appreciate it if you could reach out to Philip at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently. Additionally, Maria would like to inquire about the progress and any updates regarding the #Acquisition Deal. She would like to stay informed and ensure everything is on track. Best Regards,

From Source

Build

npm i
npm run build

Test

npm run test

Warning

Please always review the data you store and send to 3rd party systems, to ensure the transit and storage complies with the legal requirements for your jurisdiction, industry and business obligations. The author(s) of this library take no responsibility nor accept any liability for any loss that may occur from either correct or incorrect usage of this library.