vue.js源码学习分享(三)
/**
* Mix properties into target object.//把多个属性插入目标的对象
*/
function extend (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
} /**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.//检查是不是对象
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
} /**
* Strict object type check. Only returns true
* for plain JavaScript objects.//严格的对象检查
*/
var toString = Object.prototype.toString;
var OBJECT_STRING = '[object Object]';
function isPlainObject (obj) {
return toString.call(obj) === OBJECT_STRING
} /**
* Merge an Array of Objects into a single Object.//相当于复制一个数组
*/
function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
} /**
* Perform no operation.无操作
*/
function noop () {} /**
* Always return false.//总是返回false
*/
var no = function () { return false; }; /**
* Return same value//返回相同的值
*/
var identity = function (_) { return _; };
vue.js源码学习分享(三)的更多相关文章
- vue.js源码学习分享(一)
今天看了vue.js源码 发现非常不错,想一边看一遍写博客和大家分享 /** * Convert a value to a string that is actually rendered. *转换 ...
- vue.js源码学习分享(九)
/* */ var arrayKeys = Object.getOwnPropertyNames(arrayMethods);//获取arrayMethods的属性名称 /** * By defaul ...
- vue.js源码学习分享(七)
var _Set; /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) { // use ...
- vue.js源码学习分享(六)
/* */ /* globals MutationObserver *///全局变化观察者 // can we use __proto__?//我们能用__proto__吗? var hasProto ...
- vue.js源码学习分享(八)
/* */ var uid$1 = 0; /** * A dep is an observable that can have multiple * directives subscribing() ...
- vue.js源码学习分享(五)
//配置项var config = { /** * Option merge strategies (used in core/util/options)//选项合并策略 */ optionMerge ...
- vue.js源码学习分享(四)
/** * Generate a static keys string from compiler modules.//从编译器生成一个静态键字符串模块. */ function genStaticK ...
- vue.js源码学习分享(二)
/** * Check if value is primitive//检查该值是否是个原始值 */ function isPrimitive (value) { return typeof value ...
- Vue.js 源码构建(三)
Vue.js 源码是基于 Rollup 构建的,它的构建相关配置都在 scripts 目录下. 构建脚本 通常一个基于 NPM 托管的项目都会有一个 package.json 文件,它是对项目的描述文 ...
随机推荐
- Bootstrap历练实例:下拉菜单插件方法的使用
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- jenkins 全局工具配置
- 万门大学Python零基础10天进阶班视频教程
点击了解更多Python课程>>> 万门大学Python零基础10天进阶班视频教程 课程简介: 旨在通过两周的学习,让学生不仅能掌握python编程基础从而进行计算机程序的开发, 还 ...
- python GIL锁、进程池与线程池、同步异步
一.GIL全局解释器锁 全局解释器锁 在CPython中,全局解释器锁(GIL)是一个互斥锁,它可以防止多个本机线程同时执行Python代码.之所以需要这个锁,主要是因为CPython的内存管理不是线 ...
- PEP-8 规范1
代码布局 缩进 每个缩进级别使用4个空格. 延续线应使用Python的隐含线连接在括号,括号和大括号内,或使用悬挂缩进[7],垂直对齐包装元素.使用悬挂式凹痕时,应考虑以下因素;第一行应该没有参数,应 ...
- STM32三种启动模式 boot0 boot1
STM32三种启动模式对应的存储介质均是芯片内置的,它们是: 1)用户闪存=芯片内置的Flash.2)SRAM=芯片内置的RAM区,就是内存啦.3)系统存储器=芯片内部一块特定的区域,芯片出厂时在这个 ...
- phpmyadmin提示The mbstring extension is missing的解决方法
解决办法:安装php-mbstring yum install php-mbstring
- luogu1208 尼克的任务
倒着推就是了 #include <iostream> #include <cstdio> #include <vector> using namespace std ...
- selenium - Js处理滚动条操作
# 11.Js处理滚动条操作 driver.execute_script('arguments[0].scrollIntoView();',target) target 为find_element_b ...
- Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined)
我真的是太菜了 A. Perfect Squares time limit per test 1 second memory limit per test 256 megabytes input st ...