UnderScore 第一步 call(this)

 (function() {}.call(this));

一些简单的初始化操作

 (function() {
  var root = this;
  var previousUnderscore = root._;

var ArrayProto = Array.prototype,
  ObjProto = Object.prototype,
  FuncProto = Function.prototype;
var
  push = ArrayProto.push,
  slice = ArrayProto.slice,
  concat = ArrayProto.concat,
  toString = ObjProto.toString,
  hasOwnProperty = ObjProto.hasOwnProperty;

var nativeIsArray = Array.isArray,
  nativeKeys = Object.keys,
  nativeBind = FuncProto.bind;

  }.call(this));

下划线出场 创建对象

var _ = function(obj) {
  if (obj instanceof _) return obj;
  if (!(this instanceof _)) return new _(obj);
  //this._wrapped = obj;  //do not need this at first.
};

JavaScript - UnderScore的更多相关文章

  1. javascript - Underscore 与 函数式编程

    <Javascript函数式编程 PDF> # csdn下载地址http://download.csdn.net/detail/tssxm/9713727 Underscore # git ...

  2. Underscore.js(JavaScript对象操作方法)

    Underscore封装了常用的JavaScript对象操作方法,用于提高开发效率.(Underscore还可以被使用在Node.js运行环境.) 在学习Underscore之前,你应该先保存它的AP ...

  3. (1)Underscore.js入门

    1. Underscore对象封装 Underscore并没有在原生的JavaScript对象原型中进行扩展,而是像jQuery一样,将数据封装在一个自定义对象中(下文中称"Undersco ...

  4. 深入解析Backbone.js框架的依赖库Underscore.js的作用

    这篇文章主要介绍了深入解析Backbone.js框架的依赖库Underscore.js的作用,用过Node.js的朋友对Underscore一定不会陌生:)需要的朋友可以参考下 backbone必须依 ...

  5. 【跟着子迟品 underscore】JavaScript 数组展开以及重要的内部方法 flatten

    Why underscore (觉得这一段眼熟的童鞋可以直接跳到正文了...) 最近开始看 underscore.js 源码,并将 underscore.js 源码解读 放在了我的 2016 计划中. ...

  6. 【跟着子迟品 underscore】JavaScript 中如何判断两个元素是否 "相同"

    Why underscore 最近开始看 underscore.js 源码,并将 underscore.js 源码解读 放在了我的 2016 计划中. 阅读一些著名框架类库的源码,就好像和一个个大师对 ...

  7. 前端笔记之JavaScript面向对象(三)初识ES6&underscore.js&EChart.js&设计模式&贪吃蛇开发

    一.ES6语法 ES6中对数组新增了几个函数:map().filter().reduce() ES5新增的forEach(). 都是一些语法糖. 1.1 forEach()遍历数组 forEach() ...

  8. 【JavaScript】underscore

    例: 'use strict'; _.map([1, 2, 3], (x) => x * x); // [1, 4, 9] No1: [every/some] 当集合的所有元素都满足条件时,_. ...

  9. underscore javascript工具库支持seajs模块化

    underscore是一个很有用的js工具库,但是好像默认不支持seajs模块化 新建一个文件例如叫做xx.js 谈后,键入 define(function(require,exports,modul ...

随机推荐

  1. supervisor的配置

    看了下文档,比较多.http://www.supervisord.org/ 抱着试试又不会怀孕的心态,trying,碰了几鼻子灰,记录如下, 方便大家 1. 安装 easy_install super ...

  2. 【云计算】qcow2虚拟磁盘映像转化为vmdk

    Software QEMU emulator version 1.7.0 Introduction Since we use VmWare in my company, I started to pl ...

  3. VS 2012: Post build 中使用 Signtool.exe,对于特殊password中字符的处理方法

    众所周知,在VS(Visual Studio)里面可以利用post build 进行一些类似于CMD或者批处理的操作. 最近的项目中用到了MicroSoft的SignTool工具,目的是要把一个数字签 ...

  4. C#析构函数与垃圾回收

    析构函数基本语法 C# class Car { ~ Car() // destructor { // cleanup statements... } } 析构函数说明 不能在结构中定义析构函数.只能对 ...

  5. 基于MATLAB的离散小波变换

    申明,本文非笔者原创,原文转载自:  基于Matlab的离散小波变换         http://blog.sina.com.cn/s/blog_725866260100ryh3.html 简介 在 ...

  6. jq鼠标隐藏显示的方法

    <div style="width:300px; float:left;">        <div onmouseover="testOnmouseO ...

  7. 【leetcode】Maximal Rectangle

    Maximal Rectangle Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle conta ...

  8. POJ 3728

    http://poj.org/problem?id=3278 题目大意就是在同一坐标轴上给你一个人的坐标,一个牛的坐标,而人的运动每一次运动有三种方式,一种是后退1,一种是前进1,还有一种是坐标翻倍, ...

  9. Unity3d《Shader篇》绘制圆角图片

    Pass { CGPROGRAM // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a s ...

  10. DB2用一张表更新其他表的数据

    表结构: CREATE TABLE ATEST  (ID    INTEGER,   NAME  VARCHAR(256),   CODE  INTEGER,   NAME2 VARCHAR(256) ...