万本电子书0元读

万本电子书0元读

顶部广告

Learning Underscore.js电子书

售       价:¥

4人正在读 | 0人评论 9.8

作       者:Alex Pop

出  版  社:Packt Publishing

出版时间:2015-10-30

字       数:200.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Explore the Underscore.js library by example using a test-driven development approachAbout This BookUnderstand and learn to apply functional programming principles using the built-in functions of Underscore.jsLeverage and reuse Underscore.js-based code to create code that targets client, server, or database contextsTake Underscore.js further by reusing code between client and server and by learning about other closely related libraries Who This Book Is For If you are a developer with fundamental JavaScript knowledge and want to use modern JavaScript libraries to extend your functional programming skills, then Underscore.js is an important library you should be familiar with.What You Will LearnReference and call Underscore.js functions using a modern JavaScript development workflowApply Underscore.js to JavaScript arrays, objects, and functionsTake advantage of object-oriented or functional programming techniques with Underscore.jsLeverage Underscore.js to create code that targets client, server, or database contextsExtend Underscore.js functionality with other closely related librariesReuse Underscore.js-based code between client and server applicationsPrepare for the upcoming JavaScript standard ECMAScript 6 and support older browsers In Detail Underscore.js is one of the most popular modern JavaScript libraries used for functional programming. It can be used as a base for building complex JavaScript applications in a sustainable manner and for building other JavaScript libraries. It embraces functional programming principles but is not opinionated and can be used with imperative, object-oriented, functional, or other programming styles. This book explores how to use Underscore.js to power your code and understand modern JavaScript development concepts while applying a lightweight and efficient workflow to build applications. The book starts with an incremental Underscore.js introduction by exploring key JavaScript concepts. You will then explore the basic features of Underscore.js in action and establish a lightweight development workflow that allows the provided examples to be guided by tests. The book then covers the functionality of Underscore.js with in-depth examples and explanations for understanding and applying the Underscore.js API. You'll also learn how to use Underscore.js as a base for your own modules and libraries within an object-oriented or functional programming style, and will be able to explore Underscore.js use cases in different environments. Eventually, you'll learn about libraries that are closely related with Underscore.js, how to share code between client and server, and how to prepare for the upcoming JavaScript standard ECMAScript 6.Style and approach This book takes an example-driven approach to describing some of the essential JavaScript concepts and practices that are useful for building sustainable applications.
目录展开

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部