售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Learning Underscore.js
Table of Contents
Learning Underscore.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Underscore.js
Why Underscore
Getting started with Underscore by example
The ECMAScript 5 starter example
The Underscore find starter example
The Underscore countBy starter example
Key Underscore functions
Underscore each
Underscore map and reduce
Functional programming fundamentals
Useful patterns and practices for JavaScript applications targeting ECMAScript 5
The immediately-invoked function expression
The revealing module pattern
The JavaScript strict mode
Setting up a development workflow for exploring Underscore
Modern JavaScript development with Node.js
Windows
Mac OS X
Linux
Verifying Node.js installation
Managing JavaScript dependencies with Bower
Choosing a JavaScript editor
Testing JavaScript code with Jasmine
Jasmine introduction
Adding tests using the default Jasmine infrastructure
Summary
2. Using Underscore.js with Collections
Key Underscore functions revisited – each, map, and reduce
Applying reflection techniques
Manipulating the this variable
Using map and reduce with object properties
Searching and filtering
Searching
Underscore find
Underscore some
Underscore findWhere
Underscore contains
Filtering
Underscore filter
Underscore where
Underscore reject and partition
Underscore every
Aggregations and transformations
Aggregations
Underscore max and min
Transformations
Underscore sortBy
Underscore groupBy
Underscore indexBy
Underscore countBy
Other collection-based functions
Summary
3. Using Underscore.js with Arrays, Objects, and Functions
Arrays
Extracting array start and end sequences
Union, intersect, and related functions
Other array-related functions
Objects
Underscore keys
Underscore values and pairs
Underscore invert and functions
Underscore pick, omit, and has
Underscore extend, clone, and defaults
Underscore has, property, propertyOf, and matcher
Comparing objects and making assertions against objects
Other object-related functions
Functions
Functional composition with bind, bindAll, and partial
Further functional composition with memoize, wrap, negate, and compose
Controlling when and how often functions are called
Utility functions
Summary
4. Programming Paradigms with Underscore.js
The object-oriented programming paradigm
Inheritance with object literals
Inheritance with object constructors
Using Underscore with the object-oriented programming paradigm
Using classes with original client data
Constructor validation with Underscore
The functional programming paradigm
Migrating to a functional programming style
Functional programming with Underscore.js
Summary
5. Using Underscore.js in the Browser, on the Server, and with the Database
Using Underscore in the browser
Enhancing examples output with Bootstrap
Better HTML markup with Underscore templates
Using Underscore on the server with Node.js
Executing JavaScript with Node.js
Using Node.js modules
Locating modules
Creating a npm package
Converting JavaScript code to Node.js modules
Running tests with Node.js
Using Underscore with MongoDB
Installing and configuring MongoDB
Installing MongoDB on Windows
Installing MongoDB on Ubuntu Linux
Installing MongoDB on Mac OS X
Configuring and running MongoDB
Creating initial data using the MongoDB client and Underscore
Asynchronous programming in Node.js
Accessing data using the MongoDB Node.js driver
Using Underscore with PostgreSQL
Installing and configuring PostgreSQL
Installing PostgreSQL on Windows
Installing PostgreSQL on Ubuntu Linux
Installing PostgreSQL on Mac OS X
Using psql with basic database commands
PostgreSQL data types
SQL types
The jsonb type
Using PostgreSQL with plv8
Generating data using plv8 and Underscore
Summary
6. Related Underscore.js Libraries and ECMAScript Standards
Using the Underscore-contrib library
An overview of Underscore-contrib functionality
Exploring Underscore-contrib via examples
Using the lodash library
An overview of lodash functionality
Migrating a project from Underscore to lodash
Underscore and JavaScript standards
ECMAScript 5.1 (ES5)
ECMAScript 2015 (ES6)
Array – new features
Other notable new features
Using ECMAScript 2015 (ES6) today with transpilers
Using Babel directly in the browser
An overview of Babel CLI
Using Babel CLI for the client-side code
Using Babel with Node.js
ECMAScript 2015 (ES6) by example
Testing ES6 code
Further ES6 examples – the arrow function
Further ES6 examples – function declaration improvements
Summary
7. Underscore.js Build Automation and Code Reusability
Build automation with Gulp
Reusing code based on Underscore between client and server
Using CommonJS modules for packaging client code with Browserify
Testing CommonJS modules in the browser with Browserify
Using Gulp with Browserify
Adding ECMAScript 2015 (ES6) support to Browserify
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜