Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
oatkiller edited this page Sep 13, 2010 · 5 revisions

pass mask an object. it returns a new object with the passed object in its prototype

(function () {

var book = {
	title: 'Anna Karenina',
	author: 'Leo Tolstoy'
};

// my book appears to have all the same properties as book
var my_book = o.mask(book);

// book isn't altered. only my_book
my_book.notes = 'this book rocks';

book.notes; // undefined
my_book.notes; // 'this book rocks';
my_book.title; // 'Anna Karenina'

})();

details

you can virtually augment an object using mask.

Clone this wiki locally