Package Exports
- linq-js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (linq-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
LinqJs
use linq and lambda in javascript
在javascript中使用linq与lambda
在1.0.0中使用了字符串的lambda表达式,过于繁琐,并且不支持延迟操作
从2.1.0开始整体代码重新编写,使用全新的ES6的特性,性能更好,同时对数据的操作是延时操作,占用更少
尚未完成的帮助文档 👍
Documention(not completed) 👍
Usage 用法
Usage for English is Coming soon...
Start 开始使用
1. 引入
使用nodejs
$ npm install --save linq-js
const Enumerable = require('linq-js');
- 说明:本module依赖于ES6,建议项目在中使用ES6,以下案例中将均使用ES6写法
2. 配置
Enumerable.config.extends.array = true; //开启针对Array的扩展
Enumerable.config.extends.string = true; //开启针对String的扩展
Enumerable.config.extends.object = true; //开启针对Object的扩展
Enumerable.config.as = 'em'; //设置使用.em()来获取IEnumerable对象
获取IEnumerable对象
interface IEnumerable { };
function asEnumerable():IEnumerable; //任何对象都有asEnumerable方法用来获取IEnumerable对象
e.g. 案例
'abc'.asEnumerable(); [1,2,3].asEnumerable(); ({a:1,b:2}).asEnumerable();
:see msdn(IEnumerable
:see msdn(Enumerable)
:参考 MSDN(Enumerable)