自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

魔豆(Magicbean)的博客

分享计算机专业的相关知识

  • 博客(777)
  • 收藏
  • 关注

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格13:语法

TypeScript语言规范A 语法A.1 类型A.2 表达式A.3 语句A.4 函数A.5 接口A.6 类A.7 枚举A.8 命名空间A.9 Script和ModulesA.10 AmbientA 语法本附录包含在主文档中找到的语法摘要。 如2.1节所述,TypeScript语法是ECMAScript 2015语言规范(特别是ECMA-262标准,第6版)中定义的语法的超集,本附录仅列出从ECMAScript语法中新增或修改的产品。A.1 类型TypeParameters: < TypeP

2020-06-01 17:37:55 486

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格12:Ambients

TypeScript语言规范12 Ambients12.1 Ambients声明12.1.1 Ambient变量声明12.1.2 Ambient函数声明12.1.3 Ambient类声明12.1.4 Ambient枚举声明12.1.5 Ambient命名空间声明12.2 Ambient模块声明12 Ambients环境声明用于在现有JavaScript代码上提供静态类型。 环境声明与常规声明的不同之处在于,不会为它们生成JavaScript代码。 环境声明不是引入新的变量,函数,类,枚举或命名空间,而是

2020-06-01 17:36:08 464

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格11:Script和Modules

TypeScript语言规范11 Scripts和Modules11.1 程序和源文件11.1.1 源文件依赖11.2 Script11.3 Modules11.3.1 Module命名11.3.2 导入声明11.3.3 Import Require声明11.3.4 Export声明11.3.4.1 Export修饰符11.3.4.2 Export Default声明11.3.4.3 Export list声明11.3.4.4 导出成员集11.3.5 Export赋值11.3.6 CommonJS模块11.

2020-06-01 17:34:33 569

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格10:命名空间

TypeScript语言规范10 命名空间10.1 命名空间声明10.2 命名空间体10.3 导入别名声明10.4 导出声明10.5 声明合并10.6 代码生成10 命名空间命名空间提供了一种在命名容器的层次结构中组织代码和声明的机制。 命名空间具有命名的成员,每个成员表示一个值,一个类型或一个命名空间,或其某种组合,这些成员可以是本地的也可以是导出的。 命名空间的主体对应于一次执行的功能,从而提供了一种机制,用于确保局部状态并确保隔离。 命名空间可以看作是立即调用的函数表达(IIFE)模式的形式化形式

2020-06-01 17:32:46 346

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格9:枚举

TypeScript语言规范9 枚举9.1 枚举声明9.2 枚举成员9.3 声明合并9.4 常量枚举声明9.5 代码生成9 枚举枚举类型是Number原语类型的独特子类型,具有一组关联的命名常量,这些常量定义了枚举类型的可能值。9.1 枚举声明枚举声明声明一个枚举类型和一个枚举对象。EnumDeclaration: constopt enum BindingIdentifier { EnumBodyopt }EnumDeclaration在包含的声明空间中引入了命名类型(枚举类型)和命名值(

2020-06-01 17:31:34 332

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格8:类

TypeScript语言规范8 类8.1 类声明8.1.1 类继承规范8.1.2 类体8.2 成员8.2.1 实例成员和静态成员8.2.2 可访问性8.2.3 继承和重置8.2.4 class类型8.2.5 构造函数类型8.3 构造函数声明8.3.1 构造函数参数8.3.2 超类调用8.3.3 自动构造函数8.4 属性成员函数声明8.4.1 成员变量声明8.4.2 成员函数声明8.4.3 成员访问者声明8.4.4 动态属性声明8.5 索引成员声明8.6 装饰者8.7 代码生成8.7.1 无extends从句

2020-06-01 17:29:47 275

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格7:接口

TypeScript语言规范7 接口7.1 接口声明7.2 声明合并7.3 接口扩展类7.4 动态类型检查7 接口接口提供了命名和参数化对象类型并将现有命名对象类型组合为新对象的能力。接口没有运行时表示—它们纯粹是编译时构造。 接口对于记录和验证所需的属性形状,作为参数传递的对象以及从函数返回的对象特别有用。因为TypeScript具有结构类型系统,所以具有一组特定成员的接口类型被认为与具有相同成员组的另一个接口类型或对象类型文字相同(并且可以替代)(请参阅第3.11.2节)。类声明可以在自己的I

2020-06-01 17:28:32 272

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格6:函数

TypeScript语言规范6 函数6.1 函数声明6.2 函数重载6.3 函数实现6.4 析构参数声明6.5 通用函数6.6 代码生成6.7 生成函数6.8 异步函数6.9 类型保护函数6 函数TypeScript扩展了JavaScript函数,以包括类型参数,参数和返回类型注释,重载,默认参数值和rest参数。6.1 函数声明扩展了函数声明,以允许在重载声明中省略函数主体。FunctionDeclaration: ( Modified ) function BindingIdentifier

2020-06-01 17:26:38 318

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格5:语句

TypeScript语言规范5 语句5.1 块5.2 变量语句5.2.1 简单变量声明5.2.2 析构变量声明5.2.3 implied类型5.3 let和const声明5.4 If,Do和While语句5.5 for语句5.6 for-in语句5.7 For-of语句5.8 Continue语句5.9 Break语句5.10 Return语句5.11 With语句5.12 Switch语句5.13 Throw语句5.14 Try语句5 语句本章介绍TypeScript为JavaScript语句提供的静

2020-06-01 17:24:58 1194

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格4:表达式

TypeScript语言规范4 表达式4.1 值和引用4.2 this关键字4.3 标识符4.4 文法4.5 Object文法4.6 数组文法4.7 模板文法4.8 括弧4.9 super关键字4.9.1 父类super调用4.9.2 父类属性存取4.10 函数表达式4.11 箭头函数4.12 Class表达式4.13 属性存取4.14 new操作算子4.15 函数调用4.15.1 重载解决方案4.15.2 类型参数推导4.15.3 语法歧义4.16 类型断言4.17 JSX表达式4.18 一元运算符4.1

2020-06-01 17:23:20 710

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格3:类型

TypeScript语言规范3 类型3.1 Any类型3.2 基本类型3.2.1 Number类型3.2.2 Boolean类型3.2.3 String类型3.2.4 Symbol类型3.2.5 Void类型3.2.6 Null类型3.2.7 Undefined类型3.2.8 Enum类型3.2.9 String类型3.3 Object类型3.3.1 命名类型引用3.3.2 Array类型3.3.3 Tuple类型3.3.4 Function类型3.3.5 Constructor类型3.3.6 Member

2020-06-01 17:21:24 489

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格2:基本概念

TypeScript语言规范2 基本概念2.1 语法约定2.2 命名2.2.1 保留字2.2.2 属性命名2.2.3 计算属性命名2.3 声明2.4 范围2 基本概念本文档的其余部分是TypeScript编程语言的正式规范,旨在作为ECMAScript 2015 Language Specification(特别是ECMA-262标准,第6版)的附件来阅读。 本文档描述了TypeScript所添加的语法,以及TypeScript编译器执行的编译时处理和类型检查,但是由于ECMAScript规范涵盖了该内

2020-06-01 17:18:39 326

翻译 [TypeScript] 编程实践之1: Google的TypeScript代码风格1:介绍

TypeScript语言规范1 介绍1.1 环境声明1.2 函数类型1.3 对象类型1.4 结构子类型化1.5 上下文类型推断1.6 类1.7 枚举类型1.8 字符串参数重载1.9 通用类型和功能1.10 命名空间1.11 模块版本1.82016年1月Microsoft自2012年10月1日起根据Open Web Foundation最终规范协议版本1.0(“ OWF 1.0”)提供此规范。OWF 1.0可以从http://www.openwebfoundation.org/legal/the-owf

2020-06-01 17:14:15 1060

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格9:附件

Google的Javascript风格指南9 附件9.1 JSDoc标签参考9.1.1 类型注释和其他Closure Compiler注释9.1.2 文档注释9.1.2.1 @author 或者 @owner - 不推荐9.1.2.2 @bug9.1.2.3 @code -弃用, 不推荐使用9.1.2.4 @desc9.1.2.5 @link9.1.2.6 @see9.1.2.7 @supported9.1.3 适用于特定框架的注释9.1.3.1 @ngInject 特定于Angular 19.1.3.2

2020-05-14 11:12:13 447

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格8:一些策略

Google的Javascript风格指南8 一些策略8.1 Google样式指南未明确指出的问题:请保持一致性!8.2 编译器警告8.2.1 使用标准警告集8.2.2 如何处理警告8.2.3 在最窄的合理范围内禁止警告8.3 弃用8.4 代码不是Google风格8.4.1 重新格式化已有代码8.4.2 新加入的代码:请遵照Google风格8.5 本地风格规则8.6 生成的代码:大部分豁免8 一些策略8.1 Google样式指南未明确指出的问题:请保持一致性!对于本规范未明确解决的任何样式问题,请优先

2020-05-14 11:10:52 211

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格7:JSDoc

Google的Javascript风格指南7 JSDoc7.1 通用形式7.2 Markdown7.3 JSDoc标签7.4 换行7.5 顶级/文件级注释7.6 类注释7.7 Enum和typedef注释7.8 方法和函数注释7.9 属性注释7.10 Type注释7.10.1 可空性7.10.2 类型转换7.10.3 模板参数类型7.10.4 函数类型表达式7.10.5 空格7.11 可见性注释7 JSDocJSDoc在所有类、域以及方法中被使用。7.1 通用形式在此示例中可以看到JSDoc块的基本

2020-05-14 11:09:44 456

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格6:命名规范

Google的Javascript风格指南6 命名规范6.1 所有标识符的通用规则6.2 标识符类型规则6.2.1 Package命名6.2.2 Class命名6.2.3 Method命名6.2.4 Enum命名6.2.5 Constant命名6.2.5.1 “constant”的定义6.2.5.2 本地别名6.2.6 非常量域名称6.2.7 参数名称6.2.8 局部变量名称6.2.9 模板参数名称6.2.10 模块局部名称6.3 驼峰案例:定义6 命名规范6.1 所有标识符的通用规则标识符仅使用AS

2020-05-14 11:07:58 466

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格5:语言特性

Google的Javascript风格指南5 语言特性5.1 局部变量声明5.1.1 const和let的使用5.1.2 每次只声明一个变量5.1.3 仅在需要时声明,并且尽快初始化5.1.4 根据需要声明类型5.2 数组文法5.2.1 使用拖拽逗号5.2.2 不要使用可变数组的构造函数5.2.3 非数值性质5.2.4 析构5.2.5 传播算子(Spread operator)5.3 对象文法5.3.1 使用拖拽逗号5.3.2 不要使用Object的构造函数5.3.3 不要混合使用含引号和不含引号的关键字5

2020-05-14 11:05:53 426

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格4:格式化

Google的Javascript风格指南4 格式化4.1 大括弧4.1.1 在所有的控制结构中都使用大括弧4.1.2 非空块的K&R风格4.1.3 空块:可能更精炼4.2 块缩进:+2个空格4.2.1 数组文法:可类似于块4.2.2 对象文法:可类似于块4.2.3 类文法4.2.4 函数表达式4.2.5 Switch语句4.3 语句4.3.1 每行一条语句4.3.2 分号是必须的4.4 列数限制:804.5 换行4.5.1 在哪里做行中断4.5.2 缩进连续线至少+4个空格4.6 空格4.6.1

2020-05-14 11:03:40 414

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格3:源文件结构

Google的Javascript风格指南3 源文件结构3.1 许可证或者版权信息(如果有)3.2 @fileoverview JSDoc (如果有)3.3 goog.module语句3.3.1 层次结构3.3.2 goog.module.declareLegacyNamespace3.3.3 goog.module导出3.4 ES模块3.4.1 导入3.4.1.1 导入路径3.4.1.1.1 在路径导入中的文件名扩展3.4.1.2 多次导入同一文件3.4.1.3 名称导入3.4.1.3.1 名称模块导入3

2020-05-14 11:01:30 569

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格2:源文件基础

Google的Javascript风格指南2 源文件基础2.1 文件命名2.2 文件编码:UTF-82.3 特殊字符2.3.1 空格字符2.3.2 特殊转义序列2.3.3 非ASCII字符2 源文件基础2.1 文件命名文件名必须全部为小写,并且可以包含下划线(_)或者破折号(-),但不能包含其它标点符号。具体请遵循项目使用的约定。文件名的扩展名必须为.js。2.2 文件编码:UTF-8源文件编码方式为UTF-8。2.3 特殊字符2.3.1 空格字符除行终止符序列外,ASCII水平空格字符(0

2020-05-14 10:58:56 160

翻译 [Javascript] 编程实践之1: Google的Javascript代码风格1:简介

Google的Javascript风格指南内容目录1、简介1.1、术语注意事项1.2、规范注意事项2、源文件基础2.1、文件命名2.2、文件编码:UTF-82.3、特殊字符2.3.1、空格字符2.3.2、特殊转义序列2.3.3、非ASCII字符3、源文件结构3.1、许可证或者版权信息(如果有)3.2、@fileoverview JSDoc (如果有)3.3、goog.module语句4、格式5、语...

2020-05-14 10:46:45 334

转载 [经典模型] 4. 图与网络模型及方法

4. 图与网络模型及方法图论起源于18 世纪。第一篇图论论文是瑞士数学家欧拉于1736 年发表的“哥尼斯堡的七座桥”。1847 年,克希霍夫为了给出电网络方程而引进了“树”的概念。1857年,凯莱在计数烷CnH2n+2CnH2n+2C_nH_{2n + 2}的同分异构物时,也发现了“树”。哈密尔顿于 1859 年提出“周游世界”游戏,用图论的术语,就是如何找出一个连通图中的生成圈、近几十年来,...

2018-06-06 18:59:52 2721

原创 [Leetcode] 823. Binary Trees With Factors 解题报告

题目:Given an array of unique integers, each integer is strictly greater than 1.We make a binary tree using these integers and each number may be used for any number of times.Each non-leaf node's value ...

2018-05-21 19:13:14 672 1

原创 [Leetcode] 822. Card Flipping Game 解题报告

题目:On a table are N cards, with a positive integer printed on the front and back of each card (possibly different).We flip any number of cards, and after we choose one card. If the number X on the bac...

2018-05-17 11:23:58 688

原创 [Leetcode] 821. Shortest Distance to a Character 解题报告

题目:Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.Example 1:Input: S = "loveleetcode", C = 'e'Output: [3, 2, 1, ...

2018-05-16 19:49:09 435

原创 [Leetcode] 820. Short Encoding of Words 解题报告

题目:Given a list of words, we may encode it by writing a reference string S and a list of indexes A.For example, if the list of words is ["time", "me", "bell"], we can write it as S = "time#bell#" and ...

2018-05-16 17:29:40 1155

原创 [Leetcode] 819. Most Common Word 解题报告

题目:Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words.  It is guaranteed there is at least one word that isn't banned, and that the ans...

2018-05-16 11:29:31 627

原创 [Leetcode] 818. Race Car 解题报告

题目:Your car starts at position 0 and speed +1 on an infinite number line.  (Your car can go into negative positions.)Your car drives automatically according to a sequence of instructions A (accelerate...

2018-05-16 11:01:51 3428 1

原创 [Leetcode] 817. Linked List Components 解题报告

题目:We are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the values in the linked list.Return the number of connected components ...

2018-05-15 09:20:57 727

原创 [Leetcode] 816. Ambiguous Coordinates 解题报告

题目:We had some 2-dimensional coordinates, like "(1, 3)" or "(2, 0.5)".  Then, we removed all commas, decimal points, and spaces, and ended up with the string S.  Return a list of strings representing ...

2018-05-15 09:02:53 569

原创 [Leetcode] 482. License Key Formatting 解题报告

题目:You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a number K, we would

2018-04-11 17:08:09 257

原创 [Leetcode] 815. Bus Routes 解题报告

题目:We have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7], this means that the first bus (0-th indexed) travels i

2018-04-11 16:13:20 1887

原创 [Leetcode] 814. Binary Tree Pruning 解题报告

题目:We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1.Return the same tree where every subtree (of the given tree) not containing

2018-04-11 14:53:06 360

原创 [Leetcode] 813. Largest Sum of Averages 解题报告

题目:We partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the sum of the average of each group. What is the largest score we can achieve?Note that ou

2018-04-11 14:24:22 1286

原创 [Leetcode] 812. Largest Triangle Area 解题报告

题目:You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points.Example:Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]Output: 2

2018-04-09 11:00:26 1601

原创 [Leetcode] 811. Subdomain Visit Count 解题报告

题目:A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leet

2018-04-09 10:37:03 306

原创 [Leetcode] 810. Chalkboard XOR Game 解题报告

题目:We are given non-negative integers nums[i] which are written on a chalkboard.  Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first.  If erasing

2018-04-09 10:14:58 485

原创 [Leetcode] 809. Expressive Words 解题报告

题目:Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii".  Here, we have groups, of adjacent letters that are all the same character, and ad

2018-04-09 09:45:31 874

原创 [Leetcode] 808. Soup Servings 解题报告

题目:There are two types of soup: type A and type B. Initially we have N ml of each type of soup. There are four kinds of operations:Serve 100 ml of soup A and 0 ml of soup BServe 75 ml of s

2018-04-09 09:10:56 1267

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除