kitsy
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

kitsy

Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags

Based on work by @mildmojo in bitsy-hacks

How to use

npm i kitsy

Example:

import { kitsy } from "kitsy";

// set up hooks/injections

kitsy.before('someGlobal.someFn', () => { console.log('before someGlobal.someFn') });
kitsy.after('someGlobal.someFn', () => { console.log('after someGlobal.someFn') });
kitsy.inject(/(some code)/, 'injected before some code $1 injected after some code');

// call
kitsy.applyInjects();
// between applying injections and hooks,
// reinitialize any globals that referred to injected code
kitsy.applyHooks();

Package Sidebar

Install

npm i kitsy

Weekly Downloads

16

Version

1.1.1

License

WTFPL

Unpacked Size

39.9 kB

Total Files

8

Last publish

Collaborators

  • seansleblanc