Nero Punished Miscreants
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


0.4.7 • Public • Published

µ - Microbe - 0.4.6

Join the chat at

microbe is a javascript library to aid in DOM manipulation as well as facilitating events, object observation, and data binding. It uses the micro character ( µ ) that is accessible in:

  • osx: alt-m
  • windows: alt+0181
  • linux: alt gr+m or alt+230

microbe aims to be modular and expandable. It’s separated into several modules:

  • Selector engine with CSS4 selector support and base functions (find, filter, siblings, children, … )

  • Core helpers (class, extend, text, attributes … )

  • DOM helpers (append, insertAfter, prepend … )

  • Type helpers(isUnidentified, isArray, isWindow, … )

  • HTTP helpers making use of Promises (get, post, … )

  • Object.observe watches objects for changes. It can also watch itself for changes in element get/set data

  • Events - binding and emitting custom events

  • See the full list in the docs

microbes are always array-like for consistency and can be extended and merged very easily.

Don’t hesitate to file issues and features requests! Or change things yourself and send a pull request.


  • require( 'microbejs' ); or
  • include microbe.js or microbe.min.js in a script tag

Example use

// all divs on the page
var µDivs = µ( 'div' ) ;
// create a div with the class example--class
var newDiv = µ( '<div.example--class>' );
// all divs get a newDiv or a clone of newDiv inserted into the DOM after them
µDivs.insertAfter( newDiv );
// watches the class of each div
µDivs.observe( 'class', function( e )
    console.log( 'your class changed' );
} );
// gives the class example--class to each div also triggers the observe fuctions
µDivs.addClass( 'example--class' );
// sets a custom event watch
µDivs.on( 'toTheMoon', function( e )
    console.log( e.detail );
} );
// emits a custom event to all elements in µDivs with a custom data packet.
// triggers the event listener to show the sent data
µDivs.emit( 'toTheMoon', { moon : 'close' } );

Dev Installation

  • Clone repo
  • Make sure npm is installed
  • npm install
  • npm start

Compiling the dist files

  • microbe.js npm run gulp or npm run microbe
  • microbe.selectorEngine.js npm run selectorEngine
  • microbe.toolkit.js npm run toolkit

Generating www docs

  • npm run docs (this command will watch for changes)


We gladly accept and review any pull-requests. Feel free! ❤️

Otherwise, if you just want to talk, we are very easy to get a hold of!

This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.

Microbe - Code of Conduct

Need to report something?

Change log


  • updated readme with how to use the µ symbol
  • copy and logo changes on ./www
  • regenerated doc
  • updated gulpfile


  • moved functions and structure to enable modular building


  • updated remove
  • core and dom now check before they use something from a different module
  • updated readme, gulpfile, tests, docs, and comments
  • selectorEngine utils split into core and root
  • cytoplasm now accepts html strings for element creation (single or multiple elements)
  • selector strings of multiple classes are now 10x faster
  • code cleaned of unused variables
  • many push replaces with null -> filter
  • iteration abstracted
  • changed internal structure to allow for closed array.prototype use
  • added contact info to readme


  • upgraded tests
  • fixed bugs with setting falsey values into text/html
  • fixed bugs with selection by id
  • updated copy on site and readme
  • added code of conduct and contact email


  • cross browser compatability fixes


  • namespace bug fixed in Observe Utils shim
  • selector engine abstracted
  • modular building now supported
  • fixed a bug in find that left illegal whitespace


  • speed fixes
  • automated version scaling in static pages
  • append and prepend now accept html
  • prepend tweaks and docs
  • custom nth selectors now support 'even' and 'odd' keywords
  • .root() removed; :root simplified


  • many more comparative speed test
  • children and siblings speed fixes
  • init support for HTML collections
  • pseudo selector speed improvements
  • fixed an issue in .match() that incorrectly detected forms as arrays


  • speed fixes
  • extend updated
  • upgrades to .off() event removal
  • updated gulp file for inclusion of liscence


  • small bug fixes
  • updated documantation and tests
  • speed updates
  • added filter by function
  • updated find to include elements not in the dom


  • more consistent documentation
  • more consistent output
  • updated filter method
  • updated find method
  • support for css4 selectors
  • µ.matches for css selector matching
  • depreciated selector generation
  • fixed a bug in microbe creation when the scope was a microbe
  • many core speed fixes


  • added debounce
  • added insertStyle
  • added once
  • added poll
  • added prepend
  • added removeStyle
  • added removeStyles
  • addClass now accepts className strings
  • removeClass now accepts className strings and arrays
  • attr now accepts objects
  • html now accepts microbes
  • many documentation updates


  • added pseudo selector support
  • added filter function
  • added find function
  • many documentation updates

No one should be using less than 0.3 Changes past that will be posted here.


npm i microbejs

Downloadsweekly downloads









last publish


  • avatar
  • avatar