Skip to content

Latest commit

 

History

History
67 lines (55 loc) · 6.01 KB

README.md

File metadata and controls

67 lines (55 loc) · 6.01 KB

underscorejs-examples

##NOTE Currently the npm and bower packages are commited to source control but I plan to make a branch available that does not contain these packages.

##Overview This repository contains the examples for my book "Learning Underscore.js".

The folders and examples are named in such a way they can be explored outside of the book context.

If these examples prove useful to the community I intend to create a branch after the book is finished (or even a separate fork) and accept further additions or even significant changes unrelated to the content of the book.

##Examples index The examples are organised in these sections (that match a specific chapter of the book):

Getting started (Chapter 1: Getting started with Underscore.js)

  1. Starter example with ECMAScript 5 - code, preview
  2. Starter example with _.find() - code, preview
  3. Starter example with _.countBy() - code, preview
  4. Examples for _.map() and _.reduce() - code, preview
  5. Examples for _.map() and _.reduce() with IIFE (immediately invoked function expression) - code, preview
  6. Revealing module pattern - code, preview
  7. Examples for _.map() and _.reduce() with revealing module pattern - code, preview
  8. Examples for _.map() and _.reduce() with local dependencies via Bower - code
  9. Example for _.map() and _.reduce() with Jasmine tests - code

Collections (Chapter 2: Using Underscore.js with collections)

  1. Examples for _.each() using object properties and set context - code
  2. Examples for _.map() and _.reduce() using object properties - code
  3. Searching examples using _.find(), _.some(), _.findWhere(), _.contains - code
  4. Filtering examples using _.filter(), _.where(), _.reject() - code
  5. Aggregations examples using _.min() and _.max() - code
  6. Transformations examples using _.sortBy(), _.groupBy(), _.indexBy(), _.countBy - code

Arrays, functions and objects (Chapter3: Using Underscore.js with arrays, functions and objects)

  1. Arrays examples using _.first(), _.rest(), _.last(), _.initial(), _.union(), _.uniq(), _.intersection(), _.difference(), _.zip() - code
  2. Objects examples using _.keys(), _.pairs(), _.functions(), _.pick(), _.omit() - code
  3. Object assertions using _.isX() functions like. _.isNumber(), _isNull() and others - code
  4. Functions example using _.bind() - preview
  5. Functions examples using _.partial(), _.wrap() - code

OOP and FP paradigms (Chapter 4: Programming paradigms with Underscore.js)

  1. Object inheritance examples with ECMAScript 5 - code
  2. Classes and validation examples with Underscore - code
  3. Adopting a functional programming(FP) style - code
  4. FP examples using _.chain(), value(), _.tap() - code

Browser, Node.js and database examples (Chapter 5: Using Underscore.js in the browser, on the server, and with the database)

  1. Browser examples using _.template() with different styles of templates - code
  2. Examples of Node.js modules - code
  3. Examples of JavaScript code converted to Node.js modules and tests for Node.js modules - code
  4. Examples for using Underscore with MongoDB - code
  5. Examples for using Underscore with PostgreSQL - code

Advanced topics part 1 (Chapter 6: Related Underscore.js libraries and ECMAScript standards)

  1. Underscore-contrib examples - code
  2. lodash examples - code
  3. Using ES6 with Babel directly in browsers - code
  4. Using ES6 with Babel CLI in browsers - code
  5. Using ES6 with Babel CLI in Node.js - code
  6. Starter ES6 examples with ES6 tests (in a project using Babel CLI for code execution and jasmine-es6 for testing) - code

Advanced topics part 2 (Chapter 7: Underscore.js build automation and code reusability)

  1. Using Gulp.js to automate the preview and test of an existing example - code
  2. Using Browserify to enable CommonJS modules that are reusable between client and server for an existing example - code
  3. Using Browserify and Babel to enable ES6 modules that are reusable between client and server for an existing example - code