return a new function for each getter

- defines the getters onto a proto
- the function returned has its __proto__ set to our proto

fixes #32
This commit is contained in:
Sean McArthur 2014-07-08 20:43:54 -07:00
parent 3073fa3110
commit 42918337e5
4 changed files with 34 additions and 6 deletions

View file

@ -11,6 +11,11 @@ suite('chalk', function () {
chalk.blue.bgRed.bold('the fox jumps over the lazy dog');
});
var cached = chalk.blue.bgRed.bold;
bench('cached styles', function () {
cached('the fox jumps over the lazy dog');
});
bench('nested styles', function () {
chalk.red('the fox jumps', chalk.underline.bgBlue('over the lazy dog') + '!');
});