1 Star 0 Fork 1

touchx / kmalakoff

forked from Gitee 极速下载 / kmalakoff 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

_.m

Version Platform

_.m is a port of Underscore.js to Objective-C. It strives to provide the fullest feature set possible in a way that is familiar to JavaScript developers (despite the differences between JavaScript and Objective-C).

To help achieve this vision, _.m uses SubjectiveScript.m to bring JavaScript-like syntax and features into Objective-C, and QUnit.m to port unit tests from JavaScript to Objective-C. You should check them out, too!

Full documentation can be found on the _.m Website

A Quick Taster

You can use familiar Underscore.js functions:

N* result = (N*) _.detect(AI(1, 2, 3), ^B(N* num){ return num.I * 2 == 4; });
equal(result.I, 2, @"found the first '2' and broke the loop");

and you can even use chaining:

A* lyrics = AO(
  @"I'm a lumberjack and I'm okay",
  @"I sleep all night and I work all day",
  @"He's a lumberjack and he's okay",
  @"He sleeps all night and he works all day"
);
O* counts = (O*) __(lyrics)
  .map(^(NSS* line, ...) { return line.split(@""); })
  .flatten(/* REQUIRED */ false )
  .reduce(^(O* hash, N* l, ... /* KEY, LIST */) {
    N* value = (N*) hash.getOrAdd(l, ^{ return N.I(0); });
    hash.set(l, N.I(value.I+1));
    return hash;
}, O.new).value();
ok(counts.get(@"a").I == 16 && counts.get(@"e").I == 10, @"counted all the letters in the song");

Usage

To run the example project; clone the repo, and run pod install from the Project directory first.

Requirements

Installation

_.m is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "_.m"

Author

Kevin Malakoff, kmalakoff@gmail.com

License

_.m is available under the MIT license. See the LICENSE file for more info.

Copyright (c) 2012, 2013 Kevin Malakoff <kmalakoff@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

_.m是 Underscore.js 到 Objective-C 的移植版本 展开 收起
Objective-C
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Objective-C
1
https://gitee.com/touchx_admin/kmalakoff.git
git@gitee.com:touchx_admin/kmalakoff.git
touchx_admin
kmalakoff
kmalakoff
master

搜索帮助