A Pairtree (https://wiki.ucop.edu/display/Curation/PairTree) JavaScript library that borrows heavily from https://github.com/edsu/ptree.
Usage:
var path = pairtree.path('someId');
var id = pairtree.id('/so/me/pa/ir/tr/ee/pa/th/');
For examples, see the test directory.