diff --git a/all.html b/all.html index e41919e..cd4fa19 100644 --- a/all.html +++ b/all.html @@ -559,7 +559,7 @@
lodash category=array plus=random,template
template
command to pass the file path pattern used to match template files to precompile. 注意: 预编译模板分配在 _.templates
对象上。template
命令传入路径相匹配的文件生成预编译模板。 注意: 预编译模板分配在 _.templates
对象上。lodash template="./*.jst"
lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
moduleId
command to specify the AMD module ID for lodash or the module ID used to include lodash in compiled templates. Use “none” as the module ID to create compiled templates without a dependency on lodash.moduleId
命令指定 lodash 的 AMD module ID 或 包含 lodash 的编译模板的 module ID。指定为 none
表示创建编译模板不依赖 lodash。lodash moduleId=underscore
注意:
diff --git a/custom-builds.html b/custom-builds.html index 57f6562..123af9f 100644 --- a/custom-builds.html +++ b/custom-builds.html @@ -440,7 +440,7 @@lodash category=array plus=random,template
template
command to pass the file path pattern used to match template files to precompile. 注意: 预编译模板分配在 _.templates
对象上。template
命令传入路径相匹配的文件生成预编译模板。 注意: 预编译模板分配在 _.templates
对象上。lodash template="./*.jst"
lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
moduleId
command to specify the AMD module ID for lodash or the module ID used to include lodash in compiled templates. Use “none” as the module ID to create compiled templates without a dependency on lodash.moduleId
命令指定 lodash 的 AMD module ID 或 包含 lodash 的编译模板的 module ID。指定为 none
表示创建编译模板不依赖 lodash。lodash moduleId=underscore
注意:
diff --git a/pages.json b/pages.json index e76989d..4552ff9 100644 --- a/pages.json +++ b/pages.json @@ -3,7 +3,7 @@ ,{ "href":"/getting-started", "html":"查看 版本区别 来选择适合你的版本
\n浏览器中使用:
\n<script src="lodash.js"></script>\n
AMD 规范中使用:
\nrequire(['lodash'], function(_) {});\n
使用 npm 安装:
\n$ {sudo -H} npm i -g npm$ npm i --save lodash\n
Node.js/io.js 中使用:
\n// 直接引用现代版本\nvar _ = require('lodash');\n\n// 或引用某分类下的所有方法\nvar array = require('lodash/array');\n\n// 或者引用具体方法 (很适合在 browserify/webpack 中做最小化打包)\nvar chunk = require('lodash/array/chunk');\n
查看 源码包 了解更多详情
\n注意:\n在 REPL 中不要声明 特殊变量 "_
",安装 n_ 来代替。
lodash 还有多种构建模块的格式
\n\nCDN 服务在 cdnjs & jsDelivr,通过 版本定制 构建你需要的模块,在找更多的功能用法? 试试 lodash-fp
\n查看我们的 更新日志, 路线图, 以及 社区里的播客、文章、视频.
\n在 Chrome 43-44, Firefox 38-39, IE 6-11, MS Edge, Safari 5-8, ChakraNode 0.12.2, Node.js 0.8.28, 0.10.40, 0.12.7, & 4.0.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6 测试通过
\n自动化测试 & 持续集成 已在运作, 特别感谢 Sauce Labs 提供的浏览器自动化测试。
\n通过版本定制可以很轻松的定制仅包含你所需功能的 lodash 版本 。更棒的是,我们已经帮你处理好了函数依赖和别名对应,查看 版本区别 & 选择一个适合你的版本。
\n使用 Grunt? 我们准备了 Grunt plugin 协助构建 lodash。
\n安装 lodash-cli 来作为 lodash
全局命令行工具:
$ {sudo -H} npm i -g npm\n$ {sudo -H} npm i -g lodash-cli\n$ lodash -h\n
注意: 请先卸载旧版本,再安装 lodash-cli
。
compat
修饰。 (默认)lodash compat\n
\nlodash modern\n
strict
修饰。lodash strict\n
modularize
修饰。lodash modularize\n
构建命令:
\ncategory
命令以逗号分隔的方式传入需要的函数分类。可用的函数分类有: “array”, “chain”, “collection”, “date”, “function”, “lang”, “object”, “number”, “string”, & “utility”=。lodash category=collection,function\n
exports
命令以逗号分隔的方式传入导出 lodash
函数的方式,可用的方式有: “amd”, “commonjs”, “es”, “global”, “iojs”, “node”, “npm”, “none”, & “umd”.lodash exports=amd,commonjs,iojs\n
iife
命令指定代码替换 包裹 lodash 的 IIFE。lodash iife="!function(window,undefined){%output%}(this)"\n
include
命令以逗号分隔的方式传入需要包含的函数。lodash include=each,filter,map\n
minus
命令以逗号分隔的方式传入需要删减的函数/分类。lodash modern minus=result,shuffle\n
plus
命令以逗号分隔的方式传入需要补充的函数/分类。lodash category=array plus=random,template\n
template
command to pass the file path pattern used to match template files to precompile. 注意: 预编译模板分配在 _.templates
对象上。lodash template="./*.jst"\n
settings
命令设置预编译模板时的模板语法。lodash settings="{interpolate:/\\{\\{([\\s\\S]+?)\\}\\}/g}"\n
moduleId
command to specify the AMD module ID for lodash or the module ID used to include lodash in compiled templates. Use “none” as the module ID to create compiled templates without a dependency on lodash.lodash moduleId=underscore\n
注意:
\ncompat
& modern
)exports
的值 “es” & “npm” 只能与 modularize
命令联用。modularize
命令使用最先的 exports
的值作为模块格式,忽略后续的值。-o
或 --output
,不然所有文件会保存在当前工作目录。另外还支持以下选项:
\n-c, --stdout .......... 输出到stdout(译注:类似直接输出在终端那样)\n-d, --development ..... 输出非最小化的开发代码\n-h, --help ............ 显示帮助信息\n-m, --source-map ...... 生成source-map文件\n-o, --output .......... 指定输出的路径/文件名\n-p, --production ...... 输出最小化后的产品代码\n-s, --silent .......... 不显示常规的日志输出\n-V, --version ......... 显示当前的 lodash 版本号\n
通过版本定制可以很轻松的定制仅包含你所需功能的 lodash 版本 。更棒的是,我们已经帮你处理好了函数依赖和别名对应,查看 版本区别 & 选择一个适合你的版本。
\n使用 Grunt? 我们准备了 Grunt plugin 协助构建 lodash。
\n安装 lodash-cli 来作为 lodash
全局命令行工具:
$ {sudo -H} npm i -g npm\n$ {sudo -H} npm i -g lodash-cli\n$ lodash -h\n
注意: 请先卸载旧版本,再安装 lodash-cli
。
compat
修饰。 (默认)lodash compat\n
\nlodash modern\n
strict
修饰。lodash strict\n
modularize
修饰。lodash modularize\n
构建命令:
\ncategory
命令以逗号分隔的方式传入需要的函数分类。可用的函数分类有: “array”, “chain”, “collection”, “date”, “function”, “lang”, “object”, “number”, “string”, & “utility”=。lodash category=collection,function\n
exports
命令以逗号分隔的方式传入导出 lodash
函数的方式,可用的方式有: “amd”, “commonjs”, “es”, “global”, “iojs”, “node”, “npm”, “none”, & “umd”.lodash exports=amd,commonjs,iojs\n
iife
命令指定代码替换 包裹 lodash 的 IIFE。lodash iife="!function(window,undefined){%output%}(this)"\n
include
命令以逗号分隔的方式传入需要包含的函数。lodash include=each,filter,map\n
minus
命令以逗号分隔的方式传入需要删减的函数/分类。lodash modern minus=result,shuffle\n
plus
命令以逗号分隔的方式传入需要补充的函数/分类。lodash category=array plus=random,template\n
template
命令传入路径相匹配的文件生成预编译模板。 注意: 预编译模板分配在 _.templates
对象上。lodash template="./*.jst"\n
settings
命令设置预编译模板时的模板语法。lodash settings="{interpolate:/\\{\\{([\\s\\S]+?)\\}\\}/g}"\n
moduleId
命令指定 lodash 的 AMD module ID 或 包含 lodash 的编译模板的 module ID。指定为 none
表示创建编译模板不依赖 lodash。lodash moduleId=underscore\n
注意:
\ncompat
& modern
)exports
的值 “es” & “npm” 只能与 modularize
命令联用。modularize
命令使用最先的 exports
的值作为模块格式,忽略后续的值。-o
或 --output
,不然所有文件会保存在当前工作目录。另外还支持以下选项:
\n-c, --stdout .......... 输出到stdout(译注:类似直接输出在终端那样)\n-d, --development ..... 输出非最小化的开发代码\n-h, --help ............ 显示帮助信息\n-m, --source-map ...... 生成source-map文件\n-o, --output .......... 指定输出的路径/文件名\n-p, --production ...... 输出最小化后的产品代码\n-s, --silent .......... 不显示常规的日志输出\n-V, --version ......... 显示当前的 lodash 版本号\n
Creates an array of elements split into groups the length of size
.\nIf collection
can't be split evenly, the final chunk will be the remaining\nelements.
The array to process.
\nThe length of each chunk.
\nReturns the new array containing chunks.
\n_.chunk(['a', 'b', 'c', 'd'], 2);\n// => [['a', 'b'], ['c', 'd']]\n\n_.chunk(['a', 'b', 'c', 'd'], 3);\n// => [['a', 'b', 'c'], ['d']]\n
\n