From 288d7d623e603e5ee2d00bacaf82b14b235b5eb6 Mon Sep 17 00:00:00 2001 From: Damian Suarez Date: Thu, 6 Dec 2012 09:20:54 -0300 Subject: [PATCH] docs: add results for each example --- Readme.md | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index 4316939..b9d9ed8 100644 --- a/Readme.md +++ b/Readme.md @@ -37,37 +37,69 @@ var heroes = [ // returns an object with number key var heroesObject = toObject(heroes); +/* +{ + 0: { first: 'Manuel', last: 'Belgrano' }, + 1: { first: 'Juan Jose', last: 'San Martin' }, + 2: { first: 'Hipolito', last: 'Bouchard' }, + 3: { first: 'Martin Miguel', last: 'de Güemes' } +} +*/ // return an object with first value as key var heroesObject = toObject(heroes, 'first'); +/* +{ + 'Manuel': { first: 'Manuel', last: 'Belgrano' }, + 'Juan Jose': { first: 'Juan Jose', last: 'San Martin' }, + 'Hipolito': { first: 'Hipolito', last: 'Bouchard' }, + 'Martin Miguel': { first: 'Martin Miguel', last: 'de Güemes' } +} +*/ // return an object with first value as key and remove the key var heroesObject = toObject(heroes, 'first', true); +/* +{ + 'Manuel': { last: 'Belgrano' }, + 'Juan Jose': { last: 'San Martin' }, + 'Hipolito': { last: 'Bouchard' }, + 'Martin Miguel': { last: 'de Güemes' } +} +*/ // return an object with first value modified as key var heroesObject = toObject(heroes, 'first', function(key){ return key.toLowerCase().replace(/\s/i, '_'); }); +/* +{ + manuel: { first: 'Manuel', last: 'Belgrano' }, + juan_jose: { first: 'Juan Jose', last: 'San Martin' }, + hipolito: { first: 'Hipolito', last: 'Bouchard' }, + martin_miguel: { first: 'Martin Miguel', last: 'de Güemes' } +} +*/ ``` -## Running tests +## Tests -Make sure dependencies are installed: +Download testing dependecies ``` -$ npm install +npm install ``` -Then run: +Run tests ``` -$ make test +make test ``` # License (The MIT License) -Copyright(c) 2012 Damian Suarez +Copyright(c) 2012 Damian Suarez <rdsuarez@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the