TagSpaces is an offline, open source, document manager with tagging support
added jquery nano scroller added linq library added node-webkit
uggrock380a04820722
diff --git a/build.number b/build.numberindex 83d34ab78..ba3bb853f 100644--- a/build.number+++ b/build.number@@ -1,4 +1,4 @@#Build Number for ANT. Do not edit!-#Fri Jul 12 14:03:59 CEST 2013-build.number=1396+#Fri Jul 12 14:19:09 CEST 2013+build.number=13983=diff --git a/build.xml b/build.xmlindex fbd918722..c537a9146 100644--- a/build.xml+++ b/build.xml@@ -132,7 +132,7 @@ found in the LICENSE file.<include name="perspectiveThumb/**/*"/><include name="perspectiveGraph/**/*"/><include name="editorHTML/**/*"/>- <include name="editorText/**/*"/>+ <include name="editorMirror/**/*"/><include name="viewerMD/**/*"/></fileset></copy>diff --git a/data/ext/perspectiveDefault/perspectiveUI.js b/data/ext/perspectiveDefault/perspectiveUI.jsindex a2eee8dbc..c1000fbd6 100644--- a/data/ext/perspectiveDefault/perspectiveUI.js+++ b/data/ext/perspectiveDefault/perspectiveUI.js@@ -79,8 +79,6 @@ console.log("Loading UI for perspectiveDefault");var self = this;- // var tagButtons = $("<div>").appendTo( "#tagGroups" );-this.viewToolbar.append($("<div>", {class: "btn-group",style: "margin: 0px",@@ -237,7 +235,7 @@ console.log("Loading UI for perspectiveDefault");cellspacing: "0",border: "0",style: "width: 100%",- class: "table",+ class: "table content",id: this.extensionID+"FileTable",}));@@ -313,6 +311,10 @@ console.log("Loading UI for perspectiveDefault");console.log("Selected files: "+TSCORE.selectedFiles);}}) */++ // Activating nano scroller+ //$('#'+this.extensionID+"FileTable_wrapper").addClass("nano");+ //$('#'+this.extensionID+"FileTable_wrapper").nanoScroller();}ExtUI.prototype.reInitTableWithData = function(fileList) {diff --git a/data/index.html b/data/index.htmlindex 67376bc53..8c4839f7f 100644--- a/data/index.html+++ b/data/index.html@@ -15,6 +15,7 @@<link rel="stylesheet" type="text/css" href="libs/jsoneditor/jsoneditor.css"><link rel="stylesheet" type="text/css" href="libs/jquerydropdown/jquery.dropdown.css"><link rel="stylesheet" type="text/css" href="libs/bootstrap/css/bootstrap.css">+ <link rel="stylesheet" type="text/css" href="libs/jquerynanoscroller/nanoscroller.css"><link rel="stylesheet" type="text/css" href="css/tagspaces.css"></head><body style="background-color: lightgray;">@@ -31,7 +32,7 @@<div id="mainMenu" class="pull-right"><button id="toggleLeftPanel" class="btn btn-link" title="Toggle Navigator & Tag Panel"><i class="icon-sort icon-rotate-90"></i></button><div id="viewSwitcher" class="btn-group" data-toggle="buttons-radio"></div>- <button role="button" class="btn btn-link" title="Additional Actions" data-dropdown="#settingsMenu"><i class="icon-reorder"></i></button>+ <button role="button" class="btn btn-link" title="Additional Actions" data-dropdown="#settingsMenu"><i class="icon-ellipsis-vertical"></i></button></div></div>@@ -43,9 +44,13 @@<button id="selectTagSpace" style="width: 15%;" class="btn"><span class="caret"></span></button></div></div>- <div id="dirTree" style="padding: 0px; height: 100%;"></div>+ <div id="location" class="nano">+ <div id="locationContent" class="content"></div>+ </div>+ </div>+ <div id="tagGroups" class="west-south nano">+ <div id="tagGroupsContent" class="content"></div></div>- <div id="tagGroups" class="west-south" style="padding: 0px; height: 100%"></div></div><div class="ui-layout-center" style="padding: 0px;">@@ -403,7 +408,10 @@</ul><ul id="settingsMenu" class="dropdown-menu has-tip anchor-right">+ <li><a id="startNewInstanceBack" title="Options Dialog"><i class="icon-external-link-sign"></i> New Instance</a></li>+ <li class="divider"></li><li><a id="openOptions" title="Options Dialog"><i class="icon-wrench"></i> Options</a></li>+ <li><a target="_new" href="https://tagspaces.uservoice.com/forums/213931-general" title="Suggest or vote for a feature"><i class="icon-bullhorn"></i> Vote on feature</a></li><li><a target="_new" href="https://github.com/uggrock/tagspaces/issues/" title="Report a issue or enhancement"><i class="icon-flag"></i> Report Issue</a></li><li><a target="_new" href="https://twitter.com/tagspaces" title="Follow on twitter"><i class="icon-twitter"></i> Follow @tagspaces</a></li><li><a href="mailto:[email protected]" title="Drop a line to the developers"><i class="icon-envelope-alt"></i> Contact developers</a></li>diff --git a/data/js/core.api.js b/data/js/core.api.jsindex 965a79f1a..83d41f9df 100644--- a/data/js/core.api.js+++ b/data/js/core.api.js@@ -73,10 +73,13 @@ define(function(require, exports, module) {tsTagsUI.generateTagGroups();+$( "#loading" ).hide();$( "#container" ).show();$( "#helpers" ).show();++hideLoadingAnimation();// TODO check if document.ready is really needed$(document).ready(function() {@@ -290,7 +293,7 @@ define(function(require, exports, module) {var dirNavigationLayout = $('#directoryNavigator').layout({minSize: 35 // ALL panes, north__paneSelector: "#directoryNavigatorNorth"- , center__paneSelector: "#dirTree"+ , center__paneSelector: "#location", north__size: 32, north__resizable: false, north__spacing_open: 0diff --git a/data/js/directories.ui.js b/data/js/directories.ui.jsindex 80c3e793d..15fa122f7 100644--- a/data/js/directories.ui.js+++ b/data/js/directories.ui.js@@ -49,10 +49,10 @@ define(function(require, exports, module) {function generateDirPath() {console.log("Generating Directory Path...");- $("#dirTree").empty();- $("#dirTree").addClass("accordion")+ $("#locationContent").empty();+ $("#locationContent").addClass("accordion")for(var i=0; i < directoryHistory.length; i++) {- $("#dirTree").append($("<div>", {+ $("#locationContent").append($("<div>", {"class": "accordion-group","style": "width: 100%; border: 0px;",})@@ -111,7 +111,7 @@ define(function(require, exports, module) {"style": "width:20%",}).dropdown( 'attach' , '#directoryMenu' )- .append("<b class='icon-reorder'>")+ .append("<b class='icon-ellipsis-vertical'>").click( function(event) {dir4ContextMenu = $(this).attr("key");})) // end gear@@ -163,7 +163,7 @@ define(function(require, exports, module) {}}})- .prepend("<i class='icon-folder-close-alt'></i>")+ .prepend("<i class='icon-folder-close'></i>").click( function() {navigateToDirectory($(this).attr("key"));})@@ -172,10 +172,13 @@ define(function(require, exports, module) {}}}+ // Activating nano scroller+ //$("#location").nanoScroller();+}function handleDirCollapsion() {- $("#dirTree").find(".accordion-heading").each(function(index) {+ $("#locationContent").find(".accordion-heading").each(function(index) {var key = $(this).attr("key");console.log("Entered Header for: "+key);if(getDirectoryCollapsed(key)) {@@ -279,9 +282,9 @@ define(function(require, exports, module) {$( "#selectTagSpace" ).tooltip();- $( "#selectLocalDirectory" ).click(function() {+ $( "#selectLocalDirectory" ).click(function(e) {+ e.preventDefault();TSCORE.IO.selectDirectory();- return false;})}diff --git a/data/js/tags.ui.js b/data/js/tags.ui.jsindex d57fc18a0..0b2beb7e3 100644--- a/data/js/tags.ui.js+++ b/data/js/tags.ui.js@@ -115,10 +115,10 @@ define(function(require, exports, module) {function generateTagGroups() {console.log("Generating TagGroups...");- $("#tagGroups").empty();- $("#tagGroups").addClass("accordion");+ $("#tagGroupsContent").empty();+ $("#tagGroupsContent").addClass("accordion");if(TSCORE.Config.Settings["tagGroups"].length < 1) {- $("#tagGroups").append($("<button>", {+ $("#tagGroupsContent").append($("<button>", {"class": "btn",text: "Create New Taggroup"})@@ -130,7 +130,7 @@ define(function(require, exports, module) {}for(var i=0; i < TSCORE.Config.Settings["tagGroups"].length; i++) {- $("#tagGroups").append($("<div>", {+ $("#tagGroupsContent").append($("<div>", {"class": "accordion-group","style": "width: 99%; border: 0px;",})@@ -180,7 +180,7 @@ define(function(require, exports, module) {"title": "Taggroup options",}).dropdown( 'attach' , '#tagGroupMenu' )- .append("<b class='icon-reorder'></b>")+ .append("<b class='icon-ellipsis-vertical'></b>").click( function(event) {//console.log("Clicked in taggroup setting");TSCORE.selectedTag = $(this).attr("tag");@@ -230,6 +230,8 @@ define(function(require, exports, module) {);}}+ // Activating nano scroller+ //$("#tagGroups").nanoScroller();}function openTagMenu(tagButton, tag, filePath) {diff --git a/data/libs/jquerynanoscroller/LICENSE-MIT b/data/libs/jquerynanoscroller/LICENSE-MITnew file mode 100644index 000000000..7c2264948--- /dev/null+++ b/data/libs/jquerynanoscroller/LICENSE-MIT@@ -0,0 +1,829 @@+++<!DOCTYPE html>+<html>+ <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">+ <meta charset='utf-8'>+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ <title>nanoScrollerJS/LICENSE-MIT at master · jamesflorentino/nanoScrollerJS</title>+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />+ <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />+ <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />+ <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />+ <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />+ <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />+ <link rel="logo" type="image/svg" href="https://github-media-downloads.s3.amazonaws.com/github-logo.svg" />+ <meta property="og:image" content="https://a248.e.akamai.net/assets.github.com/images/modules/logos_page/Octocat.png">+ <link rel="assets" href="https://a248.e.akamai.net/assets.github.com/">+ <link rel="xhr-socket" href="/_sockets" />++++ <meta name="msapplication-TileImage" content="/windows-tile.png" />+ <meta name="msapplication-TileColor" content="#ffffff" />+ <meta name="selected-link" value="repo_source" data-pjax-transient />+ <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="1249777" name="octolytics-actor-id" /><meta content="uggrock" name="octolytics-actor-login" /><meta content="4de6274573df69e39c5216337d30969f59dab65297c190d75e1ab0a0ee8bdf65" name="octolytics-actor-hash" />++++ <link rel="icon" type="image/x-icon" href="/favicon.ico" />++ <meta content="authenticity_token" name="csrf-param" />+<meta content="dQhXcOYfOQ1j6q03hR5CXbQTfTKzl4cBBojA6P50BN0=" name="csrf-token" />++ <link href="https://a248.e.akamai.net/assets.github.com/assets/github-069f166cebb6afa806e7f150ae53692cbfaa83ab.css" media="all" rel="stylesheet" type="text/css" />+ <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-58b10e96bcdc3e0d5ea328ffcd01e36e2e8fd07e.css" media="all" rel="stylesheet" type="text/css" />++++ <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-1f035caafe193d95a1028b6142ec3453f0da2419.js" type="text/javascript"></script>+ <script src="https://a248.e.akamai.net/assets.github.com/assets/github-75ad61b5f571ccedfb5ee8ffd08f1de0ad428c82.js" type="text/javascript"></script>++ <meta http-equiv="x-pjax-version" content="0fc470dd229a793445197dd55f5f2377">++ <link data-pjax-transient rel='permalink' href='/jamesflorentino/nanoScrollerJS/blob/657eb103cb3c895757d550fb3853b4b11b22f436/LICENSE-MIT'>++ <meta property="og:title" content="nanoScrollerJS"/>+ <meta property="og:type" content="githubog:gitrepository"/>+ <meta property="og:url" content="https://github.com/jamesflorentino/nanoScrollerJS"/>+ <meta property="og:image" content="https://a248.e.akamai.net/assets.github.com/images/gravatars/gravatar-user-420.png"/>+ <meta property="og:site_name" content="GitHub"/>+ <meta property="og:description" content="nanoScrollerJS - A jQuery plugin that offers a simplistic way of implementing Lion OS scrollbars."/>++ <meta name="description" content="nanoScrollerJS - A jQuery plugin that offers a simplistic way of implementing Lion OS scrollbars." />++ <meta content="458310" name="octolytics-dimension-user_id" /><meta content="jamesflorentino" name="octolytics-dimension-user_login" /><meta content="2925780" name="octolytics-dimension-repository_id" /><meta content="jamesflorentino/nanoScrollerJS" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="2925780" name="octolytics-dimension-repository_network_root_id" /><meta content="jamesflorentino/nanoScrollerJS" name="octolytics-dimension-repository_network_root_nwo" />+ <link href="https://github.com/jamesflorentino/nanoScrollerJS/commits/master.atom" rel="alternate" title="Recent Commits to nanoScrollerJS:master" type="application/atom+xml" />++ </head>+++ <body class="logged_in page-blob linux vis-public env-production kill-the-chrome">+ <div id="wrapper">++++++ <div class="header header-logged-in true">+ <div class="container clearfix">++ <a class="header-logo-invertocat" href="https://github.com/">+ <span class="mega-octicon octicon-mark-github"></span>+</a>++ <div class="divider-vertical"></div>+++ <a href="/notifications" class="notification-indicator tooltipped downwards" title="You have unread notifications">+ <span class="mail-status unread"></span>+ </a>+ <div class="divider-vertical"></div>+++ <div class="command-bar js-command-bar in-repository">+ <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">++<input type="text" data-hotkey=" s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"+ data-username="uggrock"+ data-repo="jamesflorentino/nanoScrollerJS"+ data-branch="master"+ data-sha="d0f422f4027466671b3d981bdb98ed2d15e25f5e"+ >++ <input type="hidden" name="nwo" value="jamesflorentino/nanoScrollerJS" />++ <div class="select-menu js-menu-container js-select-menu search-context-select-menu">+ <span class="minibutton select-menu-button js-menu-target">+ <span class="js-select-button">This repository</span>+ </span>++ <div class="select-menu-modal-holder js-menu-content js-navigation-container">+ <div class="select-menu-modal">++ <div class="select-menu-item js-navigation-item selected">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />+ <div class="select-menu-item-text js-select-button-text">This repository</div>+ </div> <!-- /.select-menu-item -->++ <div class="select-menu-item js-navigation-item">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <input type="radio" name="search_target" value="global" />+ <div class="select-menu-item-text js-select-button-text">All repositories</div>+ </div> <!-- /.select-menu-item -->++ </div>+ </div>+ </div>++ <span class="octicon help tooltipped downwards" title="Show command bar help">+ <span class="octicon octicon-question"></span>+ </span>+++ <input type="hidden" name="ref" value="cmdform">++</form>+ <ul class="top-nav">+ <li class="explore"><a href="/explore">Explore</a></li>+ <li><a href="https://gist.github.com">Gist</a></li>+ <li><a href="/blog">Blog</a></li>+ <li><a href="https://help.github.com">Help</a></li>+ </ul>+ </div>++++++ <ul id="user-links">+ <li>+ <a href="/uggrock" class="name">+ <img height="20" src="https://secure.gravatar.com/avatar/7ebff042f1c4b75e26b7a4e340bd537e?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="20" /> uggrock+ </a>+ </li>++ <li>+ <a href="/new" id="new_repo" class="tooltipped downwards" title="Create a new repo">+ <span class="octicon octicon-repo-create"></span>+ </a>+ </li>++ <li>+ <a href="/settings/profile" id="account_settings"+ class="tooltipped downwards"+ title="Account settings ">+ <span class="octicon octicon-tools"></span>+ </a>+ </li>+ <li>+ <a class="tooltipped downwards" href="/logout" data-method="post" id="logout" title="Sign out">+ <span class="octicon octicon-log-out"></span>+ </a>+ </li>++ </ul>+++<div class="js-new-dropdown-contents hidden">+++<ul class="dropdown-menu">+ <li>+ <a href="/new"><span class="octicon octicon-repo-create"></span> New repository</a>+ </li>+ <li>+ <a href="/organizations/new"><span class="octicon octicon-list-unordered"></span> New organization</a>+ </li>++++ <li class="section-title">+ <span title="jamesflorentino/nanoScrollerJS">This repository</span>+ </li>+ <li>+ <a href="/jamesflorentino/nanoScrollerJS/issues/new"><span class="octicon octicon-issue-opened"></span> New issue</a>+ </li>+</ul>++</div>++++ </div>+</div>++++++++++ <div class="site" itemscope itemtype="http://schema.org/WebPage">++ <div class="pagehead repohead instapaper_ignore readability-menu">+ <div class="container">+++<ul class="pagehead-actions">+++ <li class="subscription">+ <form accept-charset="UTF-8" action="/notifications/subscribe" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="dQhXcOYfOQ1j6q03hR5CXbQTfTKzl4cBBojA6P50BN0=" /></div> <input id="repository_id" name="repository_id" type="hidden" value="2925780" />++ <div class="select-menu js-menu-container js-select-menu">+ <span class="minibutton select-menu-button js-menu-target">+ <span class="js-select-button">+ <span class="octicon octicon-eye-watch"></span>+ Watch+ </span>+ </span>++ <div class="select-menu-modal-holder">+ <div class="select-menu-modal subscription-menu-modal js-menu-content">+ <div class="select-menu-header">+ <span class="select-menu-title">Notification status</span>+ <span class="octicon octicon-remove-close js-menu-close"></span>+ </div> <!-- /.select-menu-header -->++ <div class="select-menu-list js-navigation-container">++ <div class="select-menu-item js-navigation-item selected">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <div class="select-menu-item-text">+ <input checked="checked" id="do_included" name="do" type="radio" value="included" />+ <h4>Not watching</h4>+ <span class="description">You only receive notifications for discussions in which you participate or are @mentioned.</span>+ <span class="js-select-button-text hidden-select-button-text">+ <span class="octicon octicon-eye-watch"></span>+ Watch+ </span>+ </div>+ </div> <!-- /.select-menu-item -->++ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon octicon-check"></span>+ <div class="select-menu-item-text">+ <input id="do_subscribed" name="do" type="radio" value="subscribed" />+ <h4>Watching</h4>+ <span class="description">You receive notifications for all discussions in this repository.</span>+ <span class="js-select-button-text hidden-select-button-text">+ <span class="octicon octicon-eye-unwatch"></span>+ Unwatch+ </span>+ </div>+ </div> <!-- /.select-menu-item -->++ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <div class="select-menu-item-text">+ <input id="do_ignore" name="do" type="radio" value="ignore" />+ <h4>Ignoring</h4>+ <span class="description">You do not receive any notifications for discussions in this repository.</span>+ <span class="js-select-button-text hidden-select-button-text">+ <span class="octicon octicon-mute"></span>+ Stop ignoring+ </span>+ </div>+ </div> <!-- /.select-menu-item -->++ </div> <!-- /.select-menu-list -->++ </div> <!-- /.select-menu-modal -->+ </div> <!-- /.select-menu-modal-holder -->+ </div> <!-- /.select-menu -->++</form>+ </li>++ <li class="js-toggler-container js-social-container starring-container ">+ <a href="/jamesflorentino/nanoScrollerJS/unstar" class="minibutton with-count js-toggler-target star-button starred upwards" title="Unstar this repo" data-remote="true" data-method="post" rel="nofollow">+ <span class="octicon octicon-star-delete"></span>+ <span class="text">Unstar</span>+ </a>+ <a href="/jamesflorentino/nanoScrollerJS/star" class="minibutton with-count js-toggler-target star-button unstarred upwards" title="Star this repo" data-remote="true" data-method="post" rel="nofollow">+ <span class="octicon octicon-star"></span>+ <span class="text">Star</span>+ </a>+ <a class="social-count js-social-count" href="/jamesflorentino/nanoScrollerJS/stargazers">998</a>+ </li>++ <li>+ <a href="/jamesflorentino/nanoScrollerJS/fork" class="minibutton with-count js-toggler-target fork-button lighter upwards" title="Fork this repo" rel="nofollow" data-method="post">+ <span class="octicon octicon-git-branch-create"></span>+ <span class="text">Fork</span>+ </a>+ <a href="/jamesflorentino/nanoScrollerJS/network" class="social-count">177</a>+ </li>+++</ul>++ <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">+ <span class="repo-label"><span>public</span></span>+ <span class="mega-octicon octicon-repo"></span>+ <span class="author">+ <a href="/jamesflorentino" class="url fn" itemprop="url" rel="author"><span itemprop="title">jamesflorentino</span></a></span+ ><span class="repohead-name-divider">/</span><strong+ ><a href="/jamesflorentino/nanoScrollerJS" class="js-current-repository js-repo-home-link">nanoScrollerJS</a></strong>++ <span class="page-context-loader">+ <img alt="Octocat-spinner-32" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+ </span>++ </h1>+ </div><!-- /.container -->+ </div><!-- /.repohead -->++ <div class="container">++ <div class="repository-with-sidebar repo-container++ ">++ <div class="repository-sidebar">++++<div class="repo-nav repo-nav-full js-repository-container-pjax js-octicon-loaders">+ <div class="repo-nav-contents">+ <ul class="repo-menu">+ <li class="tooltipped leftwards" title="Code">+ <a href="/jamesflorentino/nanoScrollerJS" class="js-selected-navigation-item selected" data-gotokey="c" data-pjax="true" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /jamesflorentino/nanoScrollerJS">+ <span class="octicon octicon-code"></span> <span class="full-word">Code</span>+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+</a> </li>++ <li class="tooltipped leftwards" title="Issues">+ <a href="/jamesflorentino/nanoScrollerJS/issues" class="js-selected-navigation-item js-disable-pjax" data-gotokey="i" data-selected-links="repo_issues /jamesflorentino/nanoScrollerJS/issues">+ <span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>+ <span class='counter'>15</span>+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+</a> </li>++ <li class="tooltipped leftwards" title="Pull Requests"><a href="/jamesflorentino/nanoScrollerJS/pulls" class="js-selected-navigation-item js-disable-pjax" data-gotokey="p" data-selected-links="repo_pulls /jamesflorentino/nanoScrollerJS/pulls">+ <span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull Requests</span>+ <span class='counter'>0</span>+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+</a> </li>+++ <li class="tooltipped leftwards" title="Wiki">+ <a href="/jamesflorentino/nanoScrollerJS/wiki" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_wiki /jamesflorentino/nanoScrollerJS/wiki">+ <span class="octicon octicon-book"></span> <span class="full-word">Wiki</span>+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+</a> </li>+++ </ul>+ <div class="repo-menu-separator"></div>+ <ul class="repo-menu">++ <li class="tooltipped leftwards" title="Pulse">+ <a href="/jamesflorentino/nanoScrollerJS/pulse" class="js-selected-navigation-item " data-pjax="true" data-selected-links="pulse /jamesflorentino/nanoScrollerJS/pulse">+ <span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+</a> </li>++ <li class="tooltipped leftwards" title="Graphs">+ <a href="/jamesflorentino/nanoScrollerJS/graphs" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_graphs repo_contributors /jamesflorentino/nanoScrollerJS/graphs">+ <span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+</a> </li>++ <li class="tooltipped leftwards" title="Network">+ <a href="/jamesflorentino/nanoScrollerJS/network" class="js-selected-navigation-item js-disable-pjax" data-selected-links="repo_network /jamesflorentino/nanoScrollerJS/network">+ <span class="octicon octicon-git-branch"></span> <span class="full-word">Network</span>+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif" width="16" />+</a> </li>++ </ul>++ </div>+</div>+++ <div class="only-with-full-nav">++++++<div class="clone-url open"+ data-protocol-type="http"+ data-url="/users/set_protocol?protocol_selector=http&protocol_type=clone">+ <h3><strong>HTTPS</strong> clone URL</h3>++ <input type="text" class="clone js-url-field"+ value="https://github.com/jamesflorentino/nanoScrollerJS.git" readonly="readonly">++ <span class="js-zeroclipboard url-box-clippy zeroclipboard-button" data-clipboard-text="https://github.com/jamesflorentino/nanoScrollerJS.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>+</div>++++<div class="clone-url "+ data-protocol-type="ssh"+ data-url="/users/set_protocol?protocol_selector=ssh&protocol_type=clone">+ <h3><strong>SSH</strong> clone URL</h3>++ <input type="text" class="clone js-url-field"+ value="[email protected]:jamesflorentino/nanoScrollerJS.git" readonly="readonly">++ <span class="js-zeroclipboard url-box-clippy zeroclipboard-button" data-clipboard-text="[email protected]:jamesflorentino/nanoScrollerJS.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>+</div>++++<div class="clone-url "+ data-protocol-type="subversion"+ data-url="/users/set_protocol?protocol_selector=subversion&protocol_type=clone">+ <h3><strong>Subversion</strong> checkout URL</h3>++ <input type="text" class="clone js-url-field"+ value="https://github.com/jamesflorentino/nanoScrollerJS" readonly="readonly">++ <span class="js-zeroclipboard url-box-clippy zeroclipboard-button" data-clipboard-text="https://github.com/jamesflorentino/nanoScrollerJS" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>+</div>++++<p class="clone-options">You can clone with+ <a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a>,+ <a href="#" class="js-clone-selector" data-protocol="ssh">SSH</a>,+ <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>,+ and <a href="https://help.github.com/articles/which-remote-url-should-i-use">other methods.</a>+</p>+++++ <a href="/jamesflorentino/nanoScrollerJS/archive/master.zip"+ class="minibutton sidebar-button"+ title="Download this repository as a zip file"+ rel="nofollow">+ <span class="octicon octicon-cloud-download"></span>+ Download ZIP+ </a>++ </div>+ </div>++ <div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container>++++<!-- blob contrib key: blob_contributors:v21:d3f0e3bf8e97202160a9402be1e85b8d -->+<!-- blob contrib frag key: views10/v8/blob_contributors:v21:d3f0e3bf8e97202160a9402be1e85b8d -->+++ <p title="This is a placeholder element" class="js-history-link-replace hidden"></p>++ <a href="/jamesflorentino/nanoScrollerJS/find/master" data-pjax data-hotkey="t" style="display:none">Show File Finder</a>++ <div class="file-navigation">++++<div class="select-menu js-menu-container js-select-menu" >+ <span class="minibutton select-menu-button js-menu-target" data-hotkey="w"+ data-master-branch="master"+ data-ref="master">+ <span class="octicon octicon-git-branch"></span>+ <i>branch:</i>+ <span class="js-select-button">master</span>+ </span>++ <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax>++ <div class="select-menu-modal">+ <div class="select-menu-header">+ <span class="select-menu-title">Switch branches/tags</span>+ <span class="octicon octicon-remove-close js-menu-close"></span>+ </div> <!-- /.select-menu-header -->++ <div class="select-menu-filters">+ <div class="select-menu-text-filter">+ <input type="text" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">+ </div>+ <div class="select-menu-tabs">+ <ul>+ <li class="select-menu-tab">+ <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>+ </li>+ <li class="select-menu-tab">+ <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>+ </li>+ </ul>+ </div><!-- /.select-menu-tabs -->+ </div><!-- /.select-menu-filters -->++ <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">++ <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">+++ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/feature-horizontal-wip/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="feature-horizontal-wip" rel="nofollow" title="feature-horizontal-wip">feature-horizontal-wip</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/gh-pages/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="gh-pages" rel="nofollow" title="gh-pages">gh-pages</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item selected">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/master/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" rel="nofollow" title="master">master</a>+ </div> <!-- /.select-menu-item -->+ </div>++ <div class="select-menu-no-results">Nothing to show</div>+ </div> <!-- /.select-menu-list -->++ <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">+ <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">+++ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.7.3/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.7.3" rel="nofollow" title="0.7.3">0.7.3</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.7.2/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.7.2" rel="nofollow" title="0.7.2">0.7.2</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.7.1/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.7.1" rel="nofollow" title="0.7.1">0.7.1</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.7/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.7" rel="nofollow" title="0.7">0.7</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.9/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.9" rel="nofollow" title="0.6.9">0.6.9</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.8/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.8" rel="nofollow" title="0.6.8">0.6.8</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.7/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.7" rel="nofollow" title="0.6.7">0.6.7</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.6/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.6" rel="nofollow" title="0.6.6">0.6.6</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.5/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.5" rel="nofollow" title="0.6.5">0.6.5</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.4/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.4" rel="nofollow" title="0.6.4">0.6.4</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.3/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.3" rel="nofollow" title="0.6.3">0.6.3</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.2/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.2" rel="nofollow" title="0.6.2">0.6.2</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.1/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.1" rel="nofollow" title="0.6.1">0.6.1</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.6.0/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.6.0" rel="nofollow" title="0.6.0">0.6.0</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.5.9/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.5.9" rel="nofollow" title="0.5.9">0.5.9</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.5.8/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.5.8" rel="nofollow" title="0.5.8">0.5.8</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.5.7/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.5.7" rel="nofollow" title="0.5.7">0.5.7</a>+ </div> <!-- /.select-menu-item -->+ <div class="select-menu-item js-navigation-item ">+ <span class="select-menu-item-icon octicon octicon-check"></span>+ <a href="/jamesflorentino/nanoScrollerJS/blob/0.5.6/LICENSE-MIT" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.5.6" rel="nofollow" title="0.5.6">0.5.6</a>+ </div> <!-- /.select-menu-item -->+ </div>++ <div class="select-menu-no-results">Nothing to show</div>+ </div> <!-- /.select-menu-list -->++ </div> <!-- /.select-menu-modal -->+ </div> <!-- /.select-menu-modal-holder -->+</div> <!-- /.select-menu -->++ <div class="breadcrumb">+ <span class='repo-root js-repo-root'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/jamesflorentino/nanoScrollerJS" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">nanoScrollerJS</span></a></span></span><span class="separator"> / </span><strong class="final-path">LICENSE-MIT</strong> <span class="js-zeroclipboard zeroclipboard-button" data-clipboard-text="LICENSE-MIT" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>+ </div>+ </div>++++ <div class="commit file-history-tease">+ <img class="main-avatar" height="24" src="https://secure.gravatar.com/avatar/2a8dbe5e246cf844376da5c8e413d16c?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="24" />+ <span class="author"><a href="/kristerkari" rel="author">kristerkari</a></span>+ <time class="js-relative-date" datetime="2012-09-01T15:30:09-07:00" title="2012-09-01 15:30:09">September 01, 2012</time>+ <div class="commit-title">+ <a href="/jamesflorentino/nanoScrollerJS/commit/ec73fcca98b626acdf9bde5864d8f091d5b8ee84" class="message">Add Grunt as a build tool, closes</a> <a href="https://github.com/jamesflorentino/nanoScrollerJS/issues/84" class="issue-link" title="Change build tool to Grunt">#84</a>+ </div>++ <div class="participation">+ <p class="quickstat"><a href="#blob_contributors_box" rel="facebox"><strong>1</strong> contributor</a></p>++ </div>+ <div id="blob_contributors_box" style="display:none">+ <h2 class="facebox-header">Users who have contributed to this file</h2>+ <ul class="facebox-user-list">+ <li class="facebox-user-list-item">+ <img height="24" src="https://secure.gravatar.com/avatar/2a8dbe5e246cf844376da5c8e413d16c?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="24" />+ <a href="/kristerkari">kristerkari</a>+ </li>+ </ul>+ </div>+ </div>++++ <div id="files" class="bubble">+ <div class="file">+ <div class="meta">+ <div class="info">+ <span class="icon"><b class="octicon octicon-file-text"></b></span>+ <span class="mode" title="File Mode">file</span>+ <span>23 lines (19 sloc)</span>+ <span>1.06 kb</span>+ </div>+ <div class="actions">+ <div class="button-group">+ <a class="minibutton tooltipped leftwards"+ title="Clicking this button will automatically fork this project so you can edit the file"+ href="/jamesflorentino/nanoScrollerJS/edit/master/LICENSE-MIT"+ data-method="post" rel="nofollow">Edit</a>+ <a href="/jamesflorentino/nanoScrollerJS/raw/master/LICENSE-MIT" class="button minibutton " id="raw-url">Raw</a>+ <a href="/jamesflorentino/nanoScrollerJS/blame/master/LICENSE-MIT" class="button minibutton ">Blame</a>+ <a href="/jamesflorentino/nanoScrollerJS/commits/master/LICENSE-MIT" class="button minibutton " rel="nofollow">History</a>+ </div><!-- /.button-group -->+ </div><!-- /.actions -->++ </div>+ <div class="blob-wrapper data type-text js-blob-data">+ <table class="file-code file-diff">+ <tr class="file-code-line">+ <td class="blob-line-nums">+ <span id="L1" rel="#L1">1</span>+<span id="L2" rel="#L2">2</span>+<span id="L3" rel="#L3">3</span>+<span id="L4" rel="#L4">4</span>+<span id="L5" rel="#L5">5</span>+<span id="L6" rel="#L6">6</span>+<span id="L7" rel="#L7">7</span>+<span id="L8" rel="#L8">8</span>+<span id="L9" rel="#L9">9</span>+<span id="L10" rel="#L10">10</span>+<span id="L11" rel="#L11">11</span>+<span id="L12" rel="#L12">12</span>+<span id="L13" rel="#L13">13</span>+<span id="L14" rel="#L14">14</span>+<span id="L15" rel="#L15">15</span>+<span id="L16" rel="#L16">16</span>+<span id="L17" rel="#L17">17</span>+<span id="L18" rel="#L18">18</span>+<span id="L19" rel="#L19">19</span>+<span id="L20" rel="#L20">20</span>+<span id="L21" rel="#L21">21</span>+<span id="L22" rel="#L22">22</span>++ </td>+ <td class="blob-line-code">+ <div class="highlight"><pre><div class='line' id='LC1'>Copyright (c) 2012 James Florentino</div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'>Permission is hereby granted, free of charge, to any person</div><div class='line' id='LC4'>obtaining a copy of this software and associated documentation</div><div class='line' id='LC5'>files (the "Software"), to deal in the Software without</div><div class='line' id='LC6'>restriction, including without limitation the rights to use,</div><div class='line' id='LC7'>copy, modify, merge, publish, distribute, sublicense, and/or sell</div><div class='line' id='LC8'>copies of the Software, and to permit persons to whom the</div><div class='line' id='LC9'>Software is furnished to do so, subject to the following</div><div class='line' id='LC10'>conditions:</div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'>The above copyright notice and this permission notice shall be</div><div class='line' id='LC13'>included in all copies or substantial portions of the Software.</div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</div><div class='line' id='LC16'>EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES</div><div class='line' id='LC17'>OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</div><div class='line' id='LC18'>NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT</div><div class='line' id='LC19'>HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,</div><div class='line' id='LC20'>WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</div><div class='line' id='LC21'>FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR</div><div class='line' id='LC22'>OTHER DEALINGS IN THE SOFTWARE.</div></pre></div>+ </td>+ </tr>+ </table>+ </div>++ </div>+ </div>++ <a href="#jump-to-line" rel="facebox[.linejump]" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>+ <div id="jump-to-line" style="display:none">+ <form accept-charset="UTF-8" class="js-jump-to-line-form">+ <input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line…">+ <button type="submit" class="button">Go</button>+ </form>+ </div>++</div>++<div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">+ <img class="js-frame-loading-spinner" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-128.gif" height="64" width="64">+</div>+++ </div>+ </div>++ </div><!-- /.repo-container -->+ <div class="modal-backdrop"></div>+ </div>+ </div><!-- /.site -->+++ <div id="footer-push"></div><!-- hack for sticky footer -->+ </div><!-- end of wrapper - hack for sticky footer -->++ <!-- footer -->+ <div id="footer">+ <div class="container clearfix">++ <dl class="footer_nav">+ <dt>GitHub</dt>+ <dd><a href="/about">About us</a></dd>+ <dd><a href="/blog">Blog</a></dd>+ <dd><a href="/contact">Contact & support</a></dd>+ <dd><a href="https://enterprise.github.com/">GitHub Enterprise</a></dd>+ <dd><a href="https://status.github.com/">Site status</a></dd>+ </dl>++ <dl class="footer_nav">+ <dt>Applications</dt>+ <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>+ <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>+ <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>+ <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>+ </dl>++ <dl class="footer_nav">+ <dt>Services</dt>+ <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>+ <dd><a href="https://speakerdeck.com">Speaker Deck: Presentations</a></dd>+ <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>+ <dd><a href="https://jobs.github.com/">Job board</a></dd>+ </dl>++ <dl class="footer_nav">+ <dt>Documentation</dt>+ <dd><a href="https://help.github.com/">GitHub Help</a></dd>+ <dd><a href="http://developer.github.com/">Developer API</a></dd>+ <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>+ <dd><a href="http://pages.github.com/">GitHub Pages</a></dd>+ </dl>++ <dl class="footer_nav">+ <dt>More</dt>+ <dd><a href="http://training.github.com/">Training</a></dd>+ <dd><a href="/edu">Students & teachers</a></dd>+ <dd><a href="http://shop.github.com">The Shop</a></dd>+ <dd><a href="/plans">Plans & pricing</a></dd>+ <dd><a href="http://octodex.github.com/">The Octodex</a></dd>+ </dl>++ <hr class="footer-divider">+++ <p class="right">© 2013 <span title="0.07279s from fe17.rs.github.com">GitHub</span>, Inc. All rights reserved.</p>+ <a class="left" href="/">+ <span class="mega-octicon octicon-mark-github"></span>+ </a>+ <ul id="legal">+ <li><a href="/site/terms">Terms of Service</a></li>+ <li><a href="/site/privacy">Privacy</a></li>+ <li><a href="/security">Security</a></li>+ </ul>++ </div><!-- /.container -->++</div><!-- /.#footer -->+++ <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">+ <div class="fullscreen-container js-fullscreen-container">+ <div class="textarea-wrap">+ <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>+ <div class="suggester-container">+ <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"+ data-url="/jamesflorentino/nanoScrollerJS/suggestions/commit">+ </div>+ </div>+ </div>+ </div>+ <div class="fullscreen-sidebar">+ <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">+ <span class="mega-octicon octicon-screen-normal"></span>+ </a>+ <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"+ title="Switch themes">+ <span class="octicon octicon-color-mode"></span>+ </a>+ </div>+</div>++++ <div id="ajax-error-message" class="flash flash-error">+ <span class="octicon octicon-alert"></span>+ <a href="#" class="octicon octicon-remove-close close ajax-error-dismiss"></a>+ Something went wrong with that request. Please try again.+ </div>+++ <span id='server_response_time' data-time='0.07330' data-host='fe17'></span>++ </body>+</html>+diff --git a/data/libs/jquerynanoscroller/jquery.nanoscroller.js b/data/libs/jquerynanoscroller/jquery.nanoscroller.jsnew file mode 100644index 000000000..b022f3a06--- /dev/null+++ b/data/libs/jquerynanoscroller/jquery.nanoscroller.js@@ -0,0 +1,823 @@+/*! nanoScrollerJS - v0.7.3 - 2013+* http://jamesflorentino.github.com/nanoScrollerJS/+* Copyright (c) 2013 James Florentino; Licensed MIT */+(function($, window, document) {+ "use strict";+ var BROWSER_IS_IE7, BROWSER_SCROLLBAR_WIDTH, DOMSCROLL, DOWN, DRAG, KEYDOWN, KEYUP, MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEWHEEL, NanoScroll, PANEDOWN, RESIZE, SCROLL, SCROLLBAR, TOUCHMOVE, UP, WHEEL, defaults, getBrowserScrollbarWidth;++ defaults = {+ /**+ a classname for the pane element.+ @property paneClass+ @type String+ @default 'pane'+ */++ paneClass: 'pane',+ /**+ a classname for the slider element.+ @property sliderClass+ @type String+ @default 'slider'+ */++ sliderClass: 'slider',+ /**+ a classname for the content element.+ @property contentClass+ @type String+ @default 'content'+ */++ contentClass: 'content',+ /**+ a setting to enable native scrolling in iOS devices.+ @property iOSNativeScrolling+ @type Boolean+ @default false+ */++ iOSNativeScrolling: false,+ /**+ a setting to prevent the rest of the page being+ scrolled when user scrolls the `.content` element.+ @property preventPageScrolling+ @type Boolean+ @default false+ */++ preventPageScrolling: false,+ /**+ a setting to disable binding to the resize event.+ @property disableResize+ @type Boolean+ @default false+ */++ disableResize: false,+ /**+ a setting to make the scrollbar always visible.+ @property alwaysVisible+ @type Boolean+ @default false+ */++ alwaysVisible: false,+ /**+ a default timeout for the `flash()` method.+ @property flashDelay+ @type Number+ @default 1500+ */++ flashDelay: 1500,+ /**+ a minimum height for the `.slider` element.+ @property sliderMinHeight+ @type Number+ @default 20+ */++ sliderMinHeight: 20,+ /**+ a maximum height for the `.slider` element.+ @property sliderMaxHeight+ @type Number+ @default null+ */++ sliderMaxHeight: null,+ /**+ an alternate document context.+ @property documentContext+ @type Document+ @default null+ */++ documentContext: null,+ /**+ an alternate window context.+ @property windowContext+ @type Window+ @default null+ */++ windowContext: null+ };+ /**+ @property SCROLLBAR+ @type String+ @static+ @final+ @private+ */++ SCROLLBAR = 'scrollbar';+ /**+ @property SCROLL+ @type String+ @static+ @final+ @private+ */++ SCROLL = 'scroll';+ /**+ @property MOUSEDOWN+ @type String+ @final+ @private+ */++ MOUSEDOWN = 'mousedown';+ /**+ @property MOUSEMOVE+ @type String+ @static+ @final+ @private+ */++ MOUSEMOVE = 'mousemove';+ /**+ @property MOUSEWHEEL+ @type String+ @final+ @private+ */++ MOUSEWHEEL = 'mousewheel';+ /**+ @property MOUSEUP+ @type String+ @static+ @final+ @private+ */++ MOUSEUP = 'mouseup';+ /**+ @property RESIZE+ @type String+ @final+ @private+ */++ RESIZE = 'resize';+ /**+ @property DRAG+ @type String+ @static+ @final+ @private+ */++ DRAG = 'drag';+ /**+ @property UP+ @type String+ @static+ @final+ @private+ */++ UP = 'up';+ /**+ @property PANEDOWN+ @type String+ @static+ @final+ @private+ */++ PANEDOWN = 'panedown';+ /**+ @property DOMSCROLL+ @type String+ @static+ @final+ @private+ */++ DOMSCROLL = 'DOMMouseScroll';+ /**+ @property DOWN+ @type String+ @static+ @final+ @private+ */++ DOWN = 'down';+ /**+ @property WHEEL+ @type String+ @static+ @final+ @private+ */++ WHEEL = 'wheel';+ /**+ @property KEYDOWN+ @type String+ @static+ @final+ @private+ */++ KEYDOWN = 'keydown';+ /**+ @property KEYUP+ @type String+ @static+ @final+ @private+ */++ KEYUP = 'keyup';+ /**+ @property TOUCHMOVE+ @type String+ @static+ @final+ @private+ */++ TOUCHMOVE = 'touchmove';+ /**+ @property BROWSER_IS_IE7+ @type Boolean+ @static+ @final+ @private+ */++ BROWSER_IS_IE7 = window.navigator.appName === 'Microsoft Internet Explorer' && /msie 7./i.test(window.navigator.appVersion) && window.ActiveXObject;+ /**+ @property BROWSER_SCROLLBAR_WIDTH+ @type Number+ @static+ @default null+ @private+ */++ BROWSER_SCROLLBAR_WIDTH = null;+ /**+ Returns browser's native scrollbar width+ @method getBrowserScrollbarWidth+ @return {Number} the scrollbar width in pixels+ @static+ @private+ */++ getBrowserScrollbarWidth = function() {+ var outer, outerStyle, scrollbarWidth;++ outer = document.createElement('div');+ outerStyle = outer.style;+ outerStyle.position = 'absolute';+ outerStyle.width = '100px';+ outerStyle.height = '100px';+ outerStyle.overflow = SCROLL;+ outerStyle.top = '-9999px';+ document.body.appendChild(outer);+ scrollbarWidth = outer.offsetWidth - outer.clientWidth;+ document.body.removeChild(outer);+ return scrollbarWidth;+ };+ /**+ @class NanoScroll+ @param element {HTMLElement|Node} the main element+ @param options {Object} nanoScroller's options+ @constructor+ */++ NanoScroll = (function() {+ function NanoScroll(el, options) {+ this.el = el;+ this.options = options;+ BROWSER_SCROLLBAR_WIDTH || (BROWSER_SCROLLBAR_WIDTH = getBrowserScrollbarWidth());+ this.$el = $(this.el);+ this.doc = $(this.options.documentContext || document);+ this.win = $(this.options.windowContext || window);+ this.$content = this.$el.children("." + options.contentClass);+ this.$content.attr('tabindex', 0);+ this.content = this.$content[0];+ if (this.options.iOSNativeScrolling && (this.el.style.WebkitOverflowScrolling != null)) {+ this.nativeScrolling();+ } else {+ this.generate();+ }+ this.createEvents();+ this.addEvents();+ this.reset();+ }++ /**+ Prevents the rest of the page being scrolled+ when user scrolls the `.content` element.+ @method preventScrolling+ @param event {Event}+ @param direction {String} Scroll direction (up or down)+ @private+ */+++ NanoScroll.prototype.preventScrolling = function(e, direction) {+ if (!this.isActive) {+ return;+ }+ if (e.type === DOMSCROLL) {+ if (direction === DOWN && e.originalEvent.detail > 0 || direction === UP && e.originalEvent.detail < 0) {+ e.preventDefault();+ }+ } else if (e.type === MOUSEWHEEL) {+ if (!e.originalEvent || !e.originalEvent.wheelDelta) {+ return;+ }+ if (direction === DOWN && e.originalEvent.wheelDelta < 0 || direction === UP && e.originalEvent.wheelDelta > 0) {+ e.preventDefault();+ }+ }+ };++ /**+ Enable iOS native scrolling+ */+++ NanoScroll.prototype.nativeScrolling = function() {+ this.$content.css({+ WebkitOverflowScrolling: 'touch'+ });+ this.iOSNativeScrolling = true;+ this.isActive = true;+ };++ /**+ Updates those nanoScroller properties that+ are related to current scrollbar position.+ @method updateScrollValues+ @private+ */+++ NanoScroll.prototype.updateScrollValues = function() {+ var content;++ content = this.content;+ this.maxScrollTop = content.scrollHeight - content.clientHeight;+ this.prevScrollTop = this.contentScrollTop || 0;+ this.contentScrollTop = content.scrollTop;+ if (!this.iOSNativeScrolling) {+ this.maxSliderTop = this.paneHeight - this.sliderHeight;+ this.sliderTop = this.contentScrollTop * this.maxSliderTop / this.maxScrollTop;+ }+ };++ /**+ Creates event related methods+ @method createEvents+ @private+ */+++ NanoScroll.prototype.createEvents = function() {+ var _this = this;++ this.events = {+ down: function(e) {+ _this.isBeingDragged = true;+ _this.offsetY = e.pageY - _this.slider.offset().top;+ _this.pane.addClass('active');+ _this.doc.bind(MOUSEMOVE, _this.events[DRAG]).bind(MOUSEUP, _this.events[UP]);+ return false;+ },+ drag: function(e) {+ _this.sliderY = e.pageY - _this.$el.offset().top - _this.offsetY;+ _this.scroll();+ _this.updateScrollValues();+ if (_this.contentScrollTop >= _this.maxScrollTop && _this.prevScrollTop !== _this.maxScrollTop) {+ _this.$el.trigger('scrollend');+ } else if (_this.contentScrollTop === 0 && _this.prevScrollTop !== 0) {+ _this.$el.trigger('scrolltop');+ }+ return false;+ },+ up: function(e) {+ _this.isBeingDragged = false;+ _this.pane.removeClass('active');+ _this.doc.unbind(MOUSEMOVE, _this.events[DRAG]).unbind(MOUSEUP, _this.events[UP]);+ return false;+ },+ resize: function(e) {+ _this.reset();+ },+ panedown: function(e) {+ _this.sliderY = (e.offsetY || e.originalEvent.layerY) - (_this.sliderHeight * 0.5);+ _this.scroll();+ _this.events.down(e);+ return false;+ },+ scroll: function(e) {+ if (_this.isBeingDragged) {+ return;+ }+ _this.updateScrollValues();+ if (!_this.iOSNativeScrolling) {+ _this.sliderY = _this.sliderTop;+ _this.slider.css({+ top: _this.sliderTop+ });+ }+ if (e == null) {+ return;+ }+ if (_this.contentScrollTop >= _this.maxScrollTop) {+ if (_this.options.preventPageScrolling) {+ _this.preventScrolling(e, DOWN);+ }+ if (_this.prevScrollTop !== _this.maxScrollTop) {+ _this.$el.trigger('scrollend');+ }+ } else if (_this.contentScrollTop === 0) {+ if (_this.options.preventPageScrolling) {+ _this.preventScrolling(e, UP);+ }+ if (_this.prevScrollTop !== 0) {+ _this.$el.trigger('scrolltop');+ }+ }+ },+ wheel: function(e) {+ var delta;++ if (e == null) {+ return;+ }+ delta = e.delta || e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.detail || (e.originalEvent && -e.originalEvent.detail);+ if (delta) {+ _this.sliderY += -delta / 3;+ }+ _this.scroll();+ return false;+ }+ };+ };++ /**+ Adds event listeners with jQuery.+ @method addEvents+ @private+ */+++ NanoScroll.prototype.addEvents = function() {+ var events;++ this.removeEvents();+ events = this.events;+ if (!this.options.disableResize) {+ this.win.bind(RESIZE, events[RESIZE]);+ }+ if (!this.iOSNativeScrolling) {+ this.slider.bind(MOUSEDOWN, events[DOWN]);+ this.pane.bind(MOUSEDOWN, events[PANEDOWN]).bind("" + MOUSEWHEEL + " " + DOMSCROLL, events[WHEEL]);+ }+ this.$content.bind("" + SCROLL + " " + MOUSEWHEEL + " " + DOMSCROLL + " " + TOUCHMOVE, events[SCROLL]);+ };++ /**+ Removes event listeners with jQuery.+ @method removeEvents+ @private+ */+++ NanoScroll.prototype.removeEvents = function() {+ var events;++ events = this.events;+ this.win.unbind(RESIZE, events[RESIZE]);+ if (!this.iOSNativeScrolling) {+ this.slider.unbind();+ this.pane.unbind();+ }+ this.$content.unbind("" + SCROLL + " " + MOUSEWHEEL + " " + DOMSCROLL + " " + TOUCHMOVE, events[SCROLL]);+ };++ /**+ Generates nanoScroller's scrollbar and elements for it.+ @method generate+ @chainable+ @private+ */+++ NanoScroll.prototype.generate = function() {+ var contentClass, cssRule, options, paneClass, sliderClass;++ options = this.options;+ paneClass = options.paneClass, sliderClass = options.sliderClass, contentClass = options.contentClass;+ if (!this.$el.find("" + paneClass).length && !this.$el.find("" + sliderClass).length) {+ this.$el.append("<div class=\"" + paneClass + "\"><div class=\"" + sliderClass + "\" /></div>");+ }+ this.pane = this.$el.children("." + paneClass);+ this.slider = this.pane.find("." + sliderClass);+ if (BROWSER_SCROLLBAR_WIDTH) {+ cssRule = {+ right: -BROWSER_SCROLLBAR_WIDTH+ };+ this.$el.addClass('has-scrollbar');+ }+ if (cssRule != null) {+ this.$content.css(cssRule);+ }+ return this;+ };++ /**+ @method restore+ @private+ */+++ NanoScroll.prototype.restore = function() {+ this.stopped = false;+ this.pane.show();+ this.addEvents();+ };++ /**+ Resets nanoScroller's scrollbar.+ @method reset+ @chainable+ @example+ $(".nano").nanoScroller();+ */+++ NanoScroll.prototype.reset = function() {+ var content, contentHeight, contentStyle, contentStyleOverflowY, paneBottom, paneHeight, paneOuterHeight, paneTop, parentMaxHeight, sliderHeight;++ if (this.iOSNativeScrolling) {+ this.contentHeight = this.content.scrollHeight;+ return;+ }+ if (!this.$el.find("." + this.options.paneClass).length) {+ this.generate().stop();+ }+ if (this.stopped) {+ this.restore();+ }+ content = this.content;+ contentStyle = content.style;+ contentStyleOverflowY = contentStyle.overflowY;+ if (BROWSER_IS_IE7) {+ this.$content.css({+ height: this.$content.height()+ });+ }+ contentHeight = content.scrollHeight + BROWSER_SCROLLBAR_WIDTH;+ parentMaxHeight = parseInt(this.$el.css("max-height"), 10);+ if (parentMaxHeight > 0) {+ this.$el.height("");+ this.$el.height(content.scrollHeight > parentMaxHeight ? parentMaxHeight : content.scrollHeight);+ }+ paneHeight = this.pane.outerHeight();+ paneTop = parseInt(this.pane.css('top'), 10);+ paneBottom = parseInt(this.pane.css('bottom'), 10);+ paneOuterHeight = paneHeight + paneTop + paneBottom;+ sliderHeight = Math.round(paneOuterHeight / contentHeight * paneOuterHeight);+ if (sliderHeight < this.options.sliderMinHeight) {+ sliderHeight = this.options.sliderMinHeight;+ } else if ((this.options.sliderMaxHeight != null) && sliderHeight > this.options.sliderMaxHeight) {+ sliderHeight = this.options.sliderMaxHeight;+ }+ if (contentStyleOverflowY === SCROLL && contentStyle.overflowX !== SCROLL) {+ sliderHeight += BROWSER_SCROLLBAR_WIDTH;+ }+ this.maxSliderTop = paneOuterHeight - sliderHeight;+ this.contentHeight = contentHeight;+ this.paneHeight = paneHeight;+ this.paneOuterHeight = paneOuterHeight;+ this.sliderHeight = sliderHeight;+ this.slider.height(sliderHeight);+ this.events.scroll();+ this.pane.show();+ this.isActive = true;+ if ((content.scrollHeight === content.clientHeight) || (this.pane.outerHeight(true) >= content.scrollHeight && contentStyleOverflowY !== SCROLL)) {+ this.pane.hide();+ this.isActive = false;+ } else if (this.el.clientHeight === content.scrollHeight && contentStyleOverflowY === SCROLL) {+ this.slider.hide();+ } else {+ this.slider.show();+ }+ this.pane.css({+ opacity: (this.options.alwaysVisible ? 1 : ''),+ visibility: (this.options.alwaysVisible ? 'visible' : '')+ });+ return this;+ };++ /**+ @method scroll+ @private+ @example+ $(".nano").nanoScroller({ scroll: 'top' });+ */+++ NanoScroll.prototype.scroll = function() {+ if (!this.isActive) {+ return;+ }+ this.sliderY = Math.max(0, this.sliderY);+ this.sliderY = Math.min(this.maxSliderTop, this.sliderY);+ this.$content.scrollTop((this.paneHeight - this.contentHeight + BROWSER_SCROLLBAR_WIDTH) * this.sliderY / this.maxSliderTop * -1);+ if (!this.iOSNativeScrolling) {+ this.slider.css({+ top: this.sliderY+ });+ }+ return this;+ };++ /**+ Scroll at the bottom with an offset value+ @method scrollBottom+ @param offsetY {Number}+ @chainable+ @example+ $(".nano").nanoScroller({ scrollBottom: value });+ */+++ NanoScroll.prototype.scrollBottom = function(offsetY) {+ if (!this.isActive) {+ return;+ }+ this.reset();+ this.$content.scrollTop(this.contentHeight - this.$content.height() - offsetY).trigger(MOUSEWHEEL);+ return this;+ };++ /**+ Scroll at the top with an offset value+ @method scrollTop+ @param offsetY {Number}+ @chainable+ @example+ $(".nano").nanoScroller({ scrollTop: value });+ */+++ NanoScroll.prototype.scrollTop = function(offsetY) {+ if (!this.isActive) {+ return;+ }+ this.reset();+ this.$content.scrollTop(+offsetY).trigger(MOUSEWHEEL);+ return this;+ };++ /**+ Scroll to an element+ @method scrollTo+ @param node {Node} A node to scroll to.+ @chainable+ @example+ $(".nano").nanoScroller({ scrollTo: $('#a_node') });+ */+++ NanoScroll.prototype.scrollTo = function(node) {+ if (!this.isActive) {+ return;+ }+ this.reset();+ this.scrollTop($(node).get(0).offsetTop);+ return this;+ };++ /**+ To stop the operation.+ This option will tell the plugin to disable all event bindings and hide the gadget scrollbar from the UI.+ @method stop+ @chainable+ @example+ $(".nano").nanoScroller({ stop: true });+ */+++ NanoScroll.prototype.stop = function() {+ this.stopped = true;+ this.removeEvents();+ this.pane.hide();+ return this;+ };++ /**+ Destroys nanoScroller and restores browser's native scrollbar.+ @method destroy+ @chainable+ @example+ $(".nano").nanoScroller({ destroy: true });+ */+++ NanoScroll.prototype.destroy = function() {+ if (!this.stopped) {+ this.stop();+ }+ if (this.pane.length) {+ this.pane.remove();+ }+ if (BROWSER_IS_IE7) {+ this.$content.height('');+ }+ this.$content.removeAttr('tabindex');+ if (this.$el.hasClass('has-scrollbar')) {+ this.$el.removeClass('has-scrollbar');+ this.$content.css({+ right: ''+ });+ }+ return this;+ };++ /**+ To flash the scrollbar gadget for an amount of time defined in plugin settings (defaults to 1,5s).+ Useful if you want to show the user (e.g. on pageload) that there is more content waiting for him.+ @method flash+ @chainable+ @example+ $(".nano").nanoScroller({ flash: true });+ */+++ NanoScroll.prototype.flash = function() {+ var _this = this;++ if (!this.isActive) {+ return;+ }+ this.reset();+ this.pane.addClass('flashed');+ setTimeout(function() {+ _this.pane.removeClass('flashed');+ }, this.options.flashDelay);+ return this;+ };++ return NanoScroll;++ })();+ $.fn.nanoScroller = function(settings) {+ return this.each(function() {+ var options, scrollbar;++ if (!(scrollbar = this.nanoscroller)) {+ options = $.extend({}, defaults, settings);+ this.nanoscroller = scrollbar = new NanoScroll(this, options);+ }+ if (settings && typeof settings === "object") {+ $.extend(scrollbar.options, settings);+ if (settings.scrollBottom) {+ return scrollbar.scrollBottom(settings.scrollBottom);+ }+ if (settings.scrollTop) {+ return scrollbar.scrollTop(settings.scrollTop);+ }+ if (settings.scrollTo) {+ return scrollbar.scrollTo(settings.scrollTo);+ }+ if (settings.scroll === 'bottom') {+ return scrollbar.scrollBottom(0);+ }+ if (settings.scroll === 'top') {+ return scrollbar.scrollTop(0);+ }+ if (settings.scroll && settings.scroll instanceof $) {+ return scrollbar.scrollTo(settings.scroll);+ }+ if (settings.stop) {+ return scrollbar.stop();+ }+ if (settings.destroy) {+ return scrollbar.destroy();+ }+ if (settings.flash) {+ return scrollbar.flash();+ }+ }+ return scrollbar.reset();+ });+ };+})(jQuery, window, document);++/*+//@ sourceMappingURL=jquery.nanoscroller.js.map+*/\ No newline at end of filediff --git a/data/libs/jquerynanoscroller/nanoscroller.css b/data/libs/jquerynanoscroller/nanoscroller.cssnew file mode 100644index 000000000..b0b799962--- /dev/null+++ b/data/libs/jquerynanoscroller/nanoscroller.css@@ -0,0 +1,55 @@+/** initial setup **/+.nano {+ position : relative;+ width : 100%;+ height : 100%;+ overflow : hidden;+}+.nano .content {+ position : absolute;+ overflow : scroll;+ overflow-x : hidden;+ top : 0;+ right : 0;+ bottom : 0;+ left : 0;+}+.nano .content:focus {+ outline: thin dotted;+}+.nano .content::-webkit-scrollbar {+ visibility: hidden;+}+.has-scrollbar .content::-webkit-scrollbar {+ visibility: visible;+}+.nano > .pane {+ background : rgba(0,0,0,.25);+ position : absolute;+ width : 10px;+ right : 0;+ top : 0;+ bottom : 0;+ visibility : hidden\9; /* Target only IE7 and IE8 with this hack */+ opacity : .01;+ -webkit-transition : .2s;+ -moz-transition : .2s;+ -o-transition : .2s;+ transition : .2s;+ -moz-border-radius : 5px;+ -webkit-border-radius : 5px;+ border-radius : 5px;+}+.nano > .pane > .slider {+ background: #444;+ background: rgba(0,0,0,.5);+ position : relative;+ margin : 0 1px;+ -moz-border-radius : 3px;+ -webkit-border-radius : 3px;+ border-radius : 3px;+}+.nano:hover > .pane, .pane.active, .pane.flashed {+ visibility : visible\9; /* Target only IE7 and IE8 with this hack */+ opacity : 0.99;+}diff --git a/data/libs/linqjs/ReadMe.txt b/data/libs/linqjs/ReadMe.txtnew file mode 100644index 000000000..d76dae787--- /dev/null+++ b/data/libs/linqjs/ReadMe.txt@@ -0,0 +1,364 @@+/*--------------------------------------------------------------------------+ * linq.js - LINQ for JavaScript+ * ver 3.0.4-Beta5 (Jun. 20th, 2013)+ *+ * created and maintained by neuecc <[email protected]>+ * licensed under MIT License+ * http://linqjs.codeplex.com/+ *------------------------------------------------------------------------*/++2013-06-20 v3.0.4-Beta5+add TypeScript Generic definition.+rename linq.js.d.ts -> linq.d.ts+add cast<T> method(for TypeScript)+improved:cache generated string lambda function.++//++2012-10-09 v3.0.3-Beta4++add TypeScript type declaraion file(typescript/linq.js.d.ts, linq.jquery.d.ts)++//++2012-09-16 s/v3.0.2-RC/v3.0.2-Beta3/::Notice++fix orderByDescending to stable sort+remove scan resultSelector overload+rename tojQueryRaw to tojQueryAsArray+flip argument of firstOrDefault,lastOrDefault,singleOrDefault. first is predicate, second is defaultValue.+defaultValue of orDefault changed to null+Enumerable.choice and Enumerable.cycle allow Enumerable+Enumerable.from supports IIterable<T>(WinMD)+argument of alternate allows Enumerable+add AMD support("linqjs")+improved fit to latest RxJS(on GitHub Sep 10, 2012 version)+repositry convert to git++//++2012-07-26 v3.0.1-Beta2::Notice++fix bug indexOf+writeLine overload back to v2+fixed bug, extendTo(Array) isn't optimized for Array+fixed bug, defer define "enumerator" to global+indexOf, lastIndexOf allow predicate+changed Enumerable.from(object) enumerate only own property+improvement all code snippets+add isExpr to linq.qunit.js++//++2012-07-19 v3 Beta::Notice++all methods rename UpperCamelCase to lowerCamelCase++following methods are changed name+Return -> make+CascadeBreadthFirst -> traverseBreadthFirst+CascadeDepthFirst -> traverseDepthFirst+BufferWithCount -> buffer+ToString -> toJoinedString+Do -> doAction+Let -> letBind+MemoizeAll -> memoize+Catch -> catchError+Finally -> finallyAction+ToJSON -> toJSONString++following methods are changed behavior+writeLine : document.write(value + "<br />") -> document.writeln(value), overload changed+zip, concat allow multiple arguments++add utility methods+Enumerable.Utils.createLambda+Enumerable.Utils.createEnumerable+Enumerable.Utils.createEnumerator+Enumerable.Utils.extendTo++add enumerable methods+Enumerable.defer+merge+asEnumerable+choose+isEmpty+distinctUntilChanged+weightedSample+log++performance optimization+where->select and where->where,... and select->select,...+range, rangeDown, rangeTo++add new extension+linq.qunit.js++fix extensions to latest library version+linq.jquery.js+linq.rx.js++removed jQuery plugin version++licence changed Ms-PL to MIT++--++//+++Features+* implement all .NET 4.0 methods and many extra methods (inspiration from Rx, Achiral, Haskell, Ruby, etc...)+* complete lazy evaluation+* Full IntelliSense support for VisualStudio+* two versions - linq.js(Normal) and jquery.linq.js(jQuery plugin)+* support Windows Script Host+* binding for Reactive Extensions for JavaScript(RxJS)+* NuGet install support(linq.js, linq.js-jQuery, linq.js-Bindings)++Tutorial++linq.js+---+ <script type="text/javascript" src="linq.js"></script>+ <script type="text/javascript">+ // load linq.js -> Enumerable+ Enumerable.Range(1,10)....+ </script>++jQuery.linq.js (jQuery plugin)+---+ <script type="text/javascript" src="jquery.js"></script>+ <script type="text/javascript" src="jquery.linq.js"></script>+ <script type="text/javascript">+ // load jquery.linq.js -> $.Enumerable+ $.Enumerable.Range(1,10)....+ </script>++ jQuery plugin version is added two methods.+ * Enumerable.prototype.TojQuery (Enumerable to jQuery object)+ * jQuery.prototype.toEnumerable (jQuery object to Eunmerable)++bindings/linq.jquery.js+---+ <script type="text/javascript" src="linq.js"></script>+ <script type="text/javascript" src="jquery.js"></script>+ <script type="text/javascript" src="linq.jquery.js"></script>+ <script type="text/javascript">+ Enumerable.Range(1,10).TojQuery()...+ </script>++ jQuery Bindings added two methods(TojQuery and toEnumerable)+ There are same as plugin version.++binding/linq.rx.js+---+ more tutorial see linq.js CodePlex's Documentation++ <script type="text/javascript" src="rx.js"></script>+ <script type="text/javascript" src="linq.js"></script>+ <script type="text/javascript" src="linq.rx.js"></script>++ or++ <script type="text/javascript" src="rx.js"></script>+ <script type="text/javascript" src="jquery.js"></script>+ <script type="text/javascript" src="jquery.linq.js"></script>+ <script type="text/javascript" src="linq.rx.js"></script>++-vsdoc.js+---+ Visual Studio 2010 - as is.+ Visual Studio 2008 - install SP1 and Patch KB958502.++ linq-vsdoc.js(or jquery.linq-vsdoc.js) puts in same directory.++ if not html then write xml referrence tag on top.+ for example+ /// <reference path="linq.js" />++for Windows Script Host+---+ create wsf file.+ example++ <job id="Main">+ <script language="JScript" src="linq.js"></script>+ <script language="JScript">+ var dir = WScript.CreateObject("Scripting.FileSystemObject").GetFolder("C:\\");++ var itemNames = Enumerable.From(dir.SubFolders)+ .Concat(dir.Files)+ .Select("$.Name")+ .ToArray();+ </script>+ </job>++How to use CodeSnippets+---+ open Visual Studio 2010's Code Snippet Manager(Ctrl+K, Ctrl+B)+ click import button and select snippets/*.snippet++ func0 = function () { return /*cursor*/}+ func1 = function (x) { return /*cursor*/}+ func2 = function (x, y) { return /*cursor*/}+ action0 = function () { /*cursor*/}+ action1 = function (x) { /*cursor*/}+ action2 = function (x, y) { /*cursor*/}+ efrom = Enumerable.From()+ erange = Enumerable.Range()+ jqfrom = $.Enumerable.From()+ jqrange = $.Enumerable.Range()++// history++2011-01-21 ver 2.2.0.2+ Add+ bindings/linq.jquery.js+ Info+ NuGet Package Added to NuGet Gallery++2011-01-18 ver 2.2.0.1+ Change+ ToObservable(linq.rx.js) receive scheduler+ OrderBy optimized performance+ minifier/jQuery genereted by F# Script+ Bug Fix+ remove two not declared var++2010-06-28 ver 2.2.0.0+ Add Method+ TakeFromLast+ ToJSON+ Add File+ rewrite all tests from JSUnit to QUnit+ binding for RxJS(Reactive Extensions for JavaScript)+ add RxVSDocGenerator(rx-vsdoc.js generator for RxJS)+ add code snippets for Visual Studio+ Change+ wrap array (Enumerable.From(array)) optimized performance+ Grouping optimized performance+ Enumerable.From(array)'s array allow function element+ if TakeExceptLast's count under 0 then return all sequence+ add default iterator variable's second, third, fourth($$, $$$, $$$$)+ Bug Fix+ MemoizeAll can't work when sequence contains undefined+ Sum can't work when sequence is empty(fixed return 0)+ vsdoc's Grouping elementSelector is short of summary++2010-05-18 ver 2.1.0.0+ Add Class+ Dictionary+ Lookup+ Grouping+ OrderedEnumerable++ Add Method+ ToDictionary+ MemoizeAll+ Share+ Let++ Add Overload+ Join (compareKey)+ GroupJoin (compareKey)+ GroupBy (compareKey)+ PartitionBy (compareKey)+ ToLookup (compareKey)++ Breaking Change+ return type of ToLookup -> from Array to Lookup+ Enumerate type of GroupBy,PartitionBy -> from KeyValuePair to Grouping++ Change+ implimentation of OrderBy/ThenBy changed CLR compatible (maybe...)++ Bug Fix+ GroupBy Key auto converts to string+ All set methods do not distinction between boolean and string and number+ Scan and All Paging Methods do not work if sequence contains undefined++2010-04-23 ver 2.0.0.0+ all code rewrite from scratch.+ enumerator support Dispose.++ namespace changed+ E, Linq.Enumerable -> Enumerable++ delete methods+ ToJSON+ ToTable+ TraceF+ RangeDownTo++ rename methods+ ZipWith -> Zip+ Slice -> BufferWithCount+ Times -> Generate++ change methods+ From (add argument - WSH's IEnumerable)+ Trace (write to console.log)+ RangeTo (contains downto)+ OrderBy/ThenBy (support string sort)++ add methods+ MaxBy+ MinBy+ OfType+ Catch+ Finally+ PartitionBy+ Alternate+ TakeExceptLast+ RepeatWithFinalize++ add files+ jquery.linq.js+ and minifier file by Microsoft Ajax Minifier(-HC)++ delete files+ linq.xml.js (move to branches)+ linq.tools.js (move to branches and rename linq.utils.js)++2009-06-15 ver 1.3.0.2+ Add Make, CascadeDepthFirst/CascadeBreadthFirst.+ ForEach support continue/break.++2009-06-05 ver 1.3.0.1+ IntelliSense Support.+ dom functional construction(Linq to Xml).++2009-05-24 ver 1.3.0.0+ Add - Unfold, Matches, Insert, IndexOf, LastIndexOf+ Change - From<String>+ Add linq.tools.js - Stopwatch.Bench, StringBuilder.Reverse, HashSet++2009-05-17 ver 1.2.0.3+ Add linq.tools.js - Stopwatch, DateUtility.IsLeapYear, DateUtility.DaysInMonth++2009-05-16 ver 1.2.0.2+ Add new Sample - linq.tools.js++2009-05-07 ver 1.2.0.1+ FixBug - ToJSON+ Add - Times+ Add Overload step - Range, RangeDown, RangeTo, RangeDownTo, ToInfinity, ToNegativeInfinity++2009-04-26 ver 1.2.0.0+ FixBug - Set Operations(Disctint,Union,Intersect,Except)+ FixBug - ToJSON+ Add compareSelector - Contains, Distinct, Except, Intersect, SequenceEqual, Union++2009-04-19 ver 1.1.0.0+ Add new Sample - linqfader+ Add linq.xml.js++2009-04-10 ver 1.0.0.1+ Add - Choice+ Add - RangeTo+ Add - RangeDownTo+ Fix - Cycle++2009-04-04+ 1st Release\ No newline at end of filediff --git a/data/libs/linqjs/linq-vsdoc.js b/data/libs/linqjs/linq-vsdoc.jsnew file mode 100644index 000000000..7812fa284--- /dev/null+++ b/data/libs/linqjs/linq-vsdoc.js@@ -0,0 +1,3656 @@+/*--------------------------------------------------------------------------+ * linq.js - LINQ for JavaScript+ * ver 3.0.4-Beta5 (Jun. 20th, 2013)+ *+ * created and maintained by neuecc <[email protected]>+ * licensed under MIT License+ * http://linqjs.codeplex.com/+ *------------------------------------------------------------------------*/++(function (root, undefined) {+ // ReadOnly Function+ var Functions = {+ Identity: function (x) { return x; },+ True: function () { return true; },+ Blank: function () { }+ };++ // const Type+ var Types = {+ Boolean: typeof true,+ Number: typeof 0,+ String: typeof "",+ Object: typeof {},+ Undefined: typeof undefined,+ Function: typeof function () { }+ };++ // createLambda cache+ var funcCache = { "": Functions.Identity };++ // private utility methods+ var Utils = {+ // Create anonymous function from lambda expression string+ createLambda: function (expression) {+ if (expression == null) return Functions.Identity;+ if (typeof expression === Types.String) {+ // get from cache+ var f = funcCache[expression];+ if (f != null) {+ return f;+ }++ if (expression.indexOf("=>") === -1) {+ var regexp = new RegExp("[$]+", "g");++ var maxLength = 0;+ var match;+ while ((match = regexp.exec(expression)) != null) {+ var paramNumber = match[0].length;+ if (paramNumber > maxLength) {+ maxLength = paramNumber;+ }+ }++ var argArray = [];+ for (var i = 1; i <= maxLength; i++) {+ var dollar = "";+ for (var j = 0; j < i; j++) {+ dollar += "$";+ }+ argArray.push(dollar);+ }++ var args = Array.prototype.join.call(argArray, ",");++ f = new Function(args, "return " + expression);+ funcCache[expression] = f;+ return f;+ }+ else {+ var expr = expression.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/);+ f = new Function(expr[1], "return " + expr[2]);+ funcCache[expression] = f;+ return f;+ }+ }+ return expression;+ },++ // IE8's defineProperty is defined but cannot use, therefore check defineProperties+ defineProperty: (Object.defineProperties != null)+ ? function (target, methodName, value) {+ Object.defineProperty(target, methodName, {+ enumerable: false,+ configurable: true,+ writable: true,+ value: value+ })+ }+ : function (target, methodName, value) {+ target[methodName] = value;+ },++ compare: function (a, b) {+ return (a === b) ? 0+ : (a > b) ? 1+ : -1;+ },++ dispose: function (obj) {+ if (obj != null) obj.dispose();+ }+ };++ // IEnumerator State+ var State = { Before: 0, Running: 1, After: 2 };++ // "Enumerator" is conflict JScript's "Enumerator"+ var IEnumerator = function (initialize, tryGetNext, dispose) {+ var yielder = new Yielder();+ var state = State.Before;++ this.current = yielder.current;++ this.moveNext = function () {+ /// <summary>Advances the enumerator to the next element of the collection.</summary>+ /// <returns type="Boolean"></returns>+ try {+ switch (state) {+ case State.Before:+ state = State.Running;+ initialize();+ // fall through+ case State.Running:+ if (tryGetNext.apply(yielder)) {+ return true;+ }+ else {+ this.dispose();+ return false;+ }+ case State.After:+ return false;+ }+ }+ catch (e) {+ this.dispose();+ throw e;+ }+ };++ this.dispose = function () {+ /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>+ /// <returns type="void"></returns>+ if (state != State.Running) return;++ try {+ dispose();+ }+ finally {+ state = State.After;+ }+ };+ };++ // for tryGetNext+ var Yielder = function () {+ var current = null;+ this.current = function () {+ /// <summary>Gets the element in the collection at the current position of the enumerator.</summary>+ /// <returns type="T"></returns>+ return current;+ };+ this.yieldReturn = function (value) {+ /// <summary>Set the value to enumerator and return true.</summary>+ /// <returns type="Boolean"></returns>+ current = value;+ return true;+ };+ this.yieldBreak = function () {+ /// <summary>return false.</summary>+ /// <returns type="Boolean"></returns>+ return false;+ };+ };++ // Enumerable constuctor+ var Enumerable = function (getEnumerator) {+ /// <summary>Entry point of linq.js all methods.</summary>+ /// <field name="getEnumerator" type="Function">Returns an enumerator that iterates through the collection.</field>+ this.getEnumerator = getEnumerator;++ if (intellisense) this.firstOrDefault(); // for intellisense+ };++ // Utility++ Enumerable.Utils = {}; // container++ Enumerable.Utils.createLambda = function (expression) {+ /// <signature>+ /// <summary>Returns the identity function such as function(x){ return x; }</summary>+ /// <param name="expression">null or undefined</param>+ /// <returns type="Function"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Returns the same function.</summary>+ /// <param name="expression" type="Function">function</param>+ /// <returns type="Function"></returns>+ /// </signature>+ /// <signature>+ /// <summary>+ /// Make function from string.+ /// 1. "" as function(x) { return x; }+ /// 2. "arg1, arg2,...,=> body" as lambda expression+ /// 3. "$ $$ $$$..." as lambda expression($ is default iterator variable)+ /// </summary>+ /// <param name="expression" type="String">lambda expression</param>+ /// <returns type="Function"></returns>+ /// </signature>+ /// <summary>+ /// Make function from string.+ /// 1. null = function(x){ return x; }.+ /// 2. Function = Function.+ /// 3. "" = function(x){ return x; }.+ /// 4. "arg1, arg2,...,=> body" as lambda expression+ /// 5. "$ $$ $$$..." as lambda expression($ is default iterator variable)+ /// </summary>+ /// <param name="expression" type="String">lambda expression</param>+ /// <returns type="Function"></returns>++ return Utils.createLambda(expression);+ };++ Enumerable.Utils.createEnumerable = function (getEnumerator) {+ /// <summary>+ /// Create anonymous enumerable.+ /// </summary>+ /// <param name="getEnumerator" type="Func<IEnumerator>">getEnumerator factory</param>+ /// <returns type="Enumerable"></returns>+ return new Enumerable(getEnumerator);+ };++ Enumerable.Utils.createEnumerator = function (initialize, tryGetNext, dispose) {+ /// <summary>+ /// Create anonymous enumerator.+ /// </summary>+ /// <param name="initialize" type="Action">Invoke when enumerator called moveNext at first.</param>+ /// <param name="tryGetNext" type="Action">+ /// Invoke when enumerator called moveNext.+ /// return this.yieldReturn(x); then moveNext success and set current() on x.+ /// return this.yieldBreak(); then moveNext fail.+ /// Usage: return (enumerator.moveNext()) ? this.yieldReturn(enumerator.current()) : this.yieldBreak();+ /// </param>+ /// <param name="dispose" type="Action">Invoke when enumerator called dispose.</param>+ /// <returns type="IEnumerator"></returns>+ return new IEnumerator(initialize, tryGetNext, dispose);+ };++ Enumerable.Utils.extendTo = function (type) {+ /// <summary>+ /// Extend all enumerable methods to prototype of type.+ /// If execution environment(e.g. browser) supports Object.defineProperty then use defineProperty and option "enumerable:false".+ /// Otherwise extends type.prototype directly.+ /// Usage: Enumerable.Utils.extendTo(Array);+ /// </summary>+ /// <param name="type" type="Constructor">Type Constructor.</param>+ /// <returns type="void"></returns>+ var typeProto = type.prototype;+ var enumerableProto;++ if (type === Array) {+ enumerableProto = ArrayEnumerable.prototype;+ Utils.defineProperty(typeProto, "getSource", function () {+ return this;+ });+ }+ else {+ enumerableProto = Enumerable.prototype;+ Utils.defineProperty(typeProto, "getEnumerator", function () {+ return Enumerable.from(this).getEnumerator();+ });+ }++ for (var methodName in enumerableProto) {+ var func = enumerableProto[methodName];++ // already extended+ if (typeProto[methodName] == func) continue;++ // already defined(example Array#reverse/join/forEach...)+ if (typeProto[methodName] != null) {+ methodName = methodName + "ByLinq";+ if (typeProto[methodName] == func) continue; // recheck+ }++ if (func instanceof Function) {+ Utils.defineProperty(typeProto, methodName, func);+ }+ }+ };++ // Generator++ Enumerable.choice = function (elements) // variable argument+ {+ /// <signature>+ /// <summary>+ /// Random choice from arguments.+ /// Usage: choice(1,2,3) => 1,3,2,3,3,2,1...+ /// Usage: choice([1,2,3]) => 1,3,2,3,3,2,1...+ /// </summary>+ /// <param type="params T[]" name="elements">Array or variable elements</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>+ /// Random choice from arguments.+ /// Usage: choice(Enumerable.range(1,3)) => 1,3,2,3,3,2,1...+ /// </summary>+ /// <param type="Enumerable" name="elements">Enumerable elements</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>+ /// Random choice from arguments.+ /// Usage: choice(1,2,3) => 1,3,2,3,3,2,1...+ /// Usage: choice([1,2,3]) => 1,3,2,3,3,2,1...+ /// </summary>+ /// <param type="params T[]" name="elements">Array or Enumerable or variable elements</param>+ /// <returns type="Enumerable"></returns>+ var args = arguments;++ return new Enumerable(function () {+ return new IEnumerator(+ function () {+ args = (args[0] instanceof Array) ? args[0]+ : (args[0].getEnumerator != null) ? args[0].toArray()+ : args;+ },+ function () {+ return this.yieldReturn(args[Math.floor(Math.random() * args.length)]);+ },+ Functions.Blank);+ });+ };++ Enumerable.cycle = function (elements) // variable argument+ {+ /// <signature>+ /// <summary>+ /// Cycle repeat from arguments.+ /// Usage: cycle(1,2,3) => 1,2,3,1,2,3,1,2,3...+ /// Usage: cycle([1,2,3]) => 1,2,3,1,2,3,1,2,3...+ /// </summary>+ /// <param type="params T[]" name="elements">Array or variable elements</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>+ /// Cycle repeat from arguments.+ /// Usage: cycle(Enumerable.range(1,3)) => 1,2,3,1,2,3,1,2,3...+ /// </summary>+ /// <param type="Enumerable" name="elements">Enumerable elements</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>+ /// Cycle repeat from arguments.+ /// Usage: cycle(1,2,3) => 1,2,3,1,2,3,1,2,3...+ /// Usage: cycle([1,2,3]) => 1,2,3,1,2,3,1,2,3...+ /// </summary>+ /// <param type="params T[]" name="elements">Array or Enumerable or variable elements</param>+ /// <returns type="Enumerable"></returns>+ var args = arguments;++ return new Enumerable(function () {+ var index = 0;+ return new IEnumerator(+ function () {+ args = (args[0] instanceof Array) ? args[0]+ : (args[0].getEnumerator != null) ? args[0].toArray()+ : args;+ },+ function () {+ if (index >= args.length) index = 0;+ return this.yieldReturn(args[index++]);+ },+ Functions.Blank);+ });+ };++ Enumerable.empty = function () {+ /// <summary>Returns an empty Enumerable.</summary>+ /// <returns type="Enumerable"></returns>+ return new Enumerable(function () {+ return new IEnumerator(+ Functions.Blank,+ function () { return false; },+ Functions.Blank);+ });+ };++ Enumerable.from = function (obj) {+ /// <signature>+ /// <summary>Make empty enumerable from null or undefined.</summary>+ /// <param name="blankObject">null or undefined</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Returns the same object.</summary>+ /// <param name="enumerable" type="Enumerable">Enumerable object</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Make the single enumerable.</summary>+ /// <param name="number" type="Number">Number primitive</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Make the single enumerable.</summary>+ /// <param name="boolean" type="Boolean">Boolean primitive</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>+ /// Make charactor sequence.+ /// Usage: "abc" => "a", "b", "c"+ /// </summary>+ /// <param name="str" type="String">String primitive</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>+ /// Make own property to KeyValuePair sequence.+ /// Usage: "{a:0}" => (.key = "a", .value = 0).+ /// </summary>+ /// <param name="obj" type="Object">JavaScript object</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Make Enumerable sequence.</summary>+ /// <param name="array" type="Array">Array or ArrayLikeObject(has length)</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Make Enumerable using JScript's Enumerator.</summary>+ /// <param name="ienumerable">JScript's IEnumerable</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Make Enumerable using IIterator<T>.</summary>+ /// <param name="iiterable">WinMD's IIterable<T></param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>+ /// Make Enumerable from obj.+ /// 1. null = Enumerable.empty().+ /// 2. Enumerable = Enumerable.+ /// 3. Number/Boolean = Enumerable.repeat(obj, 1).+ /// 4. String = to CharArray. Usage: "abc" => "a","b","c").+ /// 5. Object/Function = own property to KeyValuePairs. Usage: "{a:0}" => (.key = "a", .value = 0).+ /// 6. Array or ArrayLikeObject(has length) = to Enumerable.+ /// 7. JScript's IEnumerable = to Enumerable(using Enumerator).+ /// 8. WinMD's IIterable<T> = to Enumerable(using IIterator<T>).+ /// </summary>+ /// <param name="obj">object</param>+ /// <returns type="Enumerable"></returns>++ if (obj == null) {+ return Enumerable.empty();+ }+ if (obj instanceof Enumerable) {+ return obj;+ }+ if (typeof obj == Types.Number || typeof obj == Types.Boolean) {+ return Enumerable.repeat(obj, 1);+ }+ if (typeof obj == Types.String) {+ return new Enumerable(function () {+ var index = 0;+ return new IEnumerator(+ Functions.Blank,+ function () {+ return (index < obj.length) ? this.yieldReturn(obj.charAt(index++)) : false;+ },+ Functions.Blank);+ });+ }+ if (typeof obj != Types.Function) {+ // array or array like object+ if (typeof obj.length == Types.Number) {+ return new ArrayEnumerable(obj);+ }++ // JScript's IEnumerable+ if (!(obj instanceof Object) && Utils.isIEnumerable(obj)) {+ return new Enumerable(function () {+ var isFirst = true;+ var enumerator;+ return new IEnumerator(+ function () { enumerator = new Enumerator(obj); },+ function () {+ if (isFirst) isFirst = false;+ else enumerator.moveNext();++ return (enumerator.atEnd()) ? false : this.yieldReturn(enumerator.item());+ },+ Functions.Blank);+ });+ }++ // WinMD IIterable<T>+ if (typeof Windows === Types.Object && typeof obj.first === Types.Function) {+ return new Enumerable(function () {+ var isFirst = true;+ var enumerator;+ return new IEnumerator(+ function () { enumerator = obj.first(); },+ function () {+ if (isFirst) isFirst = false;+ else enumerator.moveNext();++ return (enumerator.hasCurrent) ? this.yieldReturn(enumerator.current) : this.yieldBreak();+ },+ Functions.Blank);+ });+ }+ }++ // case function/object : Create keyValuePair[]+ return new Enumerable(function () {+ var array = [];+ var index = 0;++ return new IEnumerator(+ function () {+ for (var key in obj) {+ var value = obj[key];+ if (!(value instanceof Function) && Object.prototype.hasOwnProperty.call(obj, key)) {+ array.push({ key: key, value: value });+ }+ }+ },+ function () {+ return (index < array.length)+ ? this.yieldReturn(array[index++])+ : false;+ },+ Functions.Blank);+ });+ },++ Enumerable.make = function (element) {+ /// <summary>Make one sequence. This equals repeat(element, 1)</summary>+ /// <param name="element" type="T">element</param>+ /// <returns type="Enumerable"></returns>+ return Enumerable.repeat(element, 1);+ };++ Enumerable.matches = function (input, pattern, flags) {+ /// <summary>+ /// Global regex match and send regexp object.+ /// Usage: matches((.)z,"0z1z2z") => $[1] = 0,1,2+ /// </summary>+ /// <param type="String" name="input">input string</param>+ /// <param type="RegExp/String" name="pattern">RegExp or Pattern string</param>+ /// <param type="String" name="flags" optional="true">If pattern is String then can use regexp flags "i"(ignoreCase) or "m"(multiLine) or "im"(both)</param>+ /// <returns type="Enumerable"></returns>+ if (flags == null) flags = "";+ if (pattern instanceof RegExp) {+ flags += (pattern.ignoreCase) ? "i" : "";+ flags += (pattern.multiline) ? "m" : "";+ pattern = pattern.source;+ }+ if (flags.indexOf("g") === -1) flags += "g";++ return new Enumerable(function () {+ var regex;+ return new IEnumerator(+ function () { regex = new RegExp(pattern, flags); },+ function () {+ var match = regex.exec(input);+ return (match) ? this.yieldReturn(match) : false;+ },+ Functions.Blank);+ });+ };++ Enumerable.range = function (start, count, step) {+ /// <summary>+ /// Generates a sequence of integral numbers within a specified range.+ /// Usage: range(1,5) => 1,2,3,4,5+ /// </summary>+ /// <param type="Number" integer="true" name="start">The value of the first integer in the sequence.</param>+ /// <param type="Number" integer="true" name="count">The number of sequential integers to generate.</param>+ /// <param type="Number" integer="true" name="step" optional="true">Step of generate number. Usage: range(0,3,5) => 0,5,10</param>+ /// <returns type="Enumerable"></returns>+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ var index = 0;++ return new IEnumerator(+ function () { value = start - step; },+ function () {+ return (index++ < count)+ ? this.yieldReturn(value += step)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ };++ Enumerable.rangeDown = function (start, count, step) {+ /// <summary>+ /// Generates a sequence of integral numbers within a specified range.+ /// Usage: rangeDown(5,5) => 5,4,3,2,1+ /// </summary>+ /// <param type="Number" integer="true" name="start">The value of the first integer in the sequence.</param>+ /// <param type="Number" integer="true" name="count">The number of sequential integers to generate.</param>+ /// <param type="Number" integer="true" name="step" optional="true">Step of generate number. Usage: rangeDown(0,3,5) => 0,-5,-10</param>+ /// <returns type="Enumerable"></returns>+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ var index = 0;++ return new IEnumerator(+ function () { value = start + step; },+ function () {+ return (index++ < count)+ ? this.yieldReturn(value -= step)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ };++ Enumerable.rangeTo = function (start, to, step) {+ /// <summary>Generates a sequence of integral numbers.+ /// Usage: rangeTo(10, 12) => 10,11,12 | rangeTo(0, -2) => 0, -1, -2</summary>+ /// <param type="Number" integer="true" name="start">start integer</param>+ /// <param type="Number" integer="true" name="to">to integer</param>+ /// <param type="Number" integer="true" name="step" optional="true">Step of generate number. Usage: rangeTo(0, 7, 3) => 0,3,6</param>+ /// <returns type="Enumerable"></returns>++ if (step == null) step = 1;++ if (start < to) {+ return new Enumerable(function () {+ var value;++ return new IEnumerator(+ function () { value = start - step; },+ function () {+ var next = value += step;+ return (next <= to)+ ? this.yieldReturn(next)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ }+ else {+ return new Enumerable(function () {+ var value;++ return new IEnumerator(+ function () { value = start + step; },+ function () {+ var next = value -= step;+ return (next >= to)+ ? this.yieldReturn(next)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ }+ };++ Enumerable.repeat = function (element, count) {+ /// <summary>+ /// Generates a sequence that contains one repeated value.+ /// If omit count then generate to infinity.+ /// Usage: repeat("foo", 3) => "foo","foo","foo"+ /// </summary>+ /// <param type="T" name="element">The value to be repeated.</param>+ /// <param type="Number" integer="true" name="count" optional="true">The number of times to repeat the value in the generated sequence.</param>+ /// <returns type="Enumerable"></returns>+ if (count != null) return Enumerable.repeat(element).take(count);++ return new Enumerable(function () {+ return new IEnumerator(+ Functions.Blank,+ function () { return this.yieldReturn(element); },+ Functions.Blank);+ });+ };++ Enumerable.repeatWithFinalize = function (initializer, finalizer) {+ /// <summary>Lazy Generates one value by initializer's result and do finalize when enumerate end.</summary>+ /// <param type="Func<T>" name="initializer">value factory.</param>+ /// <param type="Action<T>" name="finalizer">execute when finalize.</param>+ /// <returns type="Enumerable"></returns>+ initializer = Utils.createLambda(initializer);+ finalizer = Utils.createLambda(finalizer);++ return new Enumerable(function () {+ var element;+ return new IEnumerator(+ function () { element = initializer(); },+ function () { return this.yieldReturn(element); },+ function () {+ if (element != null) {+ finalizer(element);+ element = null;+ }+ });+ });+ };++ Enumerable.generate = function (func, count) {+ /// <summary>+ /// Generates a sequence that execute func value.+ /// If omit count then generate to infinity.+ /// Usage: generate("Math.random()", 5) => 0.131341,0.95425252,...+ /// </summary>+ /// <param type="Func<T>" name="func">The value of execute func to be repeated.</param>+ /// <param type="Number" integer="true" name="count" optional="true">The number of times to repeat the value in the generated sequence.</param>+ /// <returns type="Enumerable"></returns>+ if (count != null) return Enumerable.generate(func).take(count);+ func = Utils.createLambda(func);++ return new Enumerable(function () {+ return new IEnumerator(+ Functions.Blank,+ function () { return this.yieldReturn(func()); },+ Functions.Blank);+ });+ };++ Enumerable.toInfinity = function (start, step) {+ /// <summary>+ /// Generates a sequence of integral numbers to infinity.+ /// Usage: toInfinity() => 0,1,2,3...+ /// </summary>+ /// <param type="Number" integer="true" name="start" optional="true">start integer.</param>+ /// <param type="Number" integer="true" name="step" optional="true">Step of generate number. Usage: toInfinity(10,3) => 10,13,16,19,...</param>+ /// <returns type="Enumerable"></returns>+ if (start == null) start = 0;+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ return new IEnumerator(+ function () { value = start - step; },+ function () { return this.yieldReturn(value += step); },+ Functions.Blank);+ });+ };++ Enumerable.toNegativeInfinity = function (start, step) {+ /// <summary>+ /// Generates a sequence of integral numbers to negative infinity.+ /// Usage: toNegativeInfinity() => 0,-1,-2,-3...+ /// </summary>+ /// <param type="Number" integer="true" name="start" optional="true">start integer.</param>+ /// <param type="Number" integer="true" name="step" optional="true">Step of generate number. Usage: toNegativeInfinity(10,3) => 10,7,4,1,...</param>+ /// <returns type="Enumerable"></returns>+ if (start == null) start = 0;+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ return new IEnumerator(+ function () { value = start + step; },+ function () { return this.yieldReturn(value -= step); },+ Functions.Blank);+ });+ };++ Enumerable.unfold = function (seed, func) {+ /// <summary>+ /// Applies function and generates a infinity sequence.+ /// Usage: unfold(3, "$+10") => 3,13,23,...</summary>+ /// <param type="T" name="seed">The initial accumulator value.</param>+ /// <param type="Func<T,T>" name="func">An accumulator function to be invoked on each element.</param>+ /// <returns type="Enumerable"></returns>+ func = Utils.createLambda(func);++ return new Enumerable(function () {+ var isFirst = true;+ var value;+ return new IEnumerator(+ Functions.Blank,+ function () {+ if (isFirst) {+ isFirst = false;+ value = seed;+ return this.yieldReturn(value);+ }+ value = func(value);+ return this.yieldReturn(value);+ },+ Functions.Blank);+ });+ };++ Enumerable.defer = function (enumerableFactory) {+ /// <summary>+ /// Make enumerable enumerableFactory as need.+ /// Usage: defer(function(){ return [1,2,3] })</summary>+ /// <param type="Function" name="enumerableFactory">Enumerable factory, function returns array or enumerable.</param>+ /// <returns type="Enumerable"></returns>++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = Enumerable.from(enumerableFactory()).getEnumerator(); },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : this.yieldBreak();+ },+ function () {+ Utils.dispose(enumerator);+ });+ });+ };++ // Extension Methods++ /* Projection and Filtering Methods */++ Enumerable.prototype.traverseBreadthFirst = function (func, resultSelector) {+ /// <summary>Projects each element of sequence and flattens the resulting sequences into one sequence use breadth first search.</summary>+ /// <param name="func" type="Func<TSource,Enumerable<TCollection>>">Select child sequence.</param>+ /// <param name="resultSelector" type="Func<TCollection,int,TResult>" optional="true">A transform function to apply to each element of the intermediate sequence.; Optional:the second parameter of the function represents the nestlevel of the source element.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ func = Utils.createLambda(func);+ resultSelector = Utils.createLambda(resultSelector);++ return new Enumerable(function () {+ var enumerator;+ var nestLevel = 0;+ var buffer = [];++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (true) {+ if (enumerator.moveNext()) {+ buffer.push(enumerator.current());+ return this.yieldReturn(resultSelector(enumerator.current(), nestLevel));+ }++ var next = Enumerable.from(buffer).selectMany(function (x) { return func(x); });+ if (!next.any()) {+ return false;+ }+ else {+ nestLevel++;+ buffer = [];+ Utils.dispose(enumerator);+ enumerator = next.getEnumerator();+ }+ }+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.traverseDepthFirst = function (func, resultSelector) {+ /// <summary>Projects each element of sequence and flattens the resulting sequences into one sequence use depth first search.</summary>+ /// <param name="func" type="Func<TSource,Enumerable<TCollection>>">Select child sequence.</param>+ /// <param name="resultSelector" type="Func<TCollection,int,TResult>" optional="true">A transform function to apply to each element of the intermediate sequence.; Optional:the second parameter of the function represents the nestlevel of the source element.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ func = Utils.createLambda(func);+ resultSelector = Utils.createLambda(resultSelector);++ return new Enumerable(function () {+ var enumeratorStack = [];+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (true) {+ if (enumerator.moveNext()) {+ var value = resultSelector(enumerator.current(), enumeratorStack.length);+ enumeratorStack.push(enumerator);+ enumerator = Enumerable.from(func(enumerator.current())).getEnumerator();+ return this.yieldReturn(value);+ }++ if (enumeratorStack.length <= 0) return false;+ Utils.dispose(enumerator);+ enumerator = enumeratorStack.pop();+ }+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Enumerable.from(enumeratorStack).forEach(function (s) { s.dispose(); });+ }+ });+ });+ };++ Enumerable.prototype.flatten = function () {+ /// <summary>Flatten sequences into one sequence.</summary>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var middleEnumerator = null;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (true) {+ if (middleEnumerator != null) {+ if (middleEnumerator.moveNext()) {+ return this.yieldReturn(middleEnumerator.current());+ }+ else {+ middleEnumerator = null;+ }+ }++ if (enumerator.moveNext()) {+ if (enumerator.current() instanceof Array) {+ Utils.dispose(middleEnumerator);+ middleEnumerator = Enumerable.from(enumerator.current())+ .selectMany(Functions.Identity)+ .flatten()+ .getEnumerator();+ continue;+ }+ else {+ return this.yieldReturn(enumerator.current());+ }+ }++ return false;+ }+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Utils.dispose(middleEnumerator);+ }+ });+ });+ };++ Enumerable.prototype.pairwise = function (selector) {+ /// <summary>Projects current and next element of a sequence into a new form.</summary>+ /// <param type="Func<TSource,TSource,TResult>" name="selector">A transform function to apply to current and next element.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ selector = Utils.createLambda(selector);++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ enumerator.moveNext();+ },+ function () {+ var prev = enumerator.current();+ return (enumerator.moveNext())+ ? this.yieldReturn(selector(prev, enumerator.current()))+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.scan = function (seed, func) {+ /// <signature>+ /// <summary>Applies an accumulator function over a sequence.</summary>+ /// <param name="func" type="Func<TSource,TSource,TSource>">An accumulator function to be invoked on each element.</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Applies an accumulator function over a sequence.</summary>+ /// <param name="seed" type="TAccumulate">the initial accumulator value.</param>+ /// <param name="func" type="Func<TAccumulate,TSource,TAccumulate>">An accumulator function to be invoked on each element.</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>Applies an accumulator function over a sequence.</summary>+ /// <param name="seed" type="Func<T,T,T>_or_TAccumulate">Func is an accumulator function to be invoked on each element. Seed is the initial accumulator value.</param>+ /// <param name="func" type="Optional:Func<TAccumulate,T,TAccumulate>" optional="true">An accumulator function to be invoked on each element.</param>+ /// <returns type="Enumerable"></returns>+ var isUseSeed;+ if (func == null) {+ func = Utils.createLambda(seed); // arguments[0]+ isUseSeed = false;+ }+ else {+ func = Utils.createLambda(func);+ isUseSeed = true;+ }+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var value;+ var isFirst = true;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (isFirst) {+ isFirst = false;+ if (!isUseSeed) {+ if (enumerator.moveNext()) {+ return this.yieldReturn(value = enumerator.current());+ }+ }+ else {+ return this.yieldReturn(value = seed);+ }+ }++ return (enumerator.moveNext())+ ? this.yieldReturn(value = func(value, enumerator.current()))+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(selector<element>)+ // Overload:function(selector<element,index>)+ Enumerable.prototype.select = function (selector) {+ /// <summary>Projects each element of a sequence into a new form.</summary>+ /// <param name="selector" type="Func<T,int,T>">A transform function to apply to each source element; Optional:the second parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ selector = Utils.createLambda(selector);++ if (selector.length <= 1) {+ return new WhereSelectEnumerable(this, null, selector);+ }+ else {+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(selector(enumerator.current(), index++))+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ }+ };++ // Overload:function(collectionSelector<element>)+ // Overload:function(collectionSelector<element,index>)+ // Overload:function(collectionSelector<element>,resultSelector)+ // Overload:function(collectionSelector<element,index>,resultSelector)+ Enumerable.prototype.selectMany = function (collectionSelector, resultSelector) {+ /// <summary>Projects each element of a sequence and flattens the resulting sequences into one sequence.</summary>+ /// <param name="collectionSelector" type="Func<T,int,TCollection[]>">A transform function to apply to each source element; Optional:the second parameter of the function represents the index of the source element.</param>+ /// <param name="resultSelector" type="Func<T,TCollection,TResult>" optional="true">A transform function to apply to each element of the intermediate sequence.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ collectionSelector = Utils.createLambda(collectionSelector);+ if (resultSelector == null) resultSelector = function (a, b) { return b; };+ resultSelector = Utils.createLambda(resultSelector);++ return new Enumerable(function () {+ var enumerator;+ var middleEnumerator = undefined;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (middleEnumerator === undefined) {+ if (!enumerator.moveNext()) return false;+ }+ do {+ if (middleEnumerator == null) {+ var middleSeq = collectionSelector(enumerator.current(), index++);+ middleEnumerator = Enumerable.from(middleSeq).getEnumerator();+ }+ if (middleEnumerator.moveNext()) {+ return this.yieldReturn(resultSelector(enumerator.current(), middleEnumerator.current()));+ }+ Utils.dispose(middleEnumerator);+ middleEnumerator = null;+ } while (enumerator.moveNext());+ return false;+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Utils.dispose(middleEnumerator);+ }+ });+ });+ };++ // Overload:function(predicate<element>)+ // Overload:function(predicate<element,index>)+ Enumerable.prototype.where = function (predicate) {+ /// <summary>Filters a sequence of values based on a predicate.</summary>+ /// <param name="predicate" type="Func<T,int,bool>">A function to test each source element for a condition; Optional:the second parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ predicate = Utils.createLambda(predicate);++ if (predicate.length <= 1) {+ return new WhereEnumerable(this, predicate);+ }+ else {+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (predicate(enumerator.current(), index++)) {+ return this.yieldReturn(enumerator.current());+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ }+ };++ // Overload:function(selector<element>)+ // Overload:function(selector<element,index>)+ Enumerable.prototype.choose = function (selector) {+ /// <summary>Projection and filter if projected value is null or undefined.</summary>+ /// <param name="selector" type="Func<T,int,TR>">A transform function; Optional:the second parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ selector = Utils.createLambda(selector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ var result = selector(enumerator.current(), index++);+ if (result != null) {+ return this.yieldReturn(result);+ }+ }+ return this.yieldBreak();+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.ofType = function (type) {+ /// <summary>Filters the elements based on a specified type.</summary>+ /// <param name="type" type="T">The type to filter the elements of the sequence on.</param>+ /// <returns type="Enumerable"></returns>+ var typeName;+ switch (type) {+ case Number:+ typeName = Types.Number;+ break;+ case String:+ typeName = Types.String;+ break;+ case Boolean:+ typeName = Types.Boolean;+ break;+ case Function:+ typeName = Types.Function;+ break;+ default:+ typeName = null;+ break;+ }+ return (typeName === null)+ ? this.where(function (x) { return x instanceof type; })+ : this.where(function (x) { return typeof x === typeName; });+ };++ // mutiple arguments, last one is selector, others are enumerable+ Enumerable.prototype.zip = function (_elements, _selector) {+ /// <signature>+ /// <summary>Merges many sequences by using the specified selector. The last argument is selector.</summary>+ /// <param type="params Enumerable<T>[]" name="elements">The multiple sequence to merge.</param>+ /// <param name="selector" type="Func<TFirst,TSecond,TThird,...,int,TResult>">A function that specifies how to merge the elements from the many sequences. Optional:the last parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>Merges many sequences by using the specified selector. The last argument is selector.</summary>+ /// <param type="params_Enumerable<T>" name="_elements">The multiple sequence to merge.</param>+ /// <param name="_selector" type="Func<TFirst,TSecond,TThird,...,int,TResult>">A function that specifies how to merge the elements from the many sequences. Optional:the last parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ var args = arguments;+ var selector = Utils.createLambda(arguments[arguments.length - 1]);++ var source = this;+ // optimized case:argument is 2+ if (arguments.length == 2) {+ var second = arguments[0];++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;+ var index = 0;++ return new IEnumerator(+ function () {+ firstEnumerator = source.getEnumerator();+ secondEnumerator = Enumerable.from(second).getEnumerator();+ },+ function () {+ if (firstEnumerator.moveNext() && secondEnumerator.moveNext()) {+ return this.yieldReturn(selector(firstEnumerator.current(), secondEnumerator.current(), index++));+ }+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ } finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ }+ else {+ return new Enumerable(function () {+ var enumerators;+ var index = 0;++ return new IEnumerator(+ function () {+ var array = Enumerable.make(source)+ .concat(Enumerable.from(args).takeExceptLast().select(Enumerable.from))+ .select(function (x) { return x.getEnumerator() })+ .toArray();+ enumerators = Enumerable.from(array);+ },+ function () {+ if (enumerators.all(function (x) { return x.moveNext() })) {+ var array = enumerators+ .select(function (x) { return x.current() })+ .toArray();+ array.push(index++);+ return this.yieldReturn(selector.apply(null, array));+ }+ else {+ return this.yieldBreak();+ }+ },+ function () {+ Enumerable.from(enumerators).forEach(Utils.dispose);+ });+ });+ }+ };++ // mutiple arguments+ Enumerable.prototype.merge = function (_elements) {+ /// <signature>+ /// <summary>+ /// Merges many sequences in turn. Target sequence is variable.+ /// Usage: seqX.merge(seqY, seqZ) => [x, y, z, x, y, z, x, y,....]+ /// </summary>+ /// <param type="params Enumerable<T>[]" name="elements">The multiple sequence to merge.</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>+ /// Merges many sequences in turn. Target sequence is variable.+ /// Usage: seqX.merge(seqY, seqZ) => [x, y, z, x, y, z, x, y,....]+ /// </summary>+ /// <param type="params_Enumerable<T>" name="_elements">The multiple sequence to merge.</param>+ /// <returns type="Enumerable"></returns>+ var args = arguments;+ var source = this;++ return new Enumerable(function () {+ var enumerators;+ var index = -1;++ return new IEnumerator(+ function () {+ enumerators = Enumerable.make(source)+ .concat(Enumerable.from(args).select(Enumerable.from))+ .select(function (x) { return x.getEnumerator() })+ .toArray();+ },+ function () {+ while (enumerators.length > 0) {+ index = (index >= enumerators.length - 1) ? 0 : index + 1;+ var enumerator = enumerators[index];++ if (enumerator.moveNext()) {+ return this.yieldReturn(enumerator.current());+ }+ else {+ enumerator.dispose();+ enumerators.splice(index--, 1);+ }+ }+ return this.yieldBreak();+ },+ function () {+ Enumerable.from(enumerators).forEach(Utils.dispose);+ });+ });+ };++ /* Join Methods */++ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector)+ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector)+ Enumerable.prototype.join = function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector) {+ /// <summary>Correlates the elements of two sequences based on matching keys.</summary>+ /// <param name="inner" type="Enumerable<T>">The sequence to join to the first sequence.</param>+ /// <param name="outerKeySelector" type="Func<TOuter,TKey>">A function to extract the join key from each element of the first sequence.</param>+ /// <param name="innerKeySelector" type="Func<TInner,TKey>">A function to extract the join key from each element of the second sequence.</param>+ /// <param name="resultSelector" type="Func<TOuter,TInner,TResult>">A function to create a result element from two matching elements.</param>+ /// <param name="compareSelector" type="Func<TKey,TCompare>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ outerKeySelector = Utils.createLambda(outerKeySelector);+ innerKeySelector = Utils.createLambda(innerKeySelector);+ resultSelector = Utils.createLambda(resultSelector);+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var outerEnumerator;+ var lookup;+ var innerElements = null;+ var innerCount = 0;++ return new IEnumerator(+ function () {+ outerEnumerator = source.getEnumerator();+ lookup = Enumerable.from(inner).toLookup(innerKeySelector, Functions.Identity, compareSelector);+ },+ function () {+ while (true) {+ if (innerElements != null) {+ var innerElement = innerElements[innerCount++];+ if (innerElement !== undefined) {+ return this.yieldReturn(resultSelector(outerEnumerator.current(), innerElement));+ }++ innerElement = null;+ innerCount = 0;+ }++ if (outerEnumerator.moveNext()) {+ var key = outerKeySelector(outerEnumerator.current());+ innerElements = lookup.get(key).toArray();+ } else {+ return false;+ }+ }+ },+ function () { Utils.dispose(outerEnumerator); });+ });+ };++ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector)+ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector)+ Enumerable.prototype.groupJoin = function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector) {+ /// <summary>Correlates the elements of two sequences based on equality of keys and groups the results.</summary>+ /// <param name="inner" type="T[]">The sequence to join to the first sequence.</param>+ /// <param name="outerKeySelector" type="Func<TOuter>">A function to extract the join key from each element of the first sequence.</param>+ /// <param name="innerKeySelector" type="Func<TInner>">A function to extract the join key from each element of the second sequence.</param>+ /// <param name="resultSelector" type="Func<TOuter,Enumerable<TInner>,TResult">A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.</param>+ /// <param name="compareSelector" type="Func<TKey,TCompare>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ outerKeySelector = Utils.createLambda(outerKeySelector);+ innerKeySelector = Utils.createLambda(innerKeySelector);+ resultSelector = Utils.createLambda(resultSelector);+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator = source.getEnumerator();+ var lookup = null;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ lookup = Enumerable.from(inner).toLookup(innerKeySelector, Functions.Identity, compareSelector);+ },+ function () {+ if (enumerator.moveNext()) {+ var innerElement = lookup.get(outerKeySelector(enumerator.current()));+ return this.yieldReturn(resultSelector(enumerator.current(), innerElement));+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ /* Set Methods */++ Enumerable.prototype.all = function (predicate) {+ /// <summary>Determines whether all elements of a sequence satisfy a condition.</summary>+ /// <param type="Func<T,bool>" name="predicate">A function to test each element for a condition.</param>+ /// <returns type="Boolean"></returns>+ predicate = Utils.createLambda(predicate);++ var result = true;+ this.forEach(function (x) {+ if (!predicate(x)) {+ result = false;+ return false; // break+ }+ });+ return result;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.any = function (predicate) {+ /// <summary>Determines whether a sequence contains any elements or any element of a sequence satisfies a condition.</summary>+ /// <param name="predicate" type="Func<T,bool>" optional="true">A function to test each element for a condition.</param>+ /// <returns type="Boolean"></returns>+ predicate = Utils.createLambda(predicate);++ var enumerator = this.getEnumerator();+ try {+ if (arguments.length == 0) return enumerator.moveNext(); // case:function()++ while (enumerator.moveNext()) // case:function(predicate)+ {+ if (predicate(enumerator.current())) return true;+ }+ return false;+ }+ finally {+ Utils.dispose(enumerator);+ }+ };++ Enumerable.prototype.isEmpty = function () {+ /// <summary>Check the Sequence is empty.</summary>+ /// <returns type="Boolean"></returns>+ return !this.any();+ };++ // multiple arguments+ Enumerable.prototype.concat = function (_elements) {+ /// <signature>+ /// <summary>Concatenates many sequences.</summary>+ /// <param name="elements" type="params Enumerable<T>[]">The sequences to concatenate to the first sequence.</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>Concatenates many sequences.</summary>+ /// <param name="_elements" type="params_Enumerable<T>[]">The sequences to concatenate to the first sequence.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;++ if (arguments.length == 1) {+ var second = arguments[0];++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;++ return new IEnumerator(+ function () { firstEnumerator = source.getEnumerator(); },+ function () {+ if (secondEnumerator == null) {+ if (firstEnumerator.moveNext()) return this.yieldReturn(firstEnumerator.current());+ secondEnumerator = Enumerable.from(second).getEnumerator();+ }+ if (secondEnumerator.moveNext()) return this.yieldReturn(secondEnumerator.current());+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ }+ else {+ var args = arguments;++ return new Enumerable(function () {+ var enumerators;++ return new IEnumerator(+ function () {+ enumerators = Enumerable.make(source)+ .concat(Enumerable.from(args).select(Enumerable.from))+ .select(function (x) { return x.getEnumerator() })+ .toArray();+ },+ function () {+ while (enumerators.length > 0) {+ var enumerator = enumerators[0];++ if (enumerator.moveNext()) {+ return this.yieldReturn(enumerator.current());+ }+ else {+ enumerator.dispose();+ enumerators.splice(0, 1);+ }+ }+ return this.yieldBreak();+ },+ function () {+ Enumerable.from(enumerators).forEach(Utils.dispose);+ });+ });+ }+ };++ Enumerable.prototype.insert = function (index, second) {+ /// <summary>Merge two sequences.</summary>+ /// <param name="index" type="Number" integer="true">The index of insert start position.</param>+ /// <param name="second" type="Enumerable<T>">The sequence to concatenate to the first sequence.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;+ var count = 0;+ var isEnumerated = false;++ return new IEnumerator(+ function () {+ firstEnumerator = source.getEnumerator();+ secondEnumerator = Enumerable.from(second).getEnumerator();+ },+ function () {+ if (count == index && secondEnumerator.moveNext()) {+ isEnumerated = true;+ return this.yieldReturn(secondEnumerator.current());+ }+ if (firstEnumerator.moveNext()) {+ count++;+ return this.yieldReturn(firstEnumerator.current());+ }+ if (!isEnumerated && secondEnumerator.moveNext()) {+ return this.yieldReturn(secondEnumerator.current());+ }+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ };++ Enumerable.prototype.alternate = function (alternateValueOrSequence) {+ /// <signature>+ /// <summary>+ /// Insert value to between sequence.+ /// Usage: [1,2,3].alternate(0) => 1,0,2,0,3+ /// </summary>+ /// <param name="alternateValue" type="T">The value of insert.</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <signature>+ /// <summary>+ /// Insert value to between sequence.+ /// Usage: [1,2,3].alternate([-1,-2]) => 1,-1,-2,2,-1,-2,3+ /// </summary>+ /// <param name="alternateSequence" type="Enumerable<T>">The values of insert.</param>+ /// <returns type="Enumerable"></returns>+ /// </signature>+ /// <summary>+ /// Insert value to between sequence.+ /// Usage: [1,2,3].alternate(0) => 1,0,2,0,3+ /// Usage: [1,2,3].alternate([-1,-2]) => 1,-1,-2,2,-1,-2,3+ /// </summary>+ /// <param name="alternateValueOrSequence" type="T_or_Enumerable<T>">The value(or values) of insert.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var buffer;+ var enumerator;+ var alternateSequence;+ var alternateEnumerator;++ return new IEnumerator(+ function () {+ if (alternateValueOrSequence instanceof Array || alternateValueOrSequence.getEnumerator != null) {+ alternateSequence = Enumerable.from(Enumerable.from(alternateValueOrSequence).toArray()); // freeze+ }+ else {+ alternateSequence = Enumerable.make(alternateValueOrSequence);+ }+ enumerator = source.getEnumerator();+ if (enumerator.moveNext()) buffer = enumerator.current();+ },+ function () {+ while (true) {+ if (alternateEnumerator != null) {+ if (alternateEnumerator.moveNext()) {+ return this.yieldReturn(alternateEnumerator.current());+ }+ else {+ alternateEnumerator = null;+ }+ }++ if (buffer == null && enumerator.moveNext()) {+ buffer = enumerator.current(); // hasNext+ alternateEnumerator = alternateSequence.getEnumerator();+ continue; // GOTO+ }+ else if (buffer != null) {+ var retVal = buffer;+ buffer = null;+ return this.yieldReturn(retVal);+ }++ return this.yieldBreak();+ }+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Utils.dispose(alternateEnumerator);+ }+ });+ });+ };++ // Overload:function(value)+ // Overload:function(value, compareSelector)+ Enumerable.prototype.contains = function (value, compareSelector) {+ /// <summary>Determines whether a sequence contains a specified element.</summary>+ /// <param name="value" type="T">The value to locate in the sequence.</param>+ /// <param name="compareSelector" type="Func<T,TKey>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Boolean"></returns>+ compareSelector = Utils.createLambda(compareSelector);+ var enumerator = this.getEnumerator();+ try {+ while (enumerator.moveNext()) {+ if (compareSelector(enumerator.current()) === value) return true;+ }+ return false;+ }+ finally {+ Utils.dispose(enumerator);+ }+ };++ Enumerable.prototype.defaultIfEmpty = function (defaultValue) {+ /// <summary>Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.+ /// default of defautValue is null.</summary>+ /// <param name="defaultValue" type="T" optional="true">The value to return if the sequence is empty.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ if (defaultValue === undefined) defaultValue = null;++ return new Enumerable(function () {+ var enumerator;+ var isFirst = true;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (enumerator.moveNext()) {+ isFirst = false;+ return this.yieldReturn(enumerator.current());+ }+ else if (isFirst) {+ isFirst = false;+ return this.yieldReturn(defaultValue);+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function()+ // Overload:function(compareSelector)+ Enumerable.prototype.distinct = function (compareSelector) {+ /// <summary>Returns distinct elements from a sequence.</summary>+ /// <param name="compareSelector" type="Func<T,TKey>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ return this.except(Enumerable.empty(), compareSelector);+ };++ Enumerable.prototype.distinctUntilChanged = function (compareSelector) {+ /// <summary>Returns distinct continuous elements from a sequence.</summary>+ /// <param name="compareSelector" type="Func<T,TKey>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var compareKey;+ var initial;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ },+ function () {+ while (enumerator.moveNext()) {+ var key = compareSelector(enumerator.current());++ if (initial) {+ initial = false;+ compareKey = key;+ return this.yieldReturn(enumerator.current());+ }++ if (compareKey === key) {+ continue;+ }++ compareKey = key;+ return this.yieldReturn(enumerator.current());+ }+ return this.yieldBreak();+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(second)+ // Overload:function(second, compareSelector)+ Enumerable.prototype.except = function (second, compareSelector) {+ /// <summary>Produces the set difference of two sequences.</summary>+ /// <param name="second" type="Enumerable<T>">An Enumerable<T> whose Elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param>+ /// <param name="compareSelector" type="Func<T,TKey>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var keys;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ keys = new Dictionary(compareSelector);+ Enumerable.from(second).forEach(function (key) { keys.add(key); });+ },+ function () {+ while (enumerator.moveNext()) {+ var current = enumerator.current();+ if (!keys.contains(current)) {+ keys.add(current);+ return this.yieldReturn(current);+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(second)+ // Overload:function(second, compareSelector)+ Enumerable.prototype.intersect = function (second, compareSelector) {+ /// <summary>Produces the set difference of two sequences.</summary>+ /// <param name="second" type="Enumerable<T>">An Enumerable<T> whose distinct elements that also appear in the first sequence will be returned.</param>+ /// <param name="compareSelector" type="Func<T,TKey>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var keys;+ var outs;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();++ keys = new Dictionary(compareSelector);+ Enumerable.from(second).forEach(function (key) { keys.add(key); });+ outs = new Dictionary(compareSelector);+ },+ function () {+ while (enumerator.moveNext()) {+ var current = enumerator.current();+ if (!outs.contains(current) && keys.contains(current)) {+ outs.add(current);+ return this.yieldReturn(current);+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(second)+ // Overload:function(second, compareSelector)+ Enumerable.prototype.sequenceEqual = function (second, compareSelector) {+ /// <summary>Determines whether two sequences are equal by comparing the elements.</summary>+ /// <param name="second" type="Enumerable<T>">An Enumerable<T> to compare to the first sequence.</param>+ /// <param name="compareSelector" type="Func<T,TKey>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ compareSelector = Utils.createLambda(compareSelector);++ var firstEnumerator = this.getEnumerator();+ try {+ var secondEnumerator = Enumerable.from(second).getEnumerator();+ try {+ while (firstEnumerator.moveNext()) {+ if (!secondEnumerator.moveNext()+ || compareSelector(firstEnumerator.current()) !== compareSelector(secondEnumerator.current())) {+ return false;+ }+ }++ if (secondEnumerator.moveNext()) return false;+ return true;+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ }+ finally {+ Utils.dispose(firstEnumerator);+ }+ };++ Enumerable.prototype.union = function (second, compareSelector) {+ /// <summary>Produces the union of two sequences.</summary>+ /// <param name="second" type="Enumerable<T>">An Enumerable<T> whose distinct elements form the second set for the union.</param>+ /// <param name="compareSelector" type="Func<T,TKey>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;+ var keys;++ return new IEnumerator(+ function () {+ firstEnumerator = source.getEnumerator();+ keys = new Dictionary(compareSelector);+ },+ function () {+ var current;+ if (secondEnumerator === undefined) {+ while (firstEnumerator.moveNext()) {+ current = firstEnumerator.current();+ if (!keys.contains(current)) {+ keys.add(current);+ return this.yieldReturn(current);+ }+ }+ secondEnumerator = Enumerable.from(second).getEnumerator();+ }+ while (secondEnumerator.moveNext()) {+ current = secondEnumerator.current();+ if (!keys.contains(current)) {+ keys.add(current);+ return this.yieldReturn(current);+ }+ }+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ };++ /* Ordering Methods */++ Enumerable.prototype.orderBy = function (keySelector) {+ /// <signature>+ /// <summary>Sorts the elements of a sequence in ascending order according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract a key from an element.</param>+ /// <returns type="OrderedEnumerable"></returns>+ /// </signature>+ /// <summary>Sorts the elements of a sequence in ascending order according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract a key from an element.</param>+ return new OrderedEnumerable(this, keySelector, false);+ };++ Enumerable.prototype.orderByDescending = function (keySelector) {+ /// <signature>+ /// <summary>Sorts the elements of a sequence in descending order according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract a key from an element.</param>+ /// <returns type="OrderedEnumerable"></returns>+ /// </signature>+ /// <summary>Sorts the elements of a sequence in descending order according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract a key from an element.</param>+ return new OrderedEnumerable(this, keySelector, true);+ };++ Enumerable.prototype.reverse = function () {+ /// <summary>Inverts the order of the elements in a sequence.</summary>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var buffer;+ var index;++ return new IEnumerator(+ function () {+ buffer = source.toArray();+ index = buffer.length;+ },+ function () {+ return (index > 0)+ ? this.yieldReturn(buffer[--index])+ : false;+ },+ Functions.Blank);+ });+ };++ Enumerable.prototype.shuffle = function () {+ /// <summary>Shuffle sequence.</summary>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var buffer;++ return new IEnumerator(+ function () { buffer = source.toArray(); },+ function () {+ if (buffer.length > 0) {+ var i = Math.floor(Math.random() * buffer.length);+ return this.yieldReturn(buffer.splice(i, 1)[0]);+ }+ return false;+ },+ Functions.Blank);+ });+ };++ Enumerable.prototype.weightedSample = function (weightSelector) {+ /// <summary>Weighted sampling sequence by weightSelector. The result is infinite sequence.</summary>+ /// <param name="weightSelector" type="Func<T,TKey>" optional="true">A function to select a weight from an element.</param>+ /// <returns type="Enumerable"></returns>+ weightSelector = Utils.createLambda(weightSelector);+ var source = this;++ return new Enumerable(function () {+ var sortedByBound;+ var totalWeight = 0;++ return new IEnumerator(+ function () {+ sortedByBound = source+ .choose(function (x) {+ var weight = weightSelector(x);+ if (weight <= 0) return null; // ignore 0++ totalWeight += weight;+ return { value: x, bound: totalWeight };+ })+ .toArray();+ },+ function () {+ if (sortedByBound.length > 0) {+ var draw = Math.floor(Math.random() * totalWeight) + 1;++ var lower = -1;+ var upper = sortedByBound.length;+ while (upper - lower > 1) {+ var index = Math.floor((lower + upper) / 2);+ if (sortedByBound[index].bound >= draw) {+ upper = index;+ }+ else {+ lower = index;+ }+ }++ return this.yieldReturn(sortedByBound[upper].value);+ }++ return this.yieldBreak();+ },+ Functions.Blank);+ });+ };++ /* Grouping Methods */++ // Overload:function(keySelector)+ // Overload:function(keySelector,elementSelector)+ // Overload:function(keySelector,elementSelector,resultSelector)+ // Overload:function(keySelector,elementSelector,resultSelector,compareSelector)+ Enumerable.prototype.groupBy = function (keySelector, elementSelector, resultSelector, compareSelector) {+ /// <summary>Groups the elements of a sequence according to a specified key selector function.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract the key for each element.</param>+ /// <param name="elementSelector" type="Func<T,TElement>" optional="true">A function to map each source element to an element in an Grouping<TKey, TElement>.</param>+ /// <param name="resultSelector" type="Func<TKey,Enumerable<TElement>,TResult>" optional="true">A function to create a result value from each group.</param>+ /// <param name="compareSelector" type="Func<TKey,TCompare>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ if (resultSelector != null) resultSelector = Utils.createLambda(resultSelector);+ compareSelector = Utils.createLambda(compareSelector);++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () {+ enumerator = source.toLookup(keySelector, elementSelector, compareSelector)+ .toEnumerable()+ .getEnumerator();+ },+ function () {+ while (enumerator.moveNext()) {+ return (resultSelector == null)+ ? this.yieldReturn(enumerator.current())+ : this.yieldReturn(resultSelector(enumerator.current().key(), enumerator.current()));+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(keySelector)+ // Overload:function(keySelector,elementSelector)+ // Overload:function(keySelector,elementSelector,resultSelector)+ // Overload:function(keySelector,elementSelector,resultSelector,compareSelector)+ Enumerable.prototype.partitionBy = function (keySelector, elementSelector, resultSelector, compareSelector) {+ /// <summary>Create Group by continuation key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract the key for each element.</param>+ /// <param name="elementSelector" type="Func<T,TElement>" optional="true">A function to map each source element to an element in an Grouping<TKey, TElement>.</param>+ /// <param name="resultSelector" type="Func<TKey,Enumerable<TElement>,TResult>" optional="true">A function to create a result value from each group.</param>+ /// <param name="compareSelector" type="Func<TKey,TCompare>" optional="true">An equality comparer to compare values.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ compareSelector = Utils.createLambda(compareSelector);+ var hasResultSelector;+ if (resultSelector == null) {+ hasResultSelector = false;+ resultSelector = function (key, group) { return new Grouping(key, group); };+ }+ else {+ hasResultSelector = true;+ resultSelector = Utils.createLambda(resultSelector);+ }++ return new Enumerable(function () {+ var enumerator;+ var key;+ var compareKey;+ var group = [];++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ if (enumerator.moveNext()) {+ key = keySelector(enumerator.current());+ compareKey = compareSelector(key);+ group.push(elementSelector(enumerator.current()));+ }+ },+ function () {+ var hasNext;+ while ((hasNext = enumerator.moveNext()) == true) {+ if (compareKey === compareSelector(keySelector(enumerator.current()))) {+ group.push(elementSelector(enumerator.current()));+ }+ else break;+ }++ if (group.length > 0) {+ var result = (hasResultSelector)+ ? resultSelector(key, Enumerable.from(group))+ : resultSelector(key, group);+ if (hasNext) {+ key = keySelector(enumerator.current());+ compareKey = compareSelector(key);+ group = [elementSelector(enumerator.current())];+ }+ else group = [];++ return this.yieldReturn(result);+ }++ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.buffer = function (count) {+ /// <summary>Divide by count</summary>+ /// <param name="count" type="Number" integer="true">integer</param>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ var array = [];+ var index = 0;+ while (enumerator.moveNext()) {+ array.push(enumerator.current());+ if (++index >= count) return this.yieldReturn(array);+ }+ if (array.length > 0) return this.yieldReturn(array);+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ /* Aggregate Methods */++ // Overload:function(func)+ // Overload:function(seed,func)+ // Overload:function(seed,func,resultSelector)+ Enumerable.prototype.aggregate = function (seed, func, resultSelector) {+ /// <signature>+ /// <summary>Applies an accumulator function over a sequence.</summary>+ /// <param name="func" type="Func<TSource,TSource,TSource>">An accumulator function to be invoked on each element.</param>+ /// <returns type="TAccumulate"></returns>+ /// </signature>+ /// <signature>+ /// <summary>Applies an accumulator function over a sequence.</summary>+ /// <param name="seed" type="TAccumulate">the initial accumulator value.</param>+ /// <param name="func" type="Func<TAccumulate,TSource,TAccumulate>">An accumulator function to be invoked on each element.</param>+ /// <param name="resultSelector" type="Func<TAccumulate,TResult>" optional="true">A function to transform the final accumulator value into the result value.</param>+ /// <returns type="TResult"></returns>+ /// </signature>+ /// <summary>Applies an accumulator function over a sequence.</summary>+ /// <param name="seed" type="Func<T,T,T>_or_TAccumulate">Func is an accumulator function to be invoked on each element. Seed is the initial accumulator value.</param>+ /// <param name="func" type="Optional:Func<TAccumulate,T,TAccumulate>" optional="true">An accumulator function to be invoked on each element.</param>+ /// <param name="resultSelector" type="Optional:Func<TAccumulate,TResult>" optional="true">A function to transform the final accumulator value into the result value.</param>+ resultSelector = Utils.createLambda(resultSelector);+ return resultSelector(this.scan(seed, func, resultSelector).last());+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.average = function (selector) {+ /// <summary>Computes the average of a sequence.</summary>+ /// <param name="selector" type="Func<T,Number>" optional="true">A transform function to apply to each element.</param>+ /// <returns type="Number"></returns>+ selector = Utils.createLambda(selector);++ var sum = 0;+ var count = 0;+ this.forEach(function (x) {+ sum += selector(x);+ ++count;+ });++ return sum / count;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.count = function (predicate) {+ /// <summary>Returns the number of elements in a sequence.</summary>+ /// <param name="predicate" type="Func<T,Boolean>" optional="true">A function to test each element for a condition.</param>+ /// <returns type="Number"></returns>+ predicate = (predicate == null) ? Functions.True : Utils.createLambda(predicate);++ var count = 0;+ this.forEach(function (x, i) {+ if (predicate(x, i))++count;+ });+ return count;+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.max = function (selector) {+ /// <summary>Returns the maximum value in a sequence</summary>+ /// <param name="selector" type="Func<T,TKey>" optional="true">A transform function to apply to each element.</param>+ /// <returns type="Number"></returns>+ if (selector == null) selector = Functions.Identity;+ return this.select(selector).aggregate(function (a, b) { return (a > b) ? a : b; });+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.min = function (selector) {+ /// <summary>Returns the minimum value in a sequence</summary>+ /// <param name="selector" type="Func<T,TKey>" optional="true">A transform function to apply to each element.</param>+ /// <returns type="Number"></returns>+ if (selector == null) selector = Functions.Identity;+ return this.select(selector).aggregate(function (a, b) { return (a < b) ? a : b; });+ };++ Enumerable.prototype.maxBy = function (keySelector) {+ /// <summary>Returns the maximum value in a sequence by keySelector</summary>+ /// <param name="keySelector" type="Func<T,TKey>">A compare selector of element.</param>+ /// <returns type="T"></returns>+ keySelector = Utils.createLambda(keySelector);+ return this.aggregate(function (a, b) { return (keySelector(a) > keySelector(b)) ? a : b; });+ };++ Enumerable.prototype.minBy = function (keySelector) {+ /// <summary>Returns the minimum value in a sequence by keySelector</summary>+ /// <param name="keySelector" type="Func<T,TKey>">A compare selector of element.</param>+ /// <returns type="T"></returns>+ keySelector = Utils.createLambda(keySelector);+ return this.aggregate(function (a, b) { return (keySelector(a) < keySelector(b)) ? a : b; });+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.sum = function (selector) {+ /// <summary>Computes the sum of a sequence of values.</summary>+ /// <param name="selector" type="Func<T,TKey>" optional="true">A transform function to apply to each element.</param>+ /// <returns type="Number"></returns>+ if (selector == null) selector = Functions.Identity;+ return this.select(selector).aggregate(0, function (a, b) { return a + b; });+ };++ /* Paging Methods */++ Enumerable.prototype.elementAt = function (index) {+ /// <summary>Returns the element at a specified index in a sequence.</summary>+ /// <param name="index" type="Number" integer="true">The zero-based index of the element to retrieve.</param>+ /// <returns type="T"></returns>+ var value;+ var found = false;+ this.forEach(function (x, i) {+ if (i == index) {+ value = x;+ found = true;+ return false;+ }+ });++ if (!found) throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");+ return value;+ };++ Enumerable.prototype.elementAtOrDefault = function (index, defaultValue) {+ /// <summary>Returns the element at a specified index in a sequence or a default value if the index is out of range.+ /// default of defautValue is null.</summary>+ /// <param name="index" type="Number" integer="true">The zero-based index of the element to retrieve.</param>+ /// <param name="defaultValue" type="T" optional="true">The value if the index is outside the bounds then send.</param>+ /// <returns type="T"></returns>+ if (defaultValue === undefined) defaultValue = null;+ var value;+ var found = false;+ this.forEach(function (x, i) {+ if (i == index) {+ value = x;+ found = true;+ return false;+ }+ });++ return (!found) ? defaultValue : value;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.first = function (predicate) {+ /// <summary>Returns the first element of a sequence.</summary>+ /// <param name="predicate" type="Func<T,Boolean>" optional="true">A function to test each element for a condition.</param>+ /// <returns type="T"></returns>+ if (predicate != null) return this.where(predicate).first();++ var value;+ var found = false;+ this.forEach(function (x) {+ value = x;+ found = true;+ return false;+ });++ if (!found) throw new Error("first:No element satisfies the condition.");+ return value;+ };++ Enumerable.prototype.firstOrDefault = function (predicate, defaultValue) {+ /// <summary>Returns the first element of a sequence, or a default value.+ /// default of defautValue is null.</summary>+ /// <param name="predicate" type="Func<T,Boolean>" optional="true">A function to test each element for a condition. If null then no use predicate.</param>+ /// <param name="defaultValue" type="T" optional="true">The value if not found then send.</param>+ /// <returns type="T"></returns>+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) return this.where(predicate).firstOrDefault(null, defaultValue);++ var value;+ var found = false;+ this.forEach(function (x) {+ value = x;+ found = true;+ return false;+ });+ return (!found) ? defaultValue : value;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.last = function (predicate) {+ /// <summary>Returns the last element of a sequence.</summary>+ /// <param name="predicate" type="Func<T,Boolean>" optional="true">A function to test each element for a condition.</param>+ /// <returns type="T"></returns>+ if (predicate != null) return this.where(predicate).last();++ var value;+ var found = false;+ this.forEach(function (x) {+ found = true;+ value = x;+ });++ if (!found) throw new Error("last:No element satisfies the condition.");+ return value;+ };++ Enumerable.prototype.lastOrDefault = function (predicate, defaultValue) {+ /// <summary>Returns the last element of a sequence, or a default value.+ /// default of defautValue is null.</summary>+ /// <param name="predicate" type="Func<T,Boolean>" optional="true">A function to test each element for a condition. If null then no use predicate.</param>+ /// <param name="defaultValue" type="T" optional="true">The value if not found then send.</param>+ /// <returns type="T"></returns>+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) return this.where(predicate).lastOrDefault(null, defaultValue);++ var value;+ var found = false;+ this.forEach(function (x) {+ found = true;+ value = x;+ });+ return (!found) ? defaultValue : value;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.single = function (predicate) {+ /// <summary>Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.</summary>+ /// <param name="predicate" type="Func<T,Boolean>" optional="true">A function to test each element for a condition.</param>+ /// <returns type="T"></returns>+ if (predicate != null) return this.where(predicate).single();++ var value;+ var found = false;+ this.forEach(function (x) {+ if (!found) {+ found = true;+ value = x;+ } else throw new Error("single:sequence contains more than one element.");+ });++ if (!found) throw new Error("single:No element satisfies the condition.");+ return value;+ };++ // Overload:function(defaultValue)+ // Overload:function(defaultValue,predicate)+ Enumerable.prototype.singleOrDefault = function (predicate, defaultValue) {+ /// <summary>Returns a single, specific element of a sequence of values, or a default value if no such element is found.+ /// default of defautValue is null.</summary>+ /// <param name="predicate" type="Func<T,Boolean>" optional="true">A function to test each element for a condition. If null then no use predicate.</param>+ /// <param name="defaultValue" type="T" optional="true">The value if not found then send.</param>+ /// <returns type="T"></returns>+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) return this.where(predicate).singleOrDefault(null, defaultValue);++ var value;+ var found = false;+ this.forEach(function (x) {+ if (!found) {+ found = true;+ value = x;+ } else throw new Error("single:sequence contains more than one element.");+ });++ return (!found) ? defaultValue : value;+ };++ Enumerable.prototype.skip = function (count) {+ /// <summary>Bypasses a specified number of elements in a sequence and then returns the remaining elements.</summary>+ /// <param name="count" type="Number" integer="true">The number of elements to skip before returning the remaining elements.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ while (index++ < count && enumerator.moveNext()) {+ }+ ;+ },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(predicate<element>)+ // Overload:function(predicate<element,index>)+ Enumerable.prototype.skipWhile = function (predicate) {+ /// <summary>Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.</summary>+ /// <param name="predicate" type="Func<T,int,Boolean>">A function to test each source element for a condition; Optional:the second parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ predicate = Utils.createLambda(predicate);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;+ var isSkipEnd = false;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (!isSkipEnd) {+ if (enumerator.moveNext()) {+ if (!predicate(enumerator.current(), index++)) {+ isSkipEnd = true;+ return this.yieldReturn(enumerator.current());+ }+ continue;+ } else return false;+ }++ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;++ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.take = function (count) {+ /// <summary>Returns a specified number of contiguous elements from the start of a sequence.</summary>+ /// <param name="count" type="Number" integer="true">The number of elements to return.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (index++ < count && enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); }+ );+ });+ };++ // Overload:function(predicate<element>)+ // Overload:function(predicate<element,index>)+ Enumerable.prototype.takeWhile = function (predicate) {+ /// <summary>Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.</summary>+ /// <param name="predicate" type="Func<T,int,Boolean>">A function to test each source element for a condition; Optional:the second parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ predicate = Utils.createLambda(predicate);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (enumerator.moveNext() && predicate(enumerator.current(), index++))+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function()+ // Overload:function(count)+ Enumerable.prototype.takeExceptLast = function (count) {+ /// <summary>Take a sequence except last count. The default count is 1.</summary>+ /// <param name="count" type="Number" integer="true" optional="true">The number of skip count.</param>+ /// <returns type="Enumerable"></returns>+ if (count == null) count = 1;+ var source = this;++ return new Enumerable(function () {+ if (count <= 0) return source.getEnumerator(); // do nothing++ var enumerator;+ var q = [];++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (q.length == count) {+ q.push(enumerator.current());+ return this.yieldReturn(q.shift());+ }+ q.push(enumerator.current());+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.takeFromLast = function (count) {+ /// <summary>Take a sequence from last count.</summary>+ /// <param name="count" type="Number" integer="true">The number of take count.</param>+ /// <returns type="Enumerable"></returns>+ if (count <= 0 || count == null) return Enumerable.empty();+ var source = this;++ return new Enumerable(function () {+ var sourceEnumerator;+ var enumerator;+ var q = [];++ return new IEnumerator(+ function () { sourceEnumerator = source.getEnumerator(); },+ function () {+ while (sourceEnumerator.moveNext()) {+ if (q.length == count) q.shift();+ q.push(sourceEnumerator.current());+ }+ if (enumerator == null) {+ enumerator = Enumerable.from(q).getEnumerator();+ }+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.indexOf = function (item) {+ /// <summary>Returns the zero-based index of the flrst occurrence of a value.</summary>+ /// <param name="item" type="T">The zero-based starting index of the search.</param>+ /// <returns type="Number" integer="true"></returns>+ var found = null;++ // item as predicate+ if (typeof (item) === Types.Function) {+ this.forEach(function (x, i) {+ if (item(x, i)) {+ found = i;+ return false;+ }+ });+ }+ else {+ this.forEach(function (x, i) {+ if (x === item) {+ found = i;+ return false;+ }+ });+ }++ return (found !== null) ? found : -1;+ };++ Enumerable.prototype.lastIndexOf = function (item) {+ /// <summary>Returns the zero-based index of the last occurrence of a value.</summary>+ /// <param name="item" type="T">The zero-based starting index of the search.</param>+ /// <returns type="Number" integer="true"></returns>+ var result = -1;++ // item as predicate+ if (typeof (item) === Types.Function) {+ this.forEach(function (x, i) {+ if (item(x, i)) result = i;+ });+ }+ else {+ this.forEach(function (x, i) {+ if (x === item) result = i;+ });+ }++ return result;+ };++ /* Convert Methods */++ Enumerable.prototype.cast = function () {+ return this;+ };++ Enumerable.prototype.asEnumerable = function () {+ /// <summary>Convert sequence as enumerable. This same as Enumerable.from(seq).</summary>+ /// <returns type="Enumerable"></returns>+ return Enumerable.from(this);+ };++ Enumerable.prototype.toArray = function () {+ /// <summary>Creates an array from this sequence.</summary>+ /// <returns type="Array"></returns>+ var array = [];+ this.forEach(function (x) { array.push(x); });+ return array;+ };++ // Overload:function(keySelector)+ // Overload:function(keySelector, elementSelector)+ // Overload:function(keySelector, elementSelector, compareSelector)+ Enumerable.prototype.toLookup = function (keySelector, elementSelector, compareSelector) {+ /// <summary>Creates a Lookup from this sequence.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract a key from each element.</param>+ /// <param name="elementSelector" type="Func<T,TElement>" optional="true">A transform function to produce a result element value from each element.</param>+ /// <param name="compareSelector" type="Func<TKey,TCompare>" optional="true">An equality comparer to compare values.</param>+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ compareSelector = Utils.createLambda(compareSelector);++ var dict = new Dictionary(compareSelector);+ this.forEach(function (x) {+ var key = keySelector(x);+ var element = elementSelector(x);++ var array = dict.get(key);+ if (array !== undefined) array.push(element);+ else dict.add(key, [element]);+ });+ return new Lookup(dict);+ };++ Enumerable.prototype.toObject = function (keySelector, elementSelector) {+ /// <summary>Creates a Object from this sequence.</summary>+ /// <param name="keySelector" type="Func<T,String>" optional="true">A function to extract a key from each element.</param>+ /// <param name="elementSelector" type="Func<T,TElement>" optional="true">A transform function to produce a result element value from each element.</param>+ /// <returns type="Object"></returns>+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);++ var obj = {};+ this.forEach(function (x) {+ obj[keySelector(x)] = elementSelector(x);+ });+ return obj;+ };++ // Overload:function(keySelector, elementSelector)+ // Overload:function(keySelector, elementSelector, compareSelector)+ Enumerable.prototype.toDictionary = function (keySelector, elementSelector, compareSelector) {+ /// <summary>Creates a Dictionary from this sequence.</summary>+ /// <param name="keySelector" type="Func<T,TKey>" optional="true">A function to extract a key from each element.</param>+ /// <param name="elementSelector" type="Func<T,TElement>" optional="true">A transform function to produce a result element value from each element.</param>+ /// <param name="compareSelector" type="Func<TKey,TCompare>" optional="true">An equality comparer to compare values.</param>+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ compareSelector = Utils.createLambda(compareSelector);++ var dict = new Dictionary(compareSelector);+ this.forEach(function (x) {+ dict.add(keySelector(x), elementSelector(x));+ });+ return dict;+ };++ // Overload:function()+ // Overload:function(replacer)+ // Overload:function(replacer, space)+ Enumerable.prototype.toJSONString = function (replacer, space) {+ /// <summary>Creates a JSON String from sequence, performed only native JSON support browser or included json2.js.</summary>+ /// <param name="replacer" type="Function" optional="true">a replacer.</param>+ /// <param name="space" type="Number" optional="true">indent spaces.</param>+ /// <returns type="String"></returns>+ if (typeof JSON === Types.Undefined || JSON.stringify == null) {+ throw new Error("toJSONString can't find JSON.stringify. This works native JSON support Browser or include json2.js");+ }+ return JSON.stringify(this.toArray(), replacer, space);+ };++ // Overload:function()+ // Overload:function(separator)+ // Overload:function(separator,selector)+ Enumerable.prototype.toJoinedString = function (separator, selector) {+ /// <summary>Creates Joined string from this sequence. The default separator is "".</summary>+ /// <param name="separator" type="String" optional="true">A String.</param>+ /// <param name="selector" type="Func<T,String>" optional="true">A transform function to apply to each source element.</param>+ /// <returns type="String"></returns>+ if (separator == null) separator = "";+ if (selector == null) selector = Functions.Identity;++ return this.select(selector).toArray().join(separator);+ };+++ /* Action Methods */++ // Overload:function(action<element>)+ // Overload:function(action<element,index>)+ Enumerable.prototype.doAction = function (action) {+ /// <summary>Performs the specified action on each element of the sequence.</summary>+ /// <param name="action" type="Action<T,int>">action on each element. Optional:the second parameter of the function represents the index of the source element.</param>+ /// <returns type="Enumerable"></returns>+ var source = this;+ action = Utils.createLambda(action);++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (enumerator.moveNext()) {+ action(enumerator.current(), index++);+ return this.yieldReturn(enumerator.current());+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(action<element>)+ // Overload:function(action<element,index>)+ // Overload:function(func<element,bool>)+ // Overload:function(func<element,index,bool>)+ Enumerable.prototype.forEach = function (action) {+ /// <summary>Performs the specified action on each element of the sequence.</summary>+ /// <param name="action" type="Action<T,int>">[return true;]continue iteration.[return false;]break iteration. Optional:the second parameter of the function represents the index of the source element.</param>+ /// <returns type="void"></returns>+ action = Utils.createLambda(action);++ var index = 0;+ var enumerator = this.getEnumerator();+ try {+ while (enumerator.moveNext()) {+ if (action(enumerator.current(), index++) === false) break;+ }+ } finally {+ Utils.dispose(enumerator);+ }+ };++ // Overload:function()+ // Overload:function(separator)+ // Overload:function(separator,selector)+ Enumerable.prototype.write = function (separator, selector) {+ /// <summary>Do document.write.</summary>+ /// <param name="separator" type="String" optional="true">A String.</param>+ /// <param name="selector" type="Func<T,String>" optional="true">A transform function to apply to each source element.</param>+ /// <returns type="void"></returns>+ if (separator == null) separator = "";+ selector = Utils.createLambda(selector);++ var isFirst = true;+ this.forEach(function (item) {+ if (isFirst) isFirst = false;+ else document.write(separator);+ document.write(selector(item));+ });+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.writeLine = function (selector) {+ /// <summary>Do document.writeln + br.</summary>+ /// <param name="selector" type="Func<T,String>" optional="true">A transform function to apply to each source element.</param>+ /// <returns type="void"></returns>+ selector = Utils.createLambda(selector);++ this.forEach(function (item) {+ document.writeln(selector(item) + "<br />");+ });+ };++ Enumerable.prototype.force = function () {+ /// <summary>Execute enumerate.</summary>+ /// <returns type="void"></returns>+ var enumerator = this.getEnumerator();++ try {+ while (enumerator.moveNext()) {+ }+ }+ finally {+ Utils.dispose(enumerator);+ }+ };++ /* Functional Methods */++ Enumerable.prototype.letBind = function (func) {+ /// <summary>Bind the source to the parameter so that it can be used multiple times.</summary>+ /// <param name="func" type="Func<Enumerable<T>,Enumerable<TR>>">apply function.</param>+ /// <returns type="Enumerable"></returns>+ func = Utils.createLambda(func);+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () {+ enumerator = Enumerable.from(func(source)).getEnumerator();+ },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.share = function () {+ /// <signature>+ /// <summary>Shares cursor of all enumerators to the sequence.</summary>+ /// <returns type="DisposableEnumerable"></returns>+ /// </signature>+ /// <summary>Shares cursor of all enumerators to the sequence.</summary>+ /// <returns type="Enumerable"></returns>+ var source = this;+ var sharedEnumerator;+ var disposed = false;++ return new DisposableEnumerable(function () {+ return new IEnumerator(+ function () {+ if (sharedEnumerator == null) {+ sharedEnumerator = source.getEnumerator();+ }+ },+ function () {+ if (disposed) throw new Error("enumerator is disposed");++ return (sharedEnumerator.moveNext())+ ? this.yieldReturn(sharedEnumerator.current())+ : false;+ },+ Functions.Blank+ );+ }, function () {+ disposed = true;+ Utils.dispose(sharedEnumerator);+ });+ };++ Enumerable.prototype.memoize = function () {+ /// <signature>+ /// <summary>Creates an enumerable that enumerates the original enumerable only once and caches its results.</summary>+ /// <returns type="DisposableEnumerable"></returns>+ /// </signature>+ /// <summary>Creates an enumerable that enumerates the original enumerable only once and caches its results.</summary>+ /// <returns type="Enumerable"></returns>+ var source = this;+ var cache;+ var enumerator;+ var disposed = false;++ return new DisposableEnumerable(function () {+ var index = -1;++ return new IEnumerator(+ function () {+ if (enumerator == null) {+ enumerator = source.getEnumerator();+ cache = [];+ }+ },+ function () {+ if (disposed) throw new Error("enumerator is disposed");++ index++;+ if (cache.length <= index) {+ return (enumerator.moveNext())+ ? this.yieldReturn(cache[index] = enumerator.current())+ : false;+ }++ return this.yieldReturn(cache[index]);+ },+ Functions.Blank+ );+ }, function () {+ disposed = true;+ Utils.dispose(enumerator);+ cache = null;+ });+ };++ /* Error Handling Methods */++ Enumerable.prototype.catchError = function (handler) {+ /// <summary>catch error and do handler.</summary>+ /// <param name="handler" type="Action<Error>">execute if error occured.</param>+ /// <returns type="Enumerable"></returns>+ handler = Utils.createLambda(handler);+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ try {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ } catch (e) {+ handler(e);+ return false;+ }+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.finallyAction = function (finallyAction) {+ /// <summary>do action if enumerate end or disposed or error occured.</summary>+ /// <param name="finallyAction" type="Action">finally execute.</param>+ /// <returns type="Enumerable"></returns>+ finallyAction = Utils.createLambda(finallyAction);+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () {+ try {+ Utils.dispose(enumerator);+ } finally {+ finallyAction();+ }+ });+ });+ };++ /* For Debug Methods */++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.log = function (selector) {+ /// <summary>log object use console.log.</summary>+ /// <param name="selector" type="Func<T,String>" optional="true">A transform function to apply to each source element.</param>+ /// <returns type="Enumerable"></returns>+ selector = Utils.createLambda(selector);++ return this.doAction(function (item) {+ if (typeof console !== Types.Undefined) {+ console.log(selector(item));+ }+ });+ };++ // Overload:function()+ // Overload:function(message)+ // Overload:function(message,selector)+ Enumerable.prototype.trace = function (message, selector) {+ /// <summary>Trace object use console.log.</summary>+ /// <param name="message" type="String" optional="true">Default is 'Trace'.</param>+ /// <param name="selector" type="Func<T,String>" optional="true">A transform function to apply to each source element.</param>+ /// <returns type="Enumerable"></returns>+ if (message == null) message = "Trace";+ selector = Utils.createLambda(selector);++ return this.doAction(function (item) {+ if (typeof console !== Types.Undefined) {+ console.log(message, selector(item));+ }+ });+ };++ // private++ var OrderedEnumerable = function (source, keySelector, descending, parent) {+ this.source = source;+ this.keySelector = Utils.createLambda(keySelector);+ this.descending = descending;+ this.parent = parent;++ if (intellisense) this.firstOrDefault(); // for intellisense+ };+ OrderedEnumerable.prototype = new Enumerable();++ OrderedEnumerable.prototype.createOrderedEnumerable = function (keySelector, descending) {+ return new OrderedEnumerable(this.source, keySelector, descending, this);+ };+ OrderedEnumerable.prototype.thenBy = function (keySelector) {+ /// <signature>+ /// <summary>Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>">A function to extract a key from each element.</param>+ /// <returns type="OrderedEnumerable"></returns>+ /// </signature>+ /// <summary>Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>">A function to extract a key from each element.</param>+ return this.createOrderedEnumerable(keySelector, false);+ };+ OrderedEnumerable.prototype.thenByDescending = function (keySelector) {+ /// <signature>+ /// <summary>Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>">A function to extract a key from each element.</param>+ /// <returns type="OrderedEnumerable"></returns>+ /// </signature>+ /// <summary>Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.</summary>+ /// <param name="keySelector" type="Func<T,TKey>">A function to extract a key from each element.</param>+ return this.createOrderedEnumerable(keySelector, true);+ };+ OrderedEnumerable.prototype.getEnumerator = function () {+ /// <summary>Returns an enumerator that iterates through the collection.</summary>+ /// <returns type="IEnumerator"></returns>+ var self = this;+ var buffer;+ var indexes;+ var index = 0;++ return new IEnumerator(+ function () {+ buffer = [];+ indexes = [];+ self.source.forEach(function (item, index) {+ buffer.push(item);+ indexes.push(index);+ });+ var sortContext = SortContext.create(self, null);+ sortContext.GenerateKeys(buffer);++ indexes.sort(function (a, b) { return sortContext.compare(a, b); });+ },+ function () {+ return (index < indexes.length)+ ? this.yieldReturn(buffer[indexes[index++]])+ : false;+ },+ Functions.Blank+ );+ };++ var SortContext = function (keySelector, descending, child) {+ this.keySelector = keySelector;+ this.descending = descending;+ this.child = child;+ this.keys = null;+ };+ SortContext.create = function (orderedEnumerable, currentContext) {+ var context = new SortContext(orderedEnumerable.keySelector, orderedEnumerable.descending, currentContext);+ if (orderedEnumerable.parent != null) return SortContext.create(orderedEnumerable.parent, context);+ return context;+ };+ SortContext.prototype.GenerateKeys = function (source) {+ var len = source.length;+ var keySelector = this.keySelector;+ var keys = new Array(len);+ for (var i = 0; i < len; i++) keys[i] = keySelector(source[i]);+ this.keys = keys;++ if (this.child != null) this.child.GenerateKeys(source);+ };+ SortContext.prototype.compare = function (index1, index2) {+ var comparison = Utils.compare(this.keys[index1], this.keys[index2]);++ if (comparison == 0) {+ if (this.child != null) return this.child.compare(index1, index2);+ comparison = Utils.compare(index1, index2);+ }++ return (this.descending) ? -comparison : comparison;+ };++ var DisposableEnumerable = function (getEnumerator, dispose) {+ /// <field name="dispose" type="Function">Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</field>+ this.dispose = dispose;+ Enumerable.call(this, getEnumerator);++ if (intellisense) this.firstOrDefault(); // for intellisense+ };+ DisposableEnumerable.prototype = new Enumerable();++ // optimize array or arraylike object++ var ArrayEnumerable = function (source) {+ this.getSource = function () { return source; };++ if (intellisense) this.firstOrDefault(); // for intellisense+ };+ ArrayEnumerable.prototype = new Enumerable();++ ArrayEnumerable.prototype.any = function (predicate) {+ return (predicate == null)+ ? (this.getSource().length > 0)+ : Enumerable.prototype.any.apply(this, arguments);+ };++ ArrayEnumerable.prototype.count = function (predicate) {+ return (predicate == null)+ ? this.getSource().length+ : Enumerable.prototype.count.apply(this, arguments);+ };++ ArrayEnumerable.prototype.elementAt = function (index) {+ var source = this.getSource();+ return (0 <= index && index < source.length)+ ? source[index]+ : Enumerable.prototype.elementAt.apply(this, arguments);+ };++ ArrayEnumerable.prototype.elementAtOrDefault = function (index, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ var source = this.getSource();+ return (0 <= index && index < source.length)+ ? source[index]+ : defaultValue;+ };++ ArrayEnumerable.prototype.first = function (predicate) {+ var source = this.getSource();+ return (predicate == null && source.length > 0)+ ? source[0]+ : Enumerable.prototype.first.apply(this, arguments);+ };++ ArrayEnumerable.prototype.firstOrDefault = function (predicate, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) {+ return Enumerable.prototype.firstOrDefault.apply(this, arguments);+ }++ var source = this.getSource();+ return source.length > 0 ? source[0] : defaultValue;+ };++ ArrayEnumerable.prototype.last = function (predicate) {+ var source = this.getSource();+ return (predicate == null && source.length > 0)+ ? source[source.length - 1]+ : Enumerable.prototype.last.apply(this, arguments);+ };++ ArrayEnumerable.prototype.lastOrDefault = function (predicate, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) {+ return Enumerable.prototype.lastOrDefault.apply(this, arguments);+ }++ var source = this.getSource();+ return source.length > 0 ? source[source.length - 1] : defaultValue;+ };++ ArrayEnumerable.prototype.skip = function (count) {+ var source = this.getSource();++ return new Enumerable(function () {+ var index;++ return new IEnumerator(+ function () { index = (count < 0) ? 0 : count; },+ function () {+ return (index < source.length)+ ? this.yieldReturn(source[index++])+ : false;+ },+ Functions.Blank);+ });+ };++ ArrayEnumerable.prototype.takeExceptLast = function (count) {+ if (count == null) count = 1;+ return this.take(this.getSource().length - count);+ };++ ArrayEnumerable.prototype.takeFromLast = function (count) {+ return this.skip(this.getSource().length - count);+ };++ ArrayEnumerable.prototype.reverse = function () {+ var source = this.getSource();++ return new Enumerable(function () {+ var index;++ return new IEnumerator(+ function () {+ index = source.length;+ },+ function () {+ return (index > 0)+ ? this.yieldReturn(source[--index])+ : false;+ },+ Functions.Blank);+ });+ };++ ArrayEnumerable.prototype.sequenceEqual = function (second, compareSelector) {+ if ((second instanceof ArrayEnumerable || second instanceof Array)+ && compareSelector == null+ && Enumerable.from(second).count() != this.count()) {+ return false;+ }++ return Enumerable.prototype.sequenceEqual.apply(this, arguments);+ };++ ArrayEnumerable.prototype.toJoinedString = function (separator, selector) {+ var source = this.getSource();+ if (selector != null || !(source instanceof Array)) {+ return Enumerable.prototype.toJoinedString.apply(this, arguments);+ }++ if (separator == null) separator = "";+ return source.join(separator);+ };++ ArrayEnumerable.prototype.getEnumerator = function () {+ var source = this.getSource();+ var index = -1;++ // fast and simple enumerator+ return {+ current: function () { return source[index]; },+ moveNext: function () {+ return ++index < source.length;+ },+ dispose: Functions.Blank+ };+ };++ // optimization for multiple where and multiple select and whereselect++ var WhereEnumerable = function (source, predicate) {+ this.prevSource = source;+ this.prevPredicate = predicate; // predicate.length always <= 1++ if (intellisense) this.firstOrDefault(); // for intellisense+ };+ WhereEnumerable.prototype = new Enumerable();++ WhereEnumerable.prototype.where = function (predicate) {+ predicate = Utils.createLambda(predicate);++ if (predicate.length <= 1) {+ var prevPredicate = this.prevPredicate;+ var composedPredicate = function (x) { return prevPredicate(x) && predicate(x); };+ return new WhereEnumerable(this.prevSource, composedPredicate);+ }+ else {+ // if predicate use index, can't compose+ return Enumerable.prototype.where.call(this, predicate);+ }+ };++ WhereEnumerable.prototype.select = function (selector) {+ selector = Utils.createLambda(selector);++ return (selector.length <= 1)+ ? new WhereSelectEnumerable(this.prevSource, this.prevPredicate, selector)+ : Enumerable.prototype.select.call(this, selector);+ };++ WhereEnumerable.prototype.getEnumerator = function () {+ var predicate = this.prevPredicate;+ var source = this.prevSource;+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (predicate(enumerator.current())) {+ return this.yieldReturn(enumerator.current());+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ };++ var WhereSelectEnumerable = function (source, predicate, selector) {+ this.prevSource = source;+ this.prevPredicate = predicate; // predicate.length always <= 1 or null+ this.prevSelector = selector; // selector.length always <= 1++ if (intellisense) this.firstOrDefault(); // for intellisense+ };+ WhereSelectEnumerable.prototype = new Enumerable();++ WhereSelectEnumerable.prototype.where = function (predicate) {+ predicate = Utils.createLambda(predicate);++ return (predicate.length <= 1)+ ? new WhereEnumerable(this, predicate)+ : Enumerable.prototype.where.call(this, predicate);+ };++ WhereSelectEnumerable.prototype.select = function (selector) {+ selector = Utils.createLambda(selector);++ if (selector.length <= 1) {+ var prevSelector = this.prevSelector;+ var composedSelector = function (x) { return selector(prevSelector(x)); };+ return new WhereSelectEnumerable(this.prevSource, this.prevPredicate, composedSelector);+ }+ else {+ // if selector use index, can't compose+ return Enumerable.prototype.select.call(this, selector);+ }+ };++ WhereSelectEnumerable.prototype.getEnumerator = function () {+ var predicate = this.prevPredicate;+ var selector = this.prevSelector;+ var source = this.prevSource;+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (predicate == null || predicate(enumerator.current())) {+ return this.yieldReturn(selector(enumerator.current()));+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ };++ // Collections++ var Dictionary = (function () {+ // static utility methods+ var callHasOwnProperty = function (target, key) {+ return Object.prototype.hasOwnProperty.call(target, key);+ };++ var computeHashCode = function (obj) {+ if (obj === null) return "null";+ if (obj === undefined) return "undefined";++ return (typeof obj.toString === Types.Function)+ ? obj.toString()+ : Object.prototype.toString.call(obj);+ };++ // LinkedList for Dictionary+ var HashEntry = function (key, value) {+ this.key = key;+ this.value = value;+ this.prev = null;+ this.next = null;+ };++ var EntryList = function () {+ this.first = null;+ this.last = null;+ };+ EntryList.prototype =+ {+ addLast: function (entry) {+ if (this.last != null) {+ this.last.next = entry;+ entry.prev = this.last;+ this.last = entry;+ } else this.first = this.last = entry;+ },++ replace: function (entry, newEntry) {+ if (entry.prev != null) {+ entry.prev.next = newEntry;+ newEntry.prev = entry.prev;+ } else this.first = newEntry;++ if (entry.next != null) {+ entry.next.prev = newEntry;+ newEntry.next = entry.next;+ } else this.last = newEntry;++ },++ remove: function (entry) {+ if (entry.prev != null) entry.prev.next = entry.next;+ else this.first = entry.next;++ if (entry.next != null) entry.next.prev = entry.prev;+ else this.last = entry.prev;+ }+ };++ // Overload:function()+ // Overload:function(compareSelector)+ var Dictionary = function (compareSelector) {+ this.countField = 0;+ this.entryList = new EntryList();+ this.buckets = {}; // as Dictionary<string,List<object>>+ this.compareSelector = (compareSelector == null) ? Functions.Identity : compareSelector;+ };+ Dictionary.prototype =+ {+ add: function (key, value) {+ /// <summary>add new pair. if duplicate key then overwrite new value.</summary>+ /// <returns type="Void"></returns>+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ var entry = new HashEntry(key, value);+ if (callHasOwnProperty(this.buckets, hash)) {+ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) {+ this.entryList.replace(array[i], entry);+ array[i] = entry;+ return;+ }+ }+ array.push(entry);+ } else {+ this.buckets[hash] = [entry];+ }+ this.countField++;+ this.entryList.addLast(entry);+ },++ get: function (key) {+ /// <summary>get value. if not find key then return undefined.</summary>+ /// <returns type="T"></returns>+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (!callHasOwnProperty(this.buckets, hash)) return undefined;++ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ var entry = array[i];+ if (this.compareSelector(entry.key) === compareKey) return entry.value;+ }+ return undefined;+ },++ set: function (key, value) {+ /// <summary>set value. if complete set value then return true, not find key then return false.</summary>+ /// <returns type="Boolean"></returns>+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (callHasOwnProperty(this.buckets, hash)) {+ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) {+ var newEntry = new HashEntry(key, value);+ this.entryList.replace(array[i], newEntry);+ array[i] = newEntry;+ return true;+ }+ }+ }+ return false;+ },++ contains: function (key) {+ /// <summary>check contains key.</summary>+ /// <returns type="Boolean"></returns>+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (!callHasOwnProperty(this.buckets, hash)) return false;++ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) return true;+ }+ return false;+ },++ clear: function () {+ /// <summary>clear dictionary.</summary>+ /// <returns type="Void"></returns>+ this.countField = 0;+ this.buckets = {};+ this.entryList = new EntryList();+ },++ remove: function (key) {+ /// <summary>remove key and value.</summary>+ /// <returns type="Void"></returns>+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (!callHasOwnProperty(this.buckets, hash)) return;++ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) {+ this.entryList.remove(array[i]);+ array.splice(i, 1);+ if (array.length == 0) delete this.buckets[hash];+ this.countField--;+ return;+ }+ }+ },++ count: function () {+ /// <summary>contains value's count.</summary>+ /// <returns type="Number"></returns>+ return this.countField;+ },++ toEnumerable: function () {+ /// <summary>Convert to Enumerable<{key:, value:}>.</summary>+ /// <returns type="Enumerable"></returns>+ var self = this;+ return new Enumerable(function () {+ var currentEntry;++ return new IEnumerator(+ function () { currentEntry = self.entryList.first; },+ function () {+ if (currentEntry != null) {+ var result = { key: currentEntry.key, value: currentEntry.value };+ currentEntry = currentEntry.next;+ return this.yieldReturn(result);+ }+ return false;+ },+ Functions.Blank);+ });+ }+ };++ return Dictionary;+ })();++ // dictionary = Dictionary<TKey, TValue[]>+ var Lookup = function (dictionary) {+ this.count = function () {+ /// <summary>contains value's count.</summary>+ /// <returns type="Number"></returns>+ return dictionary.count();+ };+ this.get = function (key) {+ /// <summary>get grouped enumerable.</summary>+ /// <returns type="Enumerable"></returns>+ return Enumerable.from(dictionary.get(key));+ };+ this.contains = function (key) {+ /// <summary>check contains key.</summary>+ /// <returns type="Boolean"></returns>+ return dictionary.contains(key);+ };+ this.toEnumerable = function () {+ /// <summary>Convert to Enumerable<Grouping>.</summary>+ /// <returns type="Enumerable"></returns>+ return dictionary.toEnumerable().select(function (kvp) {+ return new Grouping(kvp.key, kvp.value);+ });+ };+ };++ var Grouping = function (groupKey, elements) {+ this.key = function () {+ /// <summary>get grouping key.</summary>+ /// <returns type="T"></returns>+ return groupKey;+ };+ ArrayEnumerable.call(this, elements);+ };+ Grouping.prototype = new ArrayEnumerable();++ // module export+ if (typeof define === Types.Function && define.amd) { // AMD+ define("linqjs", [], function () { return Enumerable; });+ }+ else if (typeof module !== Types.Undefined && module.exports) { // Node+ module.exports = Enumerable;+ }+ else {+ root.Enumerable = Enumerable;+ }++ // vsdoc helper for VS2012+ var redirectDefinition;+ if(intellisense){+ redirectDefinition = function (from, redirectTo) {+ for (var methodName in from) {+ if (redirectTo[methodName] !== undefined) {+ intellisense.redirectDefinition(from[methodName], redirectTo[methodName]);+ }+ }+ };+ }+ else{+ redirectDefinition = Functions.Identity;+ }++ redirectDefinition(ArrayEnumerable.prototype, Enumerable.prototype);+ redirectDefinition(WhereEnumerable.prototype, Enumerable.prototype);+ redirectDefinition(WhereSelectEnumerable.prototype, Enumerable.prototype);++})(this);\ No newline at end of filediff --git a/data/libs/linqjs/linq.jquery.js b/data/libs/linqjs/linq.jquery.jsnew file mode 100644index 000000000..e426a1bbd--- /dev/null+++ b/data/libs/linqjs/linq.jquery.js@@ -0,0 +1,28 @@+// extension for jQuery++(function (root) {+ if (root.Enumerable == null) {+ throw new Error("can't find Enumerable. linq.jquery.js must load after linq.js");+ }+ if (root.jQuery == null) {+ throw new Error("can't find jQuery. linq.jquery.js must load after jQuery");+ }++ var Enumerable = root.Enumerable;+ var $ = root.jQuery;++ $.fn.toEnumerable = function () {+ /// <summary>each contains elements. to Enumerable<jQuery>.</summary>+ return Enumerable.from(this).select(function (e) { return $(e) });+ };++ Enumerable.prototype.tojQuery = function () {+ /// <summary>Enumerable to jQuery. All elements add to blank jQuery object.</summary>+ return this.aggregate($(), function (j, x) { return j.add(x); });+ };++ Enumerable.prototype.tojQueryAsArray = function () {+ /// <summary>Enumerable to jQuery. This behavior is $(this.toArray()).</summary>+ return $(this.toArray());+ };+})(this);\ No newline at end of filediff --git a/data/libs/linqjs/linq.js b/data/libs/linqjs/linq.jsnew file mode 100644index 000000000..ee2f7ddce--- /dev/null+++ b/data/libs/linqjs/linq.js@@ -0,0 +1,3017 @@+/*--------------------------------------------------------------------------+ * linq.js - LINQ for JavaScript+ * ver 3.0.4-Beta5 (Jun. 20th, 2013)+ *+ * created and maintained by neuecc <[email protected]>+ * licensed under MIT License+ * http://linqjs.codeplex.com/+ *------------------------------------------------------------------------*/++(function (root, undefined) {+ // ReadOnly Function+ var Functions = {+ Identity: function (x) { return x; },+ True: function () { return true; },+ Blank: function () { }+ };++ // const Type+ var Types = {+ Boolean: typeof true,+ Number: typeof 0,+ String: typeof "",+ Object: typeof {},+ Undefined: typeof undefined,+ Function: typeof function () { }+ };++ // createLambda cache+ var funcCache = { "": Functions.Identity };++ // private utility methods+ var Utils = {+ // Create anonymous function from lambda expression string+ createLambda: function (expression) {+ if (expression == null) return Functions.Identity;+ if (typeof expression === Types.String) {+ // get from cache+ var f = funcCache[expression];+ if (f != null) {+ return f;+ }++ if (expression.indexOf("=>") === -1) {+ var regexp = new RegExp("[$]+", "g");++ var maxLength = 0;+ var match;+ while ((match = regexp.exec(expression)) != null) {+ var paramNumber = match[0].length;+ if (paramNumber > maxLength) {+ maxLength = paramNumber;+ }+ }++ var argArray = [];+ for (var i = 1; i <= maxLength; i++) {+ var dollar = "";+ for (var j = 0; j < i; j++) {+ dollar += "$";+ }+ argArray.push(dollar);+ }++ var args = Array.prototype.join.call(argArray, ",");++ f = new Function(args, "return " + expression);+ funcCache[expression] = f;+ return f;+ }+ else {+ var expr = expression.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/);+ f = new Function(expr[1], "return " + expr[2]);+ funcCache[expression] = f;+ return f;+ }+ }+ return expression;+ },++ isIEnumerable: function (obj) {+ if (typeof Enumerator !== Types.Undefined) {+ try {+ new Enumerator(obj); // check JScript(IE)'s Enumerator+ return true;+ }+ catch (e) { }+ }++ return false;+ },++ // IE8's defineProperty is defined but cannot use, therefore check defineProperties+ defineProperty: (Object.defineProperties != null)+ ? function (target, methodName, value) {+ Object.defineProperty(target, methodName, {+ enumerable: false,+ configurable: true,+ writable: true,+ value: value+ })+ }+ : function (target, methodName, value) {+ target[methodName] = value;+ },++ compare: function (a, b) {+ return (a === b) ? 0+ : (a > b) ? 1+ : -1;+ },++ dispose: function (obj) {+ if (obj != null) obj.dispose();+ }+ };++ // IEnumerator State+ var State = { Before: 0, Running: 1, After: 2 };++ // "Enumerator" is conflict JScript's "Enumerator"+ var IEnumerator = function (initialize, tryGetNext, dispose) {+ var yielder = new Yielder();+ var state = State.Before;++ this.current = yielder.current;++ this.moveNext = function () {+ try {+ switch (state) {+ case State.Before:+ state = State.Running;+ initialize();+ // fall through+ case State.Running:+ if (tryGetNext.apply(yielder)) {+ return true;+ }+ else {+ this.dispose();+ return false;+ }+ case State.After:+ return false;+ }+ }+ catch (e) {+ this.dispose();+ throw e;+ }+ };++ this.dispose = function () {+ if (state != State.Running) return;++ try {+ dispose();+ }+ finally {+ state = State.After;+ }+ };+ };++ // for tryGetNext+ var Yielder = function () {+ var current = null;+ this.current = function () { return current; };+ this.yieldReturn = function (value) {+ current = value;+ return true;+ };+ this.yieldBreak = function () {+ return false;+ };+ };++ // Enumerable constuctor+ var Enumerable = function (getEnumerator) {+ this.getEnumerator = getEnumerator;+ };++ // Utility++ Enumerable.Utils = {}; // container++ Enumerable.Utils.createLambda = function (expression) {+ return Utils.createLambda(expression);+ };++ Enumerable.Utils.createEnumerable = function (getEnumerator) {+ return new Enumerable(getEnumerator);+ };++ Enumerable.Utils.createEnumerator = function (initialize, tryGetNext, dispose) {+ return new IEnumerator(initialize, tryGetNext, dispose);+ };++ Enumerable.Utils.extendTo = function (type) {+ var typeProto = type.prototype;+ var enumerableProto;++ if (type === Array) {+ enumerableProto = ArrayEnumerable.prototype;+ Utils.defineProperty(typeProto, "getSource", function () {+ return this;+ });+ }+ else {+ enumerableProto = Enumerable.prototype;+ Utils.defineProperty(typeProto, "getEnumerator", function () {+ return Enumerable.from(this).getEnumerator();+ });+ }++ for (var methodName in enumerableProto) {+ var func = enumerableProto[methodName];++ // already extended+ if (typeProto[methodName] == func) continue;++ // already defined(example Array#reverse/join/forEach...)+ if (typeProto[methodName] != null) {+ methodName = methodName + "ByLinq";+ if (typeProto[methodName] == func) continue; // recheck+ }++ if (func instanceof Function) {+ Utils.defineProperty(typeProto, methodName, func);+ }+ }+ };++ // Generator++ Enumerable.choice = function () // variable argument+ {+ var args = arguments;++ return new Enumerable(function () {+ return new IEnumerator(+ function () {+ args = (args[0] instanceof Array) ? args[0]+ : (args[0].getEnumerator != null) ? args[0].toArray()+ : args;+ },+ function () {+ return this.yieldReturn(args[Math.floor(Math.random() * args.length)]);+ },+ Functions.Blank);+ });+ };++ Enumerable.cycle = function () // variable argument+ {+ var args = arguments;++ return new Enumerable(function () {+ var index = 0;+ return new IEnumerator(+ function () {+ args = (args[0] instanceof Array) ? args[0]+ : (args[0].getEnumerator != null) ? args[0].toArray()+ : args;+ },+ function () {+ if (index >= args.length) index = 0;+ return this.yieldReturn(args[index++]);+ },+ Functions.Blank);+ });+ };++ Enumerable.empty = function () {+ return new Enumerable(function () {+ return new IEnumerator(+ Functions.Blank,+ function () { return false; },+ Functions.Blank);+ });+ };++ Enumerable.from = function (obj) {+ if (obj == null) {+ return Enumerable.empty();+ }+ if (obj instanceof Enumerable) {+ return obj;+ }+ if (typeof obj == Types.Number || typeof obj == Types.Boolean) {+ return Enumerable.repeat(obj, 1);+ }+ if (typeof obj == Types.String) {+ return new Enumerable(function () {+ var index = 0;+ return new IEnumerator(+ Functions.Blank,+ function () {+ return (index < obj.length) ? this.yieldReturn(obj.charAt(index++)) : false;+ },+ Functions.Blank);+ });+ }+ if (typeof obj != Types.Function) {+ // array or array like object+ if (typeof obj.length == Types.Number) {+ return new ArrayEnumerable(obj);+ }++ // JScript's IEnumerable+ if (!(obj instanceof Object) && Utils.isIEnumerable(obj)) {+ return new Enumerable(function () {+ var isFirst = true;+ var enumerator;+ return new IEnumerator(+ function () { enumerator = new Enumerator(obj); },+ function () {+ if (isFirst) isFirst = false;+ else enumerator.moveNext();++ return (enumerator.atEnd()) ? false : this.yieldReturn(enumerator.item());+ },+ Functions.Blank);+ });+ }++ // WinMD IIterable<T>+ if (typeof Windows === Types.Object && typeof obj.first === Types.Function) {+ return new Enumerable(function () {+ var isFirst = true;+ var enumerator;+ return new IEnumerator(+ function () { enumerator = obj.first(); },+ function () {+ if (isFirst) isFirst = false;+ else enumerator.moveNext();++ return (enumerator.hasCurrent) ? this.yieldReturn(enumerator.current) : this.yieldBreak();+ },+ Functions.Blank);+ });+ }+ }++ // case function/object : Create keyValuePair[]+ return new Enumerable(function () {+ var array = [];+ var index = 0;++ return new IEnumerator(+ function () {+ for (var key in obj) {+ var value = obj[key];+ if (!(value instanceof Function) && Object.prototype.hasOwnProperty.call(obj, key)) {+ array.push({ key: key, value: value });+ }+ }+ },+ function () {+ return (index < array.length)+ ? this.yieldReturn(array[index++])+ : false;+ },+ Functions.Blank);+ });+ },++ Enumerable.make = function (element) {+ return Enumerable.repeat(element, 1);+ };++ // Overload:function(input, pattern)+ // Overload:function(input, pattern, flags)+ Enumerable.matches = function (input, pattern, flags) {+ if (flags == null) flags = "";+ if (pattern instanceof RegExp) {+ flags += (pattern.ignoreCase) ? "i" : "";+ flags += (pattern.multiline) ? "m" : "";+ pattern = pattern.source;+ }+ if (flags.indexOf("g") === -1) flags += "g";++ return new Enumerable(function () {+ var regex;+ return new IEnumerator(+ function () { regex = new RegExp(pattern, flags); },+ function () {+ var match = regex.exec(input);+ return (match) ? this.yieldReturn(match) : false;+ },+ Functions.Blank);+ });+ };++ // Overload:function(start, count)+ // Overload:function(start, count, step)+ Enumerable.range = function (start, count, step) {+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ var index = 0;++ return new IEnumerator(+ function () { value = start - step; },+ function () {+ return (index++ < count)+ ? this.yieldReturn(value += step)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ };++ // Overload:function(start, count)+ // Overload:function(start, count, step)+ Enumerable.rangeDown = function (start, count, step) {+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ var index = 0;++ return new IEnumerator(+ function () { value = start + step; },+ function () {+ return (index++ < count)+ ? this.yieldReturn(value -= step)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ };++ // Overload:function(start, to)+ // Overload:function(start, to, step)+ Enumerable.rangeTo = function (start, to, step) {+ if (step == null) step = 1;++ if (start < to) {+ return new Enumerable(function () {+ var value;++ return new IEnumerator(+ function () { value = start - step; },+ function () {+ var next = value += step;+ return (next <= to)+ ? this.yieldReturn(next)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ }+ else {+ return new Enumerable(function () {+ var value;++ return new IEnumerator(+ function () { value = start + step; },+ function () {+ var next = value -= step;+ return (next >= to)+ ? this.yieldReturn(next)+ : this.yieldBreak();+ },+ Functions.Blank);+ });+ }+ };++ // Overload:function(element)+ // Overload:function(element, count)+ Enumerable.repeat = function (element, count) {+ if (count != null) return Enumerable.repeat(element).take(count);++ return new Enumerable(function () {+ return new IEnumerator(+ Functions.Blank,+ function () { return this.yieldReturn(element); },+ Functions.Blank);+ });+ };++ Enumerable.repeatWithFinalize = function (initializer, finalizer) {+ initializer = Utils.createLambda(initializer);+ finalizer = Utils.createLambda(finalizer);++ return new Enumerable(function () {+ var element;+ return new IEnumerator(+ function () { element = initializer(); },+ function () { return this.yieldReturn(element); },+ function () {+ if (element != null) {+ finalizer(element);+ element = null;+ }+ });+ });+ };++ // Overload:function(func)+ // Overload:function(func, count)+ Enumerable.generate = function (func, count) {+ if (count != null) return Enumerable.generate(func).take(count);+ func = Utils.createLambda(func);++ return new Enumerable(function () {+ return new IEnumerator(+ Functions.Blank,+ function () { return this.yieldReturn(func()); },+ Functions.Blank);+ });+ };++ // Overload:function()+ // Overload:function(start)+ // Overload:function(start, step)+ Enumerable.toInfinity = function (start, step) {+ if (start == null) start = 0;+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ return new IEnumerator(+ function () { value = start - step; },+ function () { return this.yieldReturn(value += step); },+ Functions.Blank);+ });+ };++ // Overload:function()+ // Overload:function(start)+ // Overload:function(start, step)+ Enumerable.toNegativeInfinity = function (start, step) {+ if (start == null) start = 0;+ if (step == null) step = 1;++ return new Enumerable(function () {+ var value;+ return new IEnumerator(+ function () { value = start + step; },+ function () { return this.yieldReturn(value -= step); },+ Functions.Blank);+ });+ };++ Enumerable.unfold = function (seed, func) {+ func = Utils.createLambda(func);++ return new Enumerable(function () {+ var isFirst = true;+ var value;+ return new IEnumerator(+ Functions.Blank,+ function () {+ if (isFirst) {+ isFirst = false;+ value = seed;+ return this.yieldReturn(value);+ }+ value = func(value);+ return this.yieldReturn(value);+ },+ Functions.Blank);+ });+ };++ Enumerable.defer = function (enumerableFactory) {++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = Enumerable.from(enumerableFactory()).getEnumerator(); },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : this.yieldBreak();+ },+ function () {+ Utils.dispose(enumerator);+ });+ });+ };++ // Extension Methods++ /* Projection and Filtering Methods */++ // Overload:function(func)+ // Overload:function(func, resultSelector<element>)+ // Overload:function(func, resultSelector<element, nestLevel>)+ Enumerable.prototype.traverseBreadthFirst = function (func, resultSelector) {+ var source = this;+ func = Utils.createLambda(func);+ resultSelector = Utils.createLambda(resultSelector);++ return new Enumerable(function () {+ var enumerator;+ var nestLevel = 0;+ var buffer = [];++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (true) {+ if (enumerator.moveNext()) {+ buffer.push(enumerator.current());+ return this.yieldReturn(resultSelector(enumerator.current(), nestLevel));+ }++ var next = Enumerable.from(buffer).selectMany(function (x) { return func(x); });+ if (!next.any()) {+ return false;+ }+ else {+ nestLevel++;+ buffer = [];+ Utils.dispose(enumerator);+ enumerator = next.getEnumerator();+ }+ }+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(func)+ // Overload:function(func, resultSelector<element>)+ // Overload:function(func, resultSelector<element, nestLevel>)+ Enumerable.prototype.traverseDepthFirst = function (func, resultSelector) {+ var source = this;+ func = Utils.createLambda(func);+ resultSelector = Utils.createLambda(resultSelector);++ return new Enumerable(function () {+ var enumeratorStack = [];+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (true) {+ if (enumerator.moveNext()) {+ var value = resultSelector(enumerator.current(), enumeratorStack.length);+ enumeratorStack.push(enumerator);+ enumerator = Enumerable.from(func(enumerator.current())).getEnumerator();+ return this.yieldReturn(value);+ }++ if (enumeratorStack.length <= 0) return false;+ Utils.dispose(enumerator);+ enumerator = enumeratorStack.pop();+ }+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Enumerable.from(enumeratorStack).forEach(function (s) { s.dispose(); });+ }+ });+ });+ };++ Enumerable.prototype.flatten = function () {+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var middleEnumerator = null;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (true) {+ if (middleEnumerator != null) {+ if (middleEnumerator.moveNext()) {+ return this.yieldReturn(middleEnumerator.current());+ }+ else {+ middleEnumerator = null;+ }+ }++ if (enumerator.moveNext()) {+ if (enumerator.current() instanceof Array) {+ Utils.dispose(middleEnumerator);+ middleEnumerator = Enumerable.from(enumerator.current())+ .selectMany(Functions.Identity)+ .flatten()+ .getEnumerator();+ continue;+ }+ else {+ return this.yieldReturn(enumerator.current());+ }+ }++ return false;+ }+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Utils.dispose(middleEnumerator);+ }+ });+ });+ };++ Enumerable.prototype.pairwise = function (selector) {+ var source = this;+ selector = Utils.createLambda(selector);++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ enumerator.moveNext();+ },+ function () {+ var prev = enumerator.current();+ return (enumerator.moveNext())+ ? this.yieldReturn(selector(prev, enumerator.current()))+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(func)+ // Overload:function(seed,func<value,element>)+ Enumerable.prototype.scan = function (seed, func) {+ var isUseSeed;+ if (func == null) {+ func = Utils.createLambda(seed); // arguments[0]+ isUseSeed = false;+ } else {+ func = Utils.createLambda(func);+ isUseSeed = true;+ }+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var value;+ var isFirst = true;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (isFirst) {+ isFirst = false;+ if (!isUseSeed) {+ if (enumerator.moveNext()) {+ return this.yieldReturn(value = enumerator.current());+ }+ }+ else {+ return this.yieldReturn(value = seed);+ }+ }++ return (enumerator.moveNext())+ ? this.yieldReturn(value = func(value, enumerator.current()))+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(selector<element>)+ // Overload:function(selector<element,index>)+ Enumerable.prototype.select = function (selector) {+ selector = Utils.createLambda(selector);++ if (selector.length <= 1) {+ return new WhereSelectEnumerable(this, null, selector);+ }+ else {+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(selector(enumerator.current(), index++))+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ }+ };++ // Overload:function(collectionSelector<element>)+ // Overload:function(collectionSelector<element,index>)+ // Overload:function(collectionSelector<element>,resultSelector)+ // Overload:function(collectionSelector<element,index>,resultSelector)+ Enumerable.prototype.selectMany = function (collectionSelector, resultSelector) {+ var source = this;+ collectionSelector = Utils.createLambda(collectionSelector);+ if (resultSelector == null) resultSelector = function (a, b) { return b; };+ resultSelector = Utils.createLambda(resultSelector);++ return new Enumerable(function () {+ var enumerator;+ var middleEnumerator = undefined;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (middleEnumerator === undefined) {+ if (!enumerator.moveNext()) return false;+ }+ do {+ if (middleEnumerator == null) {+ var middleSeq = collectionSelector(enumerator.current(), index++);+ middleEnumerator = Enumerable.from(middleSeq).getEnumerator();+ }+ if (middleEnumerator.moveNext()) {+ return this.yieldReturn(resultSelector(enumerator.current(), middleEnumerator.current()));+ }+ Utils.dispose(middleEnumerator);+ middleEnumerator = null;+ } while (enumerator.moveNext());+ return false;+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Utils.dispose(middleEnumerator);+ }+ });+ });+ };++ // Overload:function(predicate<element>)+ // Overload:function(predicate<element,index>)+ Enumerable.prototype.where = function (predicate) {+ predicate = Utils.createLambda(predicate);++ if (predicate.length <= 1) {+ return new WhereEnumerable(this, predicate);+ }+ else {+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (predicate(enumerator.current(), index++)) {+ return this.yieldReturn(enumerator.current());+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ }+ };+++ // Overload:function(selector<element>)+ // Overload:function(selector<element,index>)+ Enumerable.prototype.choose = function (selector) {+ selector = Utils.createLambda(selector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ var result = selector(enumerator.current(), index++);+ if (result != null) {+ return this.yieldReturn(result);+ }+ }+ return this.yieldBreak();+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.ofType = function (type) {+ var typeName;+ switch (type) {+ case Number:+ typeName = Types.Number;+ break;+ case String:+ typeName = Types.String;+ break;+ case Boolean:+ typeName = Types.Boolean;+ break;+ case Function:+ typeName = Types.Function;+ break;+ default:+ typeName = null;+ break;+ }+ return (typeName === null)+ ? this.where(function (x) { return x instanceof type; })+ : this.where(function (x) { return typeof x === typeName; });+ };++ // mutiple arguments, last one is selector, others are enumerable+ Enumerable.prototype.zip = function () {+ var args = arguments;+ var selector = Utils.createLambda(arguments[arguments.length - 1]);++ var source = this;+ // optimized case:argument is 2+ if (arguments.length == 2) {+ var second = arguments[0];++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;+ var index = 0;++ return new IEnumerator(+ function () {+ firstEnumerator = source.getEnumerator();+ secondEnumerator = Enumerable.from(second).getEnumerator();+ },+ function () {+ if (firstEnumerator.moveNext() && secondEnumerator.moveNext()) {+ return this.yieldReturn(selector(firstEnumerator.current(), secondEnumerator.current(), index++));+ }+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ } finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ }+ else {+ return new Enumerable(function () {+ var enumerators;+ var index = 0;++ return new IEnumerator(+ function () {+ var array = Enumerable.make(source)+ .concat(Enumerable.from(args).takeExceptLast().select(Enumerable.from))+ .select(function (x) { return x.getEnumerator() })+ .toArray();+ enumerators = Enumerable.from(array);+ },+ function () {+ if (enumerators.all(function (x) { return x.moveNext() })) {+ var array = enumerators+ .select(function (x) { return x.current() })+ .toArray();+ array.push(index++);+ return this.yieldReturn(selector.apply(null, array));+ }+ else {+ return this.yieldBreak();+ }+ },+ function () {+ Enumerable.from(enumerators).forEach(Utils.dispose);+ });+ });+ }+ };++ // mutiple arguments+ Enumerable.prototype.merge = function () {+ var args = arguments;+ var source = this;++ return new Enumerable(function () {+ var enumerators;+ var index = -1;++ return new IEnumerator(+ function () {+ enumerators = Enumerable.make(source)+ .concat(Enumerable.from(args).select(Enumerable.from))+ .select(function (x) { return x.getEnumerator() })+ .toArray();+ },+ function () {+ while (enumerators.length > 0) {+ index = (index >= enumerators.length - 1) ? 0 : index + 1;+ var enumerator = enumerators[index];++ if (enumerator.moveNext()) {+ return this.yieldReturn(enumerator.current());+ }+ else {+ enumerator.dispose();+ enumerators.splice(index--, 1);+ }+ }+ return this.yieldBreak();+ },+ function () {+ Enumerable.from(enumerators).forEach(Utils.dispose);+ });+ });+ };++ /* Join Methods */++ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector)+ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector)+ Enumerable.prototype.join = function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector) {+ outerKeySelector = Utils.createLambda(outerKeySelector);+ innerKeySelector = Utils.createLambda(innerKeySelector);+ resultSelector = Utils.createLambda(resultSelector);+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var outerEnumerator;+ var lookup;+ var innerElements = null;+ var innerCount = 0;++ return new IEnumerator(+ function () {+ outerEnumerator = source.getEnumerator();+ lookup = Enumerable.from(inner).toLookup(innerKeySelector, Functions.Identity, compareSelector);+ },+ function () {+ while (true) {+ if (innerElements != null) {+ var innerElement = innerElements[innerCount++];+ if (innerElement !== undefined) {+ return this.yieldReturn(resultSelector(outerEnumerator.current(), innerElement));+ }++ innerElement = null;+ innerCount = 0;+ }++ if (outerEnumerator.moveNext()) {+ var key = outerKeySelector(outerEnumerator.current());+ innerElements = lookup.get(key).toArray();+ } else {+ return false;+ }+ }+ },+ function () { Utils.dispose(outerEnumerator); });+ });+ };++ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector)+ // Overload:function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector)+ Enumerable.prototype.groupJoin = function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector) {+ outerKeySelector = Utils.createLambda(outerKeySelector);+ innerKeySelector = Utils.createLambda(innerKeySelector);+ resultSelector = Utils.createLambda(resultSelector);+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator = source.getEnumerator();+ var lookup = null;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ lookup = Enumerable.from(inner).toLookup(innerKeySelector, Functions.Identity, compareSelector);+ },+ function () {+ if (enumerator.moveNext()) {+ var innerElement = lookup.get(outerKeySelector(enumerator.current()));+ return this.yieldReturn(resultSelector(enumerator.current(), innerElement));+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ /* Set Methods */++ Enumerable.prototype.all = function (predicate) {+ predicate = Utils.createLambda(predicate);++ var result = true;+ this.forEach(function (x) {+ if (!predicate(x)) {+ result = false;+ return false; // break+ }+ });+ return result;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.any = function (predicate) {+ predicate = Utils.createLambda(predicate);++ var enumerator = this.getEnumerator();+ try {+ if (arguments.length == 0) return enumerator.moveNext(); // case:function()++ while (enumerator.moveNext()) // case:function(predicate)+ {+ if (predicate(enumerator.current())) return true;+ }+ return false;+ }+ finally {+ Utils.dispose(enumerator);+ }+ };++ Enumerable.prototype.isEmpty = function () {+ return !this.any();+ };++ // multiple arguments+ Enumerable.prototype.concat = function () {+ var source = this;++ if (arguments.length == 1) {+ var second = arguments[0];++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;++ return new IEnumerator(+ function () { firstEnumerator = source.getEnumerator(); },+ function () {+ if (secondEnumerator == null) {+ if (firstEnumerator.moveNext()) return this.yieldReturn(firstEnumerator.current());+ secondEnumerator = Enumerable.from(second).getEnumerator();+ }+ if (secondEnumerator.moveNext()) return this.yieldReturn(secondEnumerator.current());+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ }+ else {+ var args = arguments;++ return new Enumerable(function () {+ var enumerators;++ return new IEnumerator(+ function () {+ enumerators = Enumerable.make(source)+ .concat(Enumerable.from(args).select(Enumerable.from))+ .select(function (x) { return x.getEnumerator() })+ .toArray();+ },+ function () {+ while (enumerators.length > 0) {+ var enumerator = enumerators[0];++ if (enumerator.moveNext()) {+ return this.yieldReturn(enumerator.current());+ }+ else {+ enumerator.dispose();+ enumerators.splice(0, 1);+ }+ }+ return this.yieldBreak();+ },+ function () {+ Enumerable.from(enumerators).forEach(Utils.dispose);+ });+ });+ }+ };++ Enumerable.prototype.insert = function (index, second) {+ var source = this;++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;+ var count = 0;+ var isEnumerated = false;++ return new IEnumerator(+ function () {+ firstEnumerator = source.getEnumerator();+ secondEnumerator = Enumerable.from(second).getEnumerator();+ },+ function () {+ if (count == index && secondEnumerator.moveNext()) {+ isEnumerated = true;+ return this.yieldReturn(secondEnumerator.current());+ }+ if (firstEnumerator.moveNext()) {+ count++;+ return this.yieldReturn(firstEnumerator.current());+ }+ if (!isEnumerated && secondEnumerator.moveNext()) {+ return this.yieldReturn(secondEnumerator.current());+ }+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ };++ Enumerable.prototype.alternate = function (alternateValueOrSequence) {+ var source = this;++ return new Enumerable(function () {+ var buffer;+ var enumerator;+ var alternateSequence;+ var alternateEnumerator;++ return new IEnumerator(+ function () {+ if (alternateValueOrSequence instanceof Array || alternateValueOrSequence.getEnumerator != null) {+ alternateSequence = Enumerable.from(Enumerable.from(alternateValueOrSequence).toArray()); // freeze+ }+ else {+ alternateSequence = Enumerable.make(alternateValueOrSequence);+ }+ enumerator = source.getEnumerator();+ if (enumerator.moveNext()) buffer = enumerator.current();+ },+ function () {+ while (true) {+ if (alternateEnumerator != null) {+ if (alternateEnumerator.moveNext()) {+ return this.yieldReturn(alternateEnumerator.current());+ }+ else {+ alternateEnumerator = null;+ }+ }++ if (buffer == null && enumerator.moveNext()) {+ buffer = enumerator.current(); // hasNext+ alternateEnumerator = alternateSequence.getEnumerator();+ continue; // GOTO+ }+ else if (buffer != null) {+ var retVal = buffer;+ buffer = null;+ return this.yieldReturn(retVal);+ }++ return this.yieldBreak();+ }+ },+ function () {+ try {+ Utils.dispose(enumerator);+ }+ finally {+ Utils.dispose(alternateEnumerator);+ }+ });+ });+ };++ // Overload:function(value)+ // Overload:function(value, compareSelector)+ Enumerable.prototype.contains = function (value, compareSelector) {+ compareSelector = Utils.createLambda(compareSelector);+ var enumerator = this.getEnumerator();+ try {+ while (enumerator.moveNext()) {+ if (compareSelector(enumerator.current()) === value) return true;+ }+ return false;+ }+ finally {+ Utils.dispose(enumerator);+ }+ };++ Enumerable.prototype.defaultIfEmpty = function (defaultValue) {+ var source = this;+ if (defaultValue === undefined) defaultValue = null;++ return new Enumerable(function () {+ var enumerator;+ var isFirst = true;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (enumerator.moveNext()) {+ isFirst = false;+ return this.yieldReturn(enumerator.current());+ }+ else if (isFirst) {+ isFirst = false;+ return this.yieldReturn(defaultValue);+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function()+ // Overload:function(compareSelector)+ Enumerable.prototype.distinct = function (compareSelector) {+ return this.except(Enumerable.empty(), compareSelector);+ };++ Enumerable.prototype.distinctUntilChanged = function (compareSelector) {+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var compareKey;+ var initial;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ },+ function () {+ while (enumerator.moveNext()) {+ var key = compareSelector(enumerator.current());++ if (initial) {+ initial = false;+ compareKey = key;+ return this.yieldReturn(enumerator.current());+ }++ if (compareKey === key) {+ continue;+ }++ compareKey = key;+ return this.yieldReturn(enumerator.current());+ }+ return this.yieldBreak();+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(second)+ // Overload:function(second, compareSelector)+ Enumerable.prototype.except = function (second, compareSelector) {+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var keys;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ keys = new Dictionary(compareSelector);+ Enumerable.from(second).forEach(function (key) { keys.add(key); });+ },+ function () {+ while (enumerator.moveNext()) {+ var current = enumerator.current();+ if (!keys.contains(current)) {+ keys.add(current);+ return this.yieldReturn(current);+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(second)+ // Overload:function(second, compareSelector)+ Enumerable.prototype.intersect = function (second, compareSelector) {+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var keys;+ var outs;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();++ keys = new Dictionary(compareSelector);+ Enumerable.from(second).forEach(function (key) { keys.add(key); });+ outs = new Dictionary(compareSelector);+ },+ function () {+ while (enumerator.moveNext()) {+ var current = enumerator.current();+ if (!outs.contains(current) && keys.contains(current)) {+ outs.add(current);+ return this.yieldReturn(current);+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(second)+ // Overload:function(second, compareSelector)+ Enumerable.prototype.sequenceEqual = function (second, compareSelector) {+ compareSelector = Utils.createLambda(compareSelector);++ var firstEnumerator = this.getEnumerator();+ try {+ var secondEnumerator = Enumerable.from(second).getEnumerator();+ try {+ while (firstEnumerator.moveNext()) {+ if (!secondEnumerator.moveNext()+ || compareSelector(firstEnumerator.current()) !== compareSelector(secondEnumerator.current())) {+ return false;+ }+ }++ if (secondEnumerator.moveNext()) return false;+ return true;+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ }+ finally {+ Utils.dispose(firstEnumerator);+ }+ };++ Enumerable.prototype.union = function (second, compareSelector) {+ compareSelector = Utils.createLambda(compareSelector);+ var source = this;++ return new Enumerable(function () {+ var firstEnumerator;+ var secondEnumerator;+ var keys;++ return new IEnumerator(+ function () {+ firstEnumerator = source.getEnumerator();+ keys = new Dictionary(compareSelector);+ },+ function () {+ var current;+ if (secondEnumerator === undefined) {+ while (firstEnumerator.moveNext()) {+ current = firstEnumerator.current();+ if (!keys.contains(current)) {+ keys.add(current);+ return this.yieldReturn(current);+ }+ }+ secondEnumerator = Enumerable.from(second).getEnumerator();+ }+ while (secondEnumerator.moveNext()) {+ current = secondEnumerator.current();+ if (!keys.contains(current)) {+ keys.add(current);+ return this.yieldReturn(current);+ }+ }+ return false;+ },+ function () {+ try {+ Utils.dispose(firstEnumerator);+ }+ finally {+ Utils.dispose(secondEnumerator);+ }+ });+ });+ };++ /* Ordering Methods */++ Enumerable.prototype.orderBy = function (keySelector) {+ return new OrderedEnumerable(this, keySelector, false);+ };++ Enumerable.prototype.orderByDescending = function (keySelector) {+ return new OrderedEnumerable(this, keySelector, true);+ };++ Enumerable.prototype.reverse = function () {+ var source = this;++ return new Enumerable(function () {+ var buffer;+ var index;++ return new IEnumerator(+ function () {+ buffer = source.toArray();+ index = buffer.length;+ },+ function () {+ return (index > 0)+ ? this.yieldReturn(buffer[--index])+ : false;+ },+ Functions.Blank);+ });+ };++ Enumerable.prototype.shuffle = function () {+ var source = this;++ return new Enumerable(function () {+ var buffer;++ return new IEnumerator(+ function () { buffer = source.toArray(); },+ function () {+ if (buffer.length > 0) {+ var i = Math.floor(Math.random() * buffer.length);+ return this.yieldReturn(buffer.splice(i, 1)[0]);+ }+ return false;+ },+ Functions.Blank);+ });+ };++ Enumerable.prototype.weightedSample = function (weightSelector) {+ weightSelector = Utils.createLambda(weightSelector);+ var source = this;++ return new Enumerable(function () {+ var sortedByBound;+ var totalWeight = 0;++ return new IEnumerator(+ function () {+ sortedByBound = source+ .choose(function (x) {+ var weight = weightSelector(x);+ if (weight <= 0) return null; // ignore 0++ totalWeight += weight;+ return { value: x, bound: totalWeight };+ })+ .toArray();+ },+ function () {+ if (sortedByBound.length > 0) {+ var draw = Math.floor(Math.random() * totalWeight) + 1;++ var lower = -1;+ var upper = sortedByBound.length;+ while (upper - lower > 1) {+ var index = Math.floor((lower + upper) / 2);+ if (sortedByBound[index].bound >= draw) {+ upper = index;+ }+ else {+ lower = index;+ }+ }++ return this.yieldReturn(sortedByBound[upper].value);+ }++ return this.yieldBreak();+ },+ Functions.Blank);+ });+ };++ /* Grouping Methods */++ // Overload:function(keySelector)+ // Overload:function(keySelector,elementSelector)+ // Overload:function(keySelector,elementSelector,resultSelector)+ // Overload:function(keySelector,elementSelector,resultSelector,compareSelector)+ Enumerable.prototype.groupBy = function (keySelector, elementSelector, resultSelector, compareSelector) {+ var source = this;+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ if (resultSelector != null) resultSelector = Utils.createLambda(resultSelector);+ compareSelector = Utils.createLambda(compareSelector);++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () {+ enumerator = source.toLookup(keySelector, elementSelector, compareSelector)+ .toEnumerable()+ .getEnumerator();+ },+ function () {+ while (enumerator.moveNext()) {+ return (resultSelector == null)+ ? this.yieldReturn(enumerator.current())+ : this.yieldReturn(resultSelector(enumerator.current().key(), enumerator.current()));+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(keySelector)+ // Overload:function(keySelector,elementSelector)+ // Overload:function(keySelector,elementSelector,resultSelector)+ // Overload:function(keySelector,elementSelector,resultSelector,compareSelector)+ Enumerable.prototype.partitionBy = function (keySelector, elementSelector, resultSelector, compareSelector) {++ var source = this;+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ compareSelector = Utils.createLambda(compareSelector);+ var hasResultSelector;+ if (resultSelector == null) {+ hasResultSelector = false;+ resultSelector = function (key, group) { return new Grouping(key, group); };+ }+ else {+ hasResultSelector = true;+ resultSelector = Utils.createLambda(resultSelector);+ }++ return new Enumerable(function () {+ var enumerator;+ var key;+ var compareKey;+ var group = [];++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ if (enumerator.moveNext()) {+ key = keySelector(enumerator.current());+ compareKey = compareSelector(key);+ group.push(elementSelector(enumerator.current()));+ }+ },+ function () {+ var hasNext;+ while ((hasNext = enumerator.moveNext()) == true) {+ if (compareKey === compareSelector(keySelector(enumerator.current()))) {+ group.push(elementSelector(enumerator.current()));+ }+ else break;+ }++ if (group.length > 0) {+ var result = (hasResultSelector)+ ? resultSelector(key, Enumerable.from(group))+ : resultSelector(key, group);+ if (hasNext) {+ key = keySelector(enumerator.current());+ compareKey = compareSelector(key);+ group = [elementSelector(enumerator.current())];+ }+ else group = [];++ return this.yieldReturn(result);+ }++ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.buffer = function (count) {+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ var array = [];+ var index = 0;+ while (enumerator.moveNext()) {+ array.push(enumerator.current());+ if (++index >= count) return this.yieldReturn(array);+ }+ if (array.length > 0) return this.yieldReturn(array);+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ /* Aggregate Methods */++ // Overload:function(func)+ // Overload:function(seed,func)+ // Overload:function(seed,func,resultSelector)+ Enumerable.prototype.aggregate = function (seed, func, resultSelector) {+ resultSelector = Utils.createLambda(resultSelector);+ return resultSelector(this.scan(seed, func, resultSelector).last());+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.average = function (selector) {+ selector = Utils.createLambda(selector);++ var sum = 0;+ var count = 0;+ this.forEach(function (x) {+ sum += selector(x);+ ++count;+ });++ return sum / count;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.count = function (predicate) {+ predicate = (predicate == null) ? Functions.True : Utils.createLambda(predicate);++ var count = 0;+ this.forEach(function (x, i) {+ if (predicate(x, i))++count;+ });+ return count;+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.max = function (selector) {+ if (selector == null) selector = Functions.Identity;+ return this.select(selector).aggregate(function (a, b) { return (a > b) ? a : b; });+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.min = function (selector) {+ if (selector == null) selector = Functions.Identity;+ return this.select(selector).aggregate(function (a, b) { return (a < b) ? a : b; });+ };++ Enumerable.prototype.maxBy = function (keySelector) {+ keySelector = Utils.createLambda(keySelector);+ return this.aggregate(function (a, b) { return (keySelector(a) > keySelector(b)) ? a : b; });+ };++ Enumerable.prototype.minBy = function (keySelector) {+ keySelector = Utils.createLambda(keySelector);+ return this.aggregate(function (a, b) { return (keySelector(a) < keySelector(b)) ? a : b; });+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.sum = function (selector) {+ if (selector == null) selector = Functions.Identity;+ return this.select(selector).aggregate(0, function (a, b) { return a + b; });+ };++ /* Paging Methods */++ Enumerable.prototype.elementAt = function (index) {+ var value;+ var found = false;+ this.forEach(function (x, i) {+ if (i == index) {+ value = x;+ found = true;+ return false;+ }+ });++ if (!found) throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");+ return value;+ };++ Enumerable.prototype.elementAtOrDefault = function (index, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ var value;+ var found = false;+ this.forEach(function (x, i) {+ if (i == index) {+ value = x;+ found = true;+ return false;+ }+ });++ return (!found) ? defaultValue : value;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.first = function (predicate) {+ if (predicate != null) return this.where(predicate).first();++ var value;+ var found = false;+ this.forEach(function (x) {+ value = x;+ found = true;+ return false;+ });++ if (!found) throw new Error("first:No element satisfies the condition.");+ return value;+ };++ Enumerable.prototype.firstOrDefault = function (predicate, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) return this.where(predicate).firstOrDefault(null, defaultValue);++ var value;+ var found = false;+ this.forEach(function (x) {+ value = x;+ found = true;+ return false;+ });+ return (!found) ? defaultValue : value;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.last = function (predicate) {+ if (predicate != null) return this.where(predicate).last();++ var value;+ var found = false;+ this.forEach(function (x) {+ found = true;+ value = x;+ });++ if (!found) throw new Error("last:No element satisfies the condition.");+ return value;+ };++ // Overload:function(defaultValue)+ // Overload:function(defaultValue,predicate)+ Enumerable.prototype.lastOrDefault = function (predicate, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) return this.where(predicate).lastOrDefault(null, defaultValue);++ var value;+ var found = false;+ this.forEach(function (x) {+ found = true;+ value = x;+ });+ return (!found) ? defaultValue : value;+ };++ // Overload:function()+ // Overload:function(predicate)+ Enumerable.prototype.single = function (predicate) {+ if (predicate != null) return this.where(predicate).single();++ var value;+ var found = false;+ this.forEach(function (x) {+ if (!found) {+ found = true;+ value = x;+ } else throw new Error("single:sequence contains more than one element.");+ });++ if (!found) throw new Error("single:No element satisfies the condition.");+ return value;+ };++ // Overload:function(defaultValue)+ // Overload:function(defaultValue,predicate)+ Enumerable.prototype.singleOrDefault = function (predicate, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) return this.where(predicate).singleOrDefault(null, defaultValue);++ var value;+ var found = false;+ this.forEach(function (x) {+ if (!found) {+ found = true;+ value = x;+ } else throw new Error("single:sequence contains more than one element.");+ });++ return (!found) ? defaultValue : value;+ };++ Enumerable.prototype.skip = function (count) {+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () {+ enumerator = source.getEnumerator();+ while (index++ < count && enumerator.moveNext()) {+ }+ ;+ },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(predicate<element>)+ // Overload:function(predicate<element,index>)+ Enumerable.prototype.skipWhile = function (predicate) {+ predicate = Utils.createLambda(predicate);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;+ var isSkipEnd = false;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (!isSkipEnd) {+ if (enumerator.moveNext()) {+ if (!predicate(enumerator.current(), index++)) {+ isSkipEnd = true;+ return this.yieldReturn(enumerator.current());+ }+ continue;+ } else return false;+ }++ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;++ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.take = function (count) {+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (index++ < count && enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); }+ );+ });+ };++ // Overload:function(predicate<element>)+ // Overload:function(predicate<element,index>)+ Enumerable.prototype.takeWhile = function (predicate) {+ predicate = Utils.createLambda(predicate);+ var source = this;++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (enumerator.moveNext() && predicate(enumerator.current(), index++))+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function()+ // Overload:function(count)+ Enumerable.prototype.takeExceptLast = function (count) {+ if (count == null) count = 1;+ var source = this;++ return new Enumerable(function () {+ if (count <= 0) return source.getEnumerator(); // do nothing++ var enumerator;+ var q = [];++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (q.length == count) {+ q.push(enumerator.current());+ return this.yieldReturn(q.shift());+ }+ q.push(enumerator.current());+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.takeFromLast = function (count) {+ if (count <= 0 || count == null) return Enumerable.empty();+ var source = this;++ return new Enumerable(function () {+ var sourceEnumerator;+ var enumerator;+ var q = [];++ return new IEnumerator(+ function () { sourceEnumerator = source.getEnumerator(); },+ function () {+ while (sourceEnumerator.moveNext()) {+ if (q.length == count) q.shift();+ q.push(sourceEnumerator.current());+ }+ if (enumerator == null) {+ enumerator = Enumerable.from(q).getEnumerator();+ }+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(item)+ // Overload:function(predicate)+ Enumerable.prototype.indexOf = function (item) {+ var found = null;++ // item as predicate+ if (typeof (item) === Types.Function) {+ this.forEach(function (x, i) {+ if (item(x, i)) {+ found = i;+ return false;+ }+ });+ }+ else {+ this.forEach(function (x, i) {+ if (x === item) {+ found = i;+ return false;+ }+ });+ }++ return (found !== null) ? found : -1;+ };++ // Overload:function(item)+ // Overload:function(predicate)+ Enumerable.prototype.lastIndexOf = function (item) {+ var result = -1;++ // item as predicate+ if (typeof (item) === Types.Function) {+ this.forEach(function (x, i) {+ if (item(x, i)) result = i;+ });+ }+ else {+ this.forEach(function (x, i) {+ if (x === item) result = i;+ });+ }++ return result;+ };++ /* Convert Methods */++ Enumerable.prototype.cast = function () {+ return this;+ };++ Enumerable.prototype.asEnumerable = function () {+ return Enumerable.from(this);+ };++ Enumerable.prototype.toArray = function () {+ var array = [];+ this.forEach(function (x) { array.push(x); });+ return array;+ };++ // Overload:function(keySelector)+ // Overload:function(keySelector, elementSelector)+ // Overload:function(keySelector, elementSelector, compareSelector)+ Enumerable.prototype.toLookup = function (keySelector, elementSelector, compareSelector) {+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ compareSelector = Utils.createLambda(compareSelector);++ var dict = new Dictionary(compareSelector);+ this.forEach(function (x) {+ var key = keySelector(x);+ var element = elementSelector(x);++ var array = dict.get(key);+ if (array !== undefined) array.push(element);+ else dict.add(key, [element]);+ });+ return new Lookup(dict);+ };++ Enumerable.prototype.toObject = function (keySelector, elementSelector) {+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);++ var obj = {};+ this.forEach(function (x) {+ obj[keySelector(x)] = elementSelector(x);+ });+ return obj;+ };++ // Overload:function(keySelector, elementSelector)+ // Overload:function(keySelector, elementSelector, compareSelector)+ Enumerable.prototype.toDictionary = function (keySelector, elementSelector, compareSelector) {+ keySelector = Utils.createLambda(keySelector);+ elementSelector = Utils.createLambda(elementSelector);+ compareSelector = Utils.createLambda(compareSelector);++ var dict = new Dictionary(compareSelector);+ this.forEach(function (x) {+ dict.add(keySelector(x), elementSelector(x));+ });+ return dict;+ };++ // Overload:function()+ // Overload:function(replacer)+ // Overload:function(replacer, space)+ Enumerable.prototype.toJSONString = function (replacer, space) {+ if (typeof JSON === Types.Undefined || JSON.stringify == null) {+ throw new Error("toJSONString can't find JSON.stringify. This works native JSON support Browser or include json2.js");+ }+ return JSON.stringify(this.toArray(), replacer, space);+ };++ // Overload:function()+ // Overload:function(separator)+ // Overload:function(separator,selector)+ Enumerable.prototype.toJoinedString = function (separator, selector) {+ if (separator == null) separator = "";+ if (selector == null) selector = Functions.Identity;++ return this.select(selector).toArray().join(separator);+ };+++ /* Action Methods */++ // Overload:function(action<element>)+ // Overload:function(action<element,index>)+ Enumerable.prototype.doAction = function (action) {+ var source = this;+ action = Utils.createLambda(action);++ return new Enumerable(function () {+ var enumerator;+ var index = 0;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ if (enumerator.moveNext()) {+ action(enumerator.current(), index++);+ return this.yieldReturn(enumerator.current());+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ // Overload:function(action<element>)+ // Overload:function(action<element,index>)+ // Overload:function(func<element,bool>)+ // Overload:function(func<element,index,bool>)+ Enumerable.prototype.forEach = function (action) {+ action = Utils.createLambda(action);++ var index = 0;+ var enumerator = this.getEnumerator();+ try {+ while (enumerator.moveNext()) {+ if (action(enumerator.current(), index++) === false) break;+ }+ } finally {+ Utils.dispose(enumerator);+ }+ };++ // Overload:function()+ // Overload:function(separator)+ // Overload:function(separator,selector)+ Enumerable.prototype.write = function (separator, selector) {+ if (separator == null) separator = "";+ selector = Utils.createLambda(selector);++ var isFirst = true;+ this.forEach(function (item) {+ if (isFirst) isFirst = false;+ else document.write(separator);+ document.write(selector(item));+ });+ };++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.writeLine = function (selector) {+ selector = Utils.createLambda(selector);++ this.forEach(function (item) {+ document.writeln(selector(item) + "<br />");+ });+ };++ Enumerable.prototype.force = function () {+ var enumerator = this.getEnumerator();++ try {+ while (enumerator.moveNext()) {+ }+ }+ finally {+ Utils.dispose(enumerator);+ }+ };++ /* Functional Methods */++ Enumerable.prototype.letBind = function (func) {+ func = Utils.createLambda(func);+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () {+ enumerator = Enumerable.from(func(source)).getEnumerator();+ },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.share = function () {+ var source = this;+ var sharedEnumerator;+ var disposed = false;++ return new DisposableEnumerable(function () {+ return new IEnumerator(+ function () {+ if (sharedEnumerator == null) {+ sharedEnumerator = source.getEnumerator();+ }+ },+ function () {+ if (disposed) throw new Error("enumerator is disposed");++ return (sharedEnumerator.moveNext())+ ? this.yieldReturn(sharedEnumerator.current())+ : false;+ },+ Functions.Blank+ );+ }, function () {+ disposed = true;+ Utils.dispose(sharedEnumerator);+ });+ };++ Enumerable.prototype.memoize = function () {+ var source = this;+ var cache;+ var enumerator;+ var disposed = false;++ return new DisposableEnumerable(function () {+ var index = -1;++ return new IEnumerator(+ function () {+ if (enumerator == null) {+ enumerator = source.getEnumerator();+ cache = [];+ }+ },+ function () {+ if (disposed) throw new Error("enumerator is disposed");++ index++;+ if (cache.length <= index) {+ return (enumerator.moveNext())+ ? this.yieldReturn(cache[index] = enumerator.current())+ : false;+ }++ return this.yieldReturn(cache[index]);+ },+ Functions.Blank+ );+ }, function () {+ disposed = true;+ Utils.dispose(enumerator);+ cache = null;+ });+ };++ /* Error Handling Methods */++ Enumerable.prototype.catchError = function (handler) {+ handler = Utils.createLambda(handler);+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ try {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ } catch (e) {+ handler(e);+ return false;+ }+ },+ function () { Utils.dispose(enumerator); });+ });+ };++ Enumerable.prototype.finallyAction = function (finallyAction) {+ finallyAction = Utils.createLambda(finallyAction);+ var source = this;++ return new Enumerable(function () {+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : false;+ },+ function () {+ try {+ Utils.dispose(enumerator);+ } finally {+ finallyAction();+ }+ });+ });+ };++ /* For Debug Methods */++ // Overload:function()+ // Overload:function(selector)+ Enumerable.prototype.log = function (selector) {+ selector = Utils.createLambda(selector);++ return this.doAction(function (item) {+ if (typeof console !== Types.Undefined) {+ console.log(selector(item));+ }+ });+ };++ // Overload:function()+ // Overload:function(message)+ // Overload:function(message,selector)+ Enumerable.prototype.trace = function (message, selector) {+ if (message == null) message = "Trace";+ selector = Utils.createLambda(selector);++ return this.doAction(function (item) {+ if (typeof console !== Types.Undefined) {+ console.log(message, selector(item));+ }+ });+ };++ // private++ var OrderedEnumerable = function (source, keySelector, descending, parent) {+ this.source = source;+ this.keySelector = Utils.createLambda(keySelector);+ this.descending = descending;+ this.parent = parent;+ };+ OrderedEnumerable.prototype = new Enumerable();++ OrderedEnumerable.prototype.createOrderedEnumerable = function (keySelector, descending) {+ return new OrderedEnumerable(this.source, keySelector, descending, this);+ };++ OrderedEnumerable.prototype.thenBy = function (keySelector) {+ return this.createOrderedEnumerable(keySelector, false);+ };++ OrderedEnumerable.prototype.thenByDescending = function (keySelector) {+ return this.createOrderedEnumerable(keySelector, true);+ };++ OrderedEnumerable.prototype.getEnumerator = function () {+ var self = this;+ var buffer;+ var indexes;+ var index = 0;++ return new IEnumerator(+ function () {+ buffer = [];+ indexes = [];+ self.source.forEach(function (item, index) {+ buffer.push(item);+ indexes.push(index);+ });+ var sortContext = SortContext.create(self, null);+ sortContext.GenerateKeys(buffer);++ indexes.sort(function (a, b) { return sortContext.compare(a, b); });+ },+ function () {+ return (index < indexes.length)+ ? this.yieldReturn(buffer[indexes[index++]])+ : false;+ },+ Functions.Blank+ );+ };++ var SortContext = function (keySelector, descending, child) {+ this.keySelector = keySelector;+ this.descending = descending;+ this.child = child;+ this.keys = null;+ };++ SortContext.create = function (orderedEnumerable, currentContext) {+ var context = new SortContext(orderedEnumerable.keySelector, orderedEnumerable.descending, currentContext);+ if (orderedEnumerable.parent != null) return SortContext.create(orderedEnumerable.parent, context);+ return context;+ };++ SortContext.prototype.GenerateKeys = function (source) {+ var len = source.length;+ var keySelector = this.keySelector;+ var keys = new Array(len);+ for (var i = 0; i < len; i++) keys[i] = keySelector(source[i]);+ this.keys = keys;++ if (this.child != null) this.child.GenerateKeys(source);+ };++ SortContext.prototype.compare = function (index1, index2) {+ var comparison = Utils.compare(this.keys[index1], this.keys[index2]);++ if (comparison == 0) {+ if (this.child != null) return this.child.compare(index1, index2);+ return Utils.compare(index1, index2);+ }++ return (this.descending) ? -comparison : comparison;+ };++ var DisposableEnumerable = function (getEnumerator, dispose) {+ this.dispose = dispose;+ Enumerable.call(this, getEnumerator);+ };+ DisposableEnumerable.prototype = new Enumerable();++ // optimize array or arraylike object++ var ArrayEnumerable = function (source) {+ this.getSource = function () { return source; };+ };+ ArrayEnumerable.prototype = new Enumerable();++ ArrayEnumerable.prototype.any = function (predicate) {+ return (predicate == null)+ ? (this.getSource().length > 0)+ : Enumerable.prototype.any.apply(this, arguments);+ };++ ArrayEnumerable.prototype.count = function (predicate) {+ return (predicate == null)+ ? this.getSource().length+ : Enumerable.prototype.count.apply(this, arguments);+ };++ ArrayEnumerable.prototype.elementAt = function (index) {+ var source = this.getSource();+ return (0 <= index && index < source.length)+ ? source[index]+ : Enumerable.prototype.elementAt.apply(this, arguments);+ };++ ArrayEnumerable.prototype.elementAtOrDefault = function (index, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ var source = this.getSource();+ return (0 <= index && index < source.length)+ ? source[index]+ : defaultValue;+ };++ ArrayEnumerable.prototype.first = function (predicate) {+ var source = this.getSource();+ return (predicate == null && source.length > 0)+ ? source[0]+ : Enumerable.prototype.first.apply(this, arguments);+ };++ ArrayEnumerable.prototype.firstOrDefault = function (predicate, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) {+ return Enumerable.prototype.firstOrDefault.apply(this, arguments);+ }++ var source = this.getSource();+ return source.length > 0 ? source[0] : defaultValue;+ };++ ArrayEnumerable.prototype.last = function (predicate) {+ var source = this.getSource();+ return (predicate == null && source.length > 0)+ ? source[source.length - 1]+ : Enumerable.prototype.last.apply(this, arguments);+ };++ ArrayEnumerable.prototype.lastOrDefault = function (predicate, defaultValue) {+ if (defaultValue === undefined) defaultValue = null;+ if (predicate != null) {+ return Enumerable.prototype.lastOrDefault.apply(this, arguments);+ }++ var source = this.getSource();+ return source.length > 0 ? source[source.length - 1] : defaultValue;+ };++ ArrayEnumerable.prototype.skip = function (count) {+ var source = this.getSource();++ return new Enumerable(function () {+ var index;++ return new IEnumerator(+ function () { index = (count < 0) ? 0 : count; },+ function () {+ return (index < source.length)+ ? this.yieldReturn(source[index++])+ : false;+ },+ Functions.Blank);+ });+ };++ ArrayEnumerable.prototype.takeExceptLast = function (count) {+ if (count == null) count = 1;+ return this.take(this.getSource().length - count);+ };++ ArrayEnumerable.prototype.takeFromLast = function (count) {+ return this.skip(this.getSource().length - count);+ };++ ArrayEnumerable.prototype.reverse = function () {+ var source = this.getSource();++ return new Enumerable(function () {+ var index;++ return new IEnumerator(+ function () {+ index = source.length;+ },+ function () {+ return (index > 0)+ ? this.yieldReturn(source[--index])+ : false;+ },+ Functions.Blank);+ });+ };++ ArrayEnumerable.prototype.sequenceEqual = function (second, compareSelector) {+ if ((second instanceof ArrayEnumerable || second instanceof Array)+ && compareSelector == null+ && Enumerable.from(second).count() != this.count()) {+ return false;+ }++ return Enumerable.prototype.sequenceEqual.apply(this, arguments);+ };++ ArrayEnumerable.prototype.toJoinedString = function (separator, selector) {+ var source = this.getSource();+ if (selector != null || !(source instanceof Array)) {+ return Enumerable.prototype.toJoinedString.apply(this, arguments);+ }++ if (separator == null) separator = "";+ return source.join(separator);+ };++ ArrayEnumerable.prototype.getEnumerator = function () {+ var source = this.getSource();+ var index = -1;++ // fast and simple enumerator+ return {+ current: function () { return source[index]; },+ moveNext: function () {+ return ++index < source.length;+ },+ dispose: Functions.Blank+ };+ };++ // optimization for multiple where and multiple select and whereselect++ var WhereEnumerable = function (source, predicate) {+ this.prevSource = source;+ this.prevPredicate = predicate; // predicate.length always <= 1+ };+ WhereEnumerable.prototype = new Enumerable();++ WhereEnumerable.prototype.where = function (predicate) {+ predicate = Utils.createLambda(predicate);++ if (predicate.length <= 1) {+ var prevPredicate = this.prevPredicate;+ var composedPredicate = function (x) { return prevPredicate(x) && predicate(x); };+ return new WhereEnumerable(this.prevSource, composedPredicate);+ }+ else {+ // if predicate use index, can't compose+ return Enumerable.prototype.where.call(this, predicate);+ }+ };++ WhereEnumerable.prototype.select = function (selector) {+ selector = Utils.createLambda(selector);++ return (selector.length <= 1)+ ? new WhereSelectEnumerable(this.prevSource, this.prevPredicate, selector)+ : Enumerable.prototype.select.call(this, selector);+ };++ WhereEnumerable.prototype.getEnumerator = function () {+ var predicate = this.prevPredicate;+ var source = this.prevSource;+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (predicate(enumerator.current())) {+ return this.yieldReturn(enumerator.current());+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ };++ var WhereSelectEnumerable = function (source, predicate, selector) {+ this.prevSource = source;+ this.prevPredicate = predicate; // predicate.length always <= 1 or null+ this.prevSelector = selector; // selector.length always <= 1+ };+ WhereSelectEnumerable.prototype = new Enumerable();++ WhereSelectEnumerable.prototype.where = function (predicate) {+ predicate = Utils.createLambda(predicate);++ return (predicate.length <= 1)+ ? new WhereEnumerable(this, predicate)+ : Enumerable.prototype.where.call(this, predicate);+ };++ WhereSelectEnumerable.prototype.select = function (selector) {+ selector = Utils.createLambda(selector);++ if (selector.length <= 1) {+ var prevSelector = this.prevSelector;+ var composedSelector = function (x) { return selector(prevSelector(x)); };+ return new WhereSelectEnumerable(this.prevSource, this.prevPredicate, composedSelector);+ }+ else {+ // if selector use index, can't compose+ return Enumerable.prototype.select.call(this, selector);+ }+ };++ WhereSelectEnumerable.prototype.getEnumerator = function () {+ var predicate = this.prevPredicate;+ var selector = this.prevSelector;+ var source = this.prevSource;+ var enumerator;++ return new IEnumerator(+ function () { enumerator = source.getEnumerator(); },+ function () {+ while (enumerator.moveNext()) {+ if (predicate == null || predicate(enumerator.current())) {+ return this.yieldReturn(selector(enumerator.current()));+ }+ }+ return false;+ },+ function () { Utils.dispose(enumerator); });+ };++ // Collections++ var Dictionary = (function () {+ // static utility methods+ var callHasOwnProperty = function (target, key) {+ return Object.prototype.hasOwnProperty.call(target, key);+ };++ var computeHashCode = function (obj) {+ if (obj === null) return "null";+ if (obj === undefined) return "undefined";++ return (typeof obj.toString === Types.Function)+ ? obj.toString()+ : Object.prototype.toString.call(obj);+ };++ // LinkedList for Dictionary+ var HashEntry = function (key, value) {+ this.key = key;+ this.value = value;+ this.prev = null;+ this.next = null;+ };++ var EntryList = function () {+ this.first = null;+ this.last = null;+ };+ EntryList.prototype =+ {+ addLast: function (entry) {+ if (this.last != null) {+ this.last.next = entry;+ entry.prev = this.last;+ this.last = entry;+ } else this.first = this.last = entry;+ },++ replace: function (entry, newEntry) {+ if (entry.prev != null) {+ entry.prev.next = newEntry;+ newEntry.prev = entry.prev;+ } else this.first = newEntry;++ if (entry.next != null) {+ entry.next.prev = newEntry;+ newEntry.next = entry.next;+ } else this.last = newEntry;++ },++ remove: function (entry) {+ if (entry.prev != null) entry.prev.next = entry.next;+ else this.first = entry.next;++ if (entry.next != null) entry.next.prev = entry.prev;+ else this.last = entry.prev;+ }+ };++ // Overload:function()+ // Overload:function(compareSelector)+ var Dictionary = function (compareSelector) {+ this.countField = 0;+ this.entryList = new EntryList();+ this.buckets = {}; // as Dictionary<string,List<object>>+ this.compareSelector = (compareSelector == null) ? Functions.Identity : compareSelector;+ };+ Dictionary.prototype =+ {+ add: function (key, value) {+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ var entry = new HashEntry(key, value);+ if (callHasOwnProperty(this.buckets, hash)) {+ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) {+ this.entryList.replace(array[i], entry);+ array[i] = entry;+ return;+ }+ }+ array.push(entry);+ } else {+ this.buckets[hash] = [entry];+ }+ this.countField++;+ this.entryList.addLast(entry);+ },++ get: function (key) {+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (!callHasOwnProperty(this.buckets, hash)) return undefined;++ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ var entry = array[i];+ if (this.compareSelector(entry.key) === compareKey) return entry.value;+ }+ return undefined;+ },++ set: function (key, value) {+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (callHasOwnProperty(this.buckets, hash)) {+ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) {+ var newEntry = new HashEntry(key, value);+ this.entryList.replace(array[i], newEntry);+ array[i] = newEntry;+ return true;+ }+ }+ }+ return false;+ },++ contains: function (key) {+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (!callHasOwnProperty(this.buckets, hash)) return false;++ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) return true;+ }+ return false;+ },++ clear: function () {+ this.countField = 0;+ this.buckets = {};+ this.entryList = new EntryList();+ },++ remove: function (key) {+ var compareKey = this.compareSelector(key);+ var hash = computeHashCode(compareKey);+ if (!callHasOwnProperty(this.buckets, hash)) return;++ var array = this.buckets[hash];+ for (var i = 0; i < array.length; i++) {+ if (this.compareSelector(array[i].key) === compareKey) {+ this.entryList.remove(array[i]);+ array.splice(i, 1);+ if (array.length == 0) delete this.buckets[hash];+ this.countField--;+ return;+ }+ }+ },++ count: function () {+ return this.countField;+ },++ toEnumerable: function () {+ var self = this;+ return new Enumerable(function () {+ var currentEntry;++ return new IEnumerator(+ function () { currentEntry = self.entryList.first; },+ function () {+ if (currentEntry != null) {+ var result = { key: currentEntry.key, value: currentEntry.value };+ currentEntry = currentEntry.next;+ return this.yieldReturn(result);+ }+ return false;+ },+ Functions.Blank);+ });+ }+ };++ return Dictionary;+ })();++ // dictionary = Dictionary<TKey, TValue[]>+ var Lookup = function (dictionary) {+ this.count = function () {+ return dictionary.count();+ };+ this.get = function (key) {+ return Enumerable.from(dictionary.get(key));+ };+ this.contains = function (key) {+ return dictionary.contains(key);+ };+ this.toEnumerable = function () {+ return dictionary.toEnumerable().select(function (kvp) {+ return new Grouping(kvp.key, kvp.value);+ });+ };+ };++ var Grouping = function (groupKey, elements) {+ this.key = function () {+ return groupKey;+ };+ ArrayEnumerable.call(this, elements);+ };+ Grouping.prototype = new ArrayEnumerable();++ // module export+ if (typeof define === Types.Function && define.amd) { // AMD+ define("linqjs", [], function () { return Enumerable; });+ }+ else if (typeof module !== Types.Undefined && module.exports) { // Node+ module.exports = Enumerable;+ }+ else {+ root.Enumerable = Enumerable;+ }+})(this);\ No newline at end of filediff --git a/data/libs/linqjs/reference.htm b/data/libs/linqjs/reference.htmnew file mode 100644index 000000000..0e5b3e2aa--- /dev/null+++ b/data/libs/linqjs/reference.htm@@ -0,0 +1,3205 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">+<html xmlns="http://www.w3.org/1999/xhtml">+<head>+ <title>linq.js Reference</title>+ <script type="text/javascript" src="linq.js"></script>+ <script type="text/javascript">+ var textStack = [];+ document.write = function() {+ Enumerable.from(arguments).forEach("textStack.push($)");+ };+ document.writeln = function () {+ Enumerable.from(arguments).forEach("textStack.push($)");+ };++ function evaluate(code) {+ textStack.length = 0;+ var value;+ try {+ eval(code + '.take(1001).writeLine()');+ value = textStack.join("");+ } catch (e) {+ textStack.length = 0;+ try {+ value = eval("(" + code + ")");+ document.write(value);+ value = textStack.join("");+ }+ catch (e2) {+ value = "error";+ }+ }+ return value;+ }++ function expand() {+ var code = (this.innerText || this.textContent);+ var value = evaluate(code);+ var p = document.createElement("p");+ p.innerHTML = value;+ this.appendChild(p);+ this.onclick = collapse;+ }++ function collapse() {+ this.removeChild(this.lastChild);+ this.onclick = expand;+ }++ function execute() {+ var value = evaluate(this.value);+ document.getElementById("codeResult").innerHTML = value;+ }++ window.onload = function() {+ Enumerable.from(document.getElementsByTagName("pre"))+ .forEach("$.onclick = expand");++ var input = document.getElementById("codeInput");+ input.onkeyup = execute;+ execute.apply(input);+ };+ </script>+ <style type="text/css">+ pre+ {+ cursor: pointer;+ }+ table+ {+ width: 100%;+ border-collapse: collapse;+ }+ td+ {+ border: solid black;+ border-width: 1px 0 1px 0;+ }+ h2+ {+ width: 100%;+ }+ </style>+</head>+<body>+ <h1>+ linq.js Reference</h1>+ <p>+ Notice:currently under working for v3.0. lack of some methods(choose, merge, defer, etc...)<br />+ <a href="http://linqjs.codeplex.com/">http://linqjs.codeplex.com/</a>+ </p>+ <h2>+ LINQ Pad</h2>+ <table>+ <tr>+ <td style="width: 50%; vertical-align: top">+ <textarea cols="10" rows="10" id="codeInput" style="width: 100%">Enumerable.range(0, 20) .where("x => x % 3 == 0") .select("$ * 2")</textarea>+ </td>+ <td style="vertical-align: top">+ <p id="codeResult" style="padding-left: 20px">+ </p>+ </td>+ </tr>+ </table>+ <h2 class="clear:both">+ Generating Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="2">+ choice+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ params T[] elements+ </td>+ <td>+ <pre>Enumerable.choice("a","b","c","d").take(10)</pre>+ <pre>Enumerable.choice(["a","b","c","d"]).take(10)</pre>+ </td>+ </tr>+ <tr>+ <td>+ Enumerable elements+ </td>+ <td>+ <pre>Enumerable.choice(Enumerable.range(1,3)).take(10)</pre>+ </td>+ </tr>+ <tr>+ <td>+ cycle+ </td>+ <td>+ Enumerable+ </td>+ <td>+ params T obj+ </td>+ <td>+ <pre>Enumerable.cycle(1,"foo",true).take(10)</pre>+ <pre>Enumerable.cycle([1,"foo",true]).take(10)</pre>+ </td>+ </tr>+ <tr>+ <td>+ empty+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.empty()</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="6">+ from+ </td>+ <td rowspan="6">+ Enumerable+ </td>+ <td>+ Array obj+ </td>+ <td>+ <pre>var arr = [1,124,"aaa",function(){},false];+Enumerable.from(arr)</pre>+ </td>+ </tr>+ <tr>+ <td>+ Object obj+ </td>+ <td>+ <pre>var obj = {a:3,b:"3",z:function(){},d:true};+Enumerable.from(obj).select("$.key + ':' + $.value")</pre>+ </td>+ </tr>+ <tr>+ <td>+ NodeList obj+ </td>+ <td>+ <pre>var node = document.getElementsByTagName("h2");+Enumerable.from(node).select("$.innerHTML")</pre>+ </td>+ </tr>+ <tr>+ <td>+ Number obj+ </td>+ <td>+ <pre>Enumerable.from(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ String obj+ </td>+ <td>+ <pre>Enumerable.from("foobar")</pre>+ </td>+ </tr>+ <tr>+ <td>+ IEnumerable(WSH) obj+ </td>+ <td>+ <pre>+// using with Windows Script Host+// var fso = WScript.CreateObject("Scripting.FileSystemObject");+// var files = fso.GetFolder("C:\\").Files;+// Enumerable.from(files).select("$.Name").forEach("WScript.Echo($)");</pre>+ </td>+ </tr>+ <tr>+ <td>+ make+ </td>+ <td>+ Enumerable+ </td>+ <td>+ T element+ </td>+ <td>+ <pre>Enumerable.make("foobar")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ matches+ </td>+ <td rowspan="3">+ Enumerable+ </td>+ <td>+ string input, RegExp pattern+ </td>+ <td>+ <pre>Enumerable.matches("xbcyBCzbc", /(.)bc/i)+.select("'index='+$.index+' all='+$[0]+' capture='+$[1]")</pre>+ </td>+ </tr>+ <tr>+ <td>+ string input, string pattern+ </td>+ <td>+ <pre>Enumerable.matches("xbcyBCzbc", "(.)bc")+.select("'index='+$.index+' all='+$[0]+' capture='+$[1]")</pre>+ </td>+ </tr>+ <tr>+ <td>+ string input, string pattern, string flags+ </td>+ <td>+ <pre>Enumerable.matches("xbcyBCzbc", "(.)bc", "i")+.select("'index='+$.index+' all='+$[0]+' capture='+$[1]")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ range+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ int start, int count+ </td>+ <td>+ <pre>Enumerable.range(10,5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ int start, int count, int step+ </td>+ <td>+ <pre>Enumerable.range(10,5,3)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ rangeDown+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ int start, int count+ </td>+ <td>+ <pre>Enumerable.rangeDown(10,5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ int start, int count, int step+ </td>+ <td>+ <pre>Enumerable.rangeDown(10,5,3)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ rangeTo+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ int start, int to+ </td>+ <td>+ <pre>Enumerable.rangeTo(10,18)</pre>+ <pre>Enumerable.rangeTo(3,-5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ int start, int to, int step+ </td>+ <td>+ <pre>Enumerable.rangeTo(1,9,3)</pre>+ <pre>Enumerable.rangeTo(1,-9,3)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ repeat+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T obj+ </td>+ <td>+ <pre>Enumerable.repeat(3).take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T obj, int count+ </td>+ <td>+ <pre>Enumerable.repeat("foo",10)</pre>+ </td>+ </tr>+ <tr>+ <td>+ repeatWithFinalize+ </td>+ <td>+ Enumerable+ </td>+ <td>+ T initializer(), void finalizer(T)+ </td>+ <td>+ <pre>// example for WScript(Text EnumerateLines and Finally Close)+// var fso = WScript.CreateObject("Scripting.FileSystemObject");+// Enumerable.repeatWithFinalize(+// function () { return fso.OpenTextFile("C:\\file.txt") },+// function (ts) { ts.Close() })+// .takeWhile(function (ts) { return !ts.AtEndOfStream })+// .select(function (ts) { return ts.ReadLine() });+</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ generate+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T func()+ </td>+ <td>+ <pre>Enumerable.generate("Math.random()").take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T func(), int count+ </td>+ <td>+ <pre>Enumerable.generate("Math.random()", 5)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ toInfinity+ </td>+ <td rowspan="3">+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.toInfinity().take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ int start+ </td>+ <td>+ <pre>Enumerable.toInfinity(1000).take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ int start, int step+ </td>+ <td>+ <pre>Enumerable.toInfinity(1000,5).take(5)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ toNegativeInfinity+ </td>+ <td rowspan="3">+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.toNegativeInfinity().take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ int start+ </td>+ <td>+ <pre>Enumerable.toNegativeInfinity(1000).take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ int start, int step+ </td>+ <td>+ <pre>Enumerable.toNegativeInfinity(1000,5).take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ unfold+ </td>+ <td>+ Enumerable+ </td>+ <td>+ T seed, T func(T)+ </td>+ <td>+ <pre>Enumerable.unfold(5, "$+3").take(10)</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Projection and Filtering Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="3">+ traverseBreadthFirst+ </td>+ <td rowspan="3">+ Enumerable+ </td>+ <td>+ T[] func(T)+ </td>+ <td>+ <pre>Enumerable.make(1).traverseBreadthFirst("$+$").take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] func(T), T resultSelector(T)+ </td>+ <td>+ <pre>Enumerable.make(1).traverseBreadthFirst("$+$","$*$").take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] func(T), T resultSelector(T, int)+ </td>+ <td>+ <pre>Enumerable.make(document.body)+.traverseBreadthFirst("$.childNodes", "v,n=>{value:v,nestLevel:n}")+.where("$.nestLevel<3 && $.value.nodeType == 1")+.select("$.nestLevel + ':' + $.value.tagName")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ traverseDepthFirst+ </td>+ <td rowspan="3">+ Enumerable+ </td>+ <td>+ T[] func(T)+ </td>+ <td>+ <pre>Enumerable.make(1).traverseDepthFirst("$+$").take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] func(T), T resultSelector(T)+ </td>+ <td>+ <pre>Enumerable.make(1).traverseDepthFirst("$+$","$*$").take(5)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] func(T), T resultSelector(T, int)+ </td>+ <td>+ <pre>Enumerable.make(document.body)+.traverseDepthFirst("$.childNodes", "v,n=>{value:v,nestLevel:n}")+.where("$.nestLevel<3 && $.value.nodeType == 1")+.select("$.nestLevel + ':' + $.value.tagName")</pre>+ </td>+ </tr>+ <tr>+ <td>+ flatten+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>var array = [1,[234,2,[62,3]],[234,5],3];+Enumerable.from(array).flatten()</pre>+ </td>+ </tr>+ <tr>+ <td>+ pairwise+ </td>+ <td>+ Enumerable+ </td>+ <td>+ T selector(T, T)+ </td>+ <td>+ <pre>Enumerable.range(1,10)+.pairwise("prev,next=>prev + ':' + next")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ scan+ </td>+ <td rowspan="3">+ Enumerable+ </td>+ <td>+ T func(T, T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).scan("a,b=>a+b")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T seed, T func(T, T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).scan(100,"a,b=>a+b")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T seed, T func(T, T), T resultSelector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).scan(100,"a,b=>a+b","$*10")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ select+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T selector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).select("$*10")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T selector(T, int)+ </td>+ <td>+ <pre>Enumerable.rangeDown(10,10).select("value,index=>index + ':' + value")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="4">+ selectMany+ </td>+ <td rowspan="4">+ Enumerable+ </td>+ <td>+ T[] collectionSelector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,3).selectMany("Enumerable.repeat($,3)")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] collectionSelector(T, int)+ </td>+ <td>+ <pre>Enumerable.range(5,5)+.selectMany("value,index=>Enumerable.repeat('str'+value,index+1)")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] collectionSelector(T), resultSelector(T, T)+ </td>+ <td>+ <pre>Enumerable.range(1,3)+.selectMany("Enumerable.repeat($,3)","first,middle=>first + ':' + middle*10")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] collectionSelector(T, int), resultSelector(T, T)+ </td>+ <td>+ <pre>Enumerable.range(5,5)+.selectMany("v,i=>Enumerable.repeat('str'+v,i+1)","f,m=>f + ':' + m")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ where+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).where("$%2==0")</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T, int)+ </td>+ <td>+ <pre>Enumerable.range(1,10).where("value,index=>value*index>10")</pre>+ </td>+ </tr>+ <tr>+ <td>+ ofType+ </td>+ <td>+ Enumerable+ </td>+ <td>+ Class type+ </td>+ <td>+ <pre>Enumerable.from([1,"a",2,"b","c",3]).ofType(Number)</pre>+ <pre>Enumerable.from([1,"a",2,"b","c",3]).ofType(String)</pre>+ <pre>function ClassA(v){this.v = v}+Enumerable.from([new ClassA("a"),1,2,new ClassA("b")])+ .ofType(ClassA).select("$.v")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ zip+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T[] second,T selector(T, T)+ </td>+ <td>+ <pre>Enumerable.rangeDown(10,10)+.zip(Enumerable.range(1,10),"outer,inner=>outer + ':' + inner")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] second,T selector(T, T, int)+ </td>+ <td>+ <pre>Enumerable.rangeDown(10,10)+.zip(Enumerable.range(1,10),"outer,inner,index=>index + ':' + outer*inner")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Join Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="2">+ join+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T[] inner, T outerKeySelector(T), T innerKeySelector(T), T resultSelector(T, T)+ </td>+ <td>+ <pre>var array1 = [13,413,5,135,61,631,13,61,3];+var array2 = [13,134,53,6,3,7,13,7,7,135,61,3,13];+Enumerable.from(array1)+.join(array2,"","","outer,inner=>outer + ':' + inner")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] inner, T outerKeySelector(T), T innerKeySelector(T), T resultSelector(T, T),+ T compareSelector(T)+ </td>+ <td>+ <pre>var array1 = [10,405,50,135];+var array2 = [1,4,7,8];+Enumerable.from(array1)+.join(array2,"","","outer,inner=>outer + ':' + inner","$%2==0")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ groupJoin+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T[] inner, T outerKeySelector(T), T innerKeySelector(T), T resultSelector(T, Enumerable)+ </td>+ <td>+ <pre>var array1 = [13,413,5,135,61,631,13,61,3];+var array2 = [13,134,53,6,3,7,13,7,7,135,61,3,13];+Enumerable.from(array1)+.groupJoin(array2,"","","outer,lookup=>outer + ':' + lookup.toJoinedString('-')")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] inner, T outerKeySelector(T), T innerKeySelector(T), T resultSelector(T, Enumerable),+ T compareSelector(T)+ </td>+ <td>+ <pre>var array1 = [10,405,50,135];+var array2 = [1,4,7,8];+Enumerable.from(array1)+.groupJoin(array2,"","","outer,lookup=>outer + ':' + lookup.toJoinedString('-')","$%2==0")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Set Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ all+ </td>+ <td>+ Boolean+ </td>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).all("$<5")</pre>+ <pre>Enumerable.range(1,10).all("$<15")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ any+ </td>+ <td rowspan="2">+ Boolean+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,0).any()</pre>+ <pre>Enumerable.range(1,10).any()</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).any("$==5")</pre>+ <pre>Enumerable.range(1,10).any("$==15")</pre>+ </td>+ </tr>+ <tr>+ <td>+ concat+ </td>+ <td>+ Enumerable+ </td>+ <td>+ T[] second+ </td>+ <td>+ <pre>Enumerable.range(1,5).concat(Enumerable.repeat("foo",5))</pre>+ </td>+ </tr>+ <tr>+ <td>+ insert+ </td>+ <td>+ Enumerable+ </td>+ <td>+ int index, T[] second+ </td>+ <td>+ <pre>Enumerable.range(1,5).insert(3,Enumerable.repeat("foo",5))</pre>+ </td>+ </tr>+ <tr>+ <td>+ alternate+ </td>+ <td>+ Enumerable+ </td>+ <td>+ T value+ </td>+ <td>+ <pre>Enumerable.range(1,5).alternate(-1)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ contains+ </td>+ <td rowspan="2">+ Boolean+ </td>+ <td>+ T value+ </td>+ <td>+ <pre>Enumerable.range(1,5).contains(3)</pre>+ <pre>Enumerable.range(1,5).contains(10)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T value, T compareSelector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,5).Select("{test:$}").contains(3)</pre>+ <pre>Enumerable.range(1,5).Select("{test:$}").contains(3,"$.test")</pre>+ </td>+ </tr>+ <tr>+ <td>+ defaultIfEmpty+ </td>+ <td>+ Enumerable+ </td>+ <td>+ T defaultValue+ </td>+ <td>+ <pre>Enumerable.range(1,5).defaultIfEmpty("default")</pre>+ <pre>Enumerable.range(1,0).defaultIfEmpty("default")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ distinct+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>var array = [1,412,5,3,5,412,7];+Enumerable.from(array).distinct()</pre>+ </td>+ </tr>+ <tr>+ <td>+ T compareSelector(T)+ </td>+ <td>+ <pre>var seq = Enumerable.range(1,10).Select("{test:$%3}");+seq.distinct("$.test").select("$.test")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ except+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T[] second+ </td>+ <td>+ <pre>var array1 = [1,412,5,3,5,412,7];+var array2 = [20,12,5,5,7,310];+Enumerable.from(array1).except(array2)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] second, T compareSelector(T)+ </td>+ <td>+ <pre>var seq1 = Enumerable.range(1,10).select("{test:$%5}");+var seq2 = Enumerable.range(1,10).select("{test:$%2}");+seq1.except(seq2,"$.test").select("$.test")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ intersect+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T[] second+ </td>+ <td>+ <pre>var array1 = [1,412,5,3,5,412,7];+var array2 = [20,12,5,5,7,310];+Enumerable.from(array1).intersect(array2)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] second, T compareSelector(T)+ </td>+ <td>+ <pre>var seq1 = Enumerable.range(1,10).select("{test:$%5}");+var seq2 = Enumerable.range(1,10).select("{test:$%2}");+seq1.intersect(seq2,"$.test").select("$.test")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ sequenceEqual+ </td>+ <td rowspan="2">+ Boolean+ </td>+ <td>+ T[] second+ </td>+ <td>+ <pre>Enumerable.range(1,5).sequenceEqual(Enumerable.range(1,5))</pre>+ <pre>Enumerable.range(1,5).sequenceEqual(Enumerable.range(1,6))</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] second, T compareSelector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).select("{test:$%5}")+.sequenceEqual(Enumerable.range(1,10).select("{test:$%5}"),"$.test")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ union+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T[] second+ </td>+ <td>+ <pre>var array1 = [1,412,5,3,5,412,7];+var array2 = [20,12,5,5,7,310];+Enumerable.from(array1).union(array2)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T[] second, T compareSelector(T)+ </td>+ <td>+ <pre>var seq1 = Enumerable.range(1,5).select("{test:$}");+var seq2 = Enumerable.range(3,7).select("{test:$}");+seq1.union(seq2,"$.test").select("$.test")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Ordering Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="2">+ orderBy+ </td>+ <td rowspan="2">+ OrderedEnumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>+var array = [1,51,61,75,8,35,43];+Enumerable.from(array).orderBy()</pre>+ </td>+ </tr>+ <tr>+ <td>+ T keySelector(T)+ </td>+ <td>+ <pre>+var array = [{a:"a"},{a:"z"},{a:"k"},{a:"l"},{a:"m"},{a:"c"}];+Enumerable.from(array).orderBy("$.a").select("$.a")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ orderByDescending+ </td>+ <td rowspan="2">+ OrderedEnumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>+var array = [1,51,61,75,8,35,43];+Enumerable.from(array).orderByDescending()</pre>+ </td>+ </tr>+ <tr>+ <td>+ T keySelector(T)+ </td>+ <td>+ <pre>+var array = [{a:"a"},{a:"z"},{a:"k"},{a:"l"},{a:"m"},{a:"c"}];+Enumerable.from(array).orderByDescending("$.a").select("$.a")</pre>+ </td>+ </tr>+ <tr>+ <td>+ thenBy+ </td>+ <td>+ OrderedEnumerable+ </td>+ <td>+ T keySelector(T)+ </td>+ <td>+ <pre>+var list = [+ { a: 2, b: 4, c: 1 },+ { a: 2, b: 3, c: 7 },+ { a: 2, b: 3, c: 3 },+ { a: 4, b: 7, c: 5 },+ { a: 7, b: 3, c: 2 },+ { a: 4, b: 1, c: 5 }];+Enumerable.from(list).orderBy("$.a").thenBy("$.c").thenBy("$.b")+.select("$.a + ':' + $.b + ':' + $.c")</pre>+ </td>+ </tr>+ <tr>+ <td>+ thenByDescending+ </td>+ <td>+ OrderedEnumerable+ </td>+ <td>+ T keySelector(T)+ </td>+ <td>+ <pre>+var list = [+ { a: 2, b: 4, c: 1 },+ { a: 2, b: 3, c: 7 },+ { a: 2, b: 3, c: 3 },+ { a: 4, b: 7, c: 5 },+ { a: 7, b: 3, c: 2 },+ { a: 4, b: 1, c: 5 }];+Enumerable.from(list).orderBy("$.a").thenByDescending("$.c").thenByDescending("$.b")+.select("$.a + ':' + $.b + ':' + $.c")</pre>+ </td>+ </tr>+ <tr>+ <td>+ reverse+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).reverse()</pre>+ </td>+ </tr>+ <tr>+ <td>+ shuffle+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).shuffle()</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Grouping Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="4">+ groupBy+ </td>+ <td rowspan="2">+ Enumerable<Grouping>+ </td>+ <td>+ T keySelector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,5).groupBy("$%2==0")+.select("$.key() + ':' + $.toJoinedString('-')")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T keySelector(T), T elementSelector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,5).groupBy("$%2==0","$*10")+.select("$.key() + ':' + $.toJoinedString('-')")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T keySelector(T), T elementSelector(T), T resultSelector(T, Enumerable)+ </td>+ <td>+ <pre>Enumerable.range(1,5)+.groupBy("$%2==0","","key,e=>key+':'+e.toJoinedString('-')")</pre>+ </td>+ </tr>+ <tr>+ <td>+ TK keySelector(T), TE elementSelector(T), TR resultSelector(T, Enumerable),TC compareSelector(TK)+ </td>+ <td>+ <pre>Enumerable.from([{d:new Date(2000,1,1),i:0},{d:new Date(2000,1,1),i:1}])+.groupBy("$.d","","key,e=>key+':'+e.Select('$.i').toArray()","$.toString()")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="4">+ partitionBy+ </td>+ <td rowspan="2">+ Enumerable<Grouping>+ </td>+ <td>+ T keySelector(T)+ </td>+ <td>+ <pre>Enumerable.from([1,2,2,3,3,2,1,1]).partitionBy("i=>i")+.select("$.key() + ':' + $.toJoinedString('-')")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T keySelector(T), T elementSelector(T)+ </td>+ <td>+ <pre>Enumerable.from([1,2,2,3,3,2,1,1]).partitionBy("i=>i","i=>i*100")+.select("$.key() + ':' + $.toJoinedString('-')")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ T keySelector(T), T elementSelector(T), T resultSelector(T, Enumerable)+ </td>+ <td>+ <pre>Enumerable.from([1,2,2,3,3,2,1,1])+.partitionBy("i=>i","i=>i","key,e=>key+':'+e.toJoinedString('-')")</pre>+ </td>+ </tr>+ <tr>+ <td>+ TK keySelector(T), TE elementSelector(T), TR resultSelector(T, Enumerable), TC compareSelector(TK)+ </td>+ <td>+ <pre>Enumerable.from([{d:new Date(2000,1,1),i:0},{d:new Date(2000,1,1),i:1}])+.partitionBy("$.d","","key,e=>key+':'+e.Select('$.i').toArray()","$.toString()")</pre>+ </td>+ </tr>+ <tr>+ <td>+ buffer+ </td>+ <td>+ Enumerable<Array>+ </td>+ <td>+ int count+ </td>+ <td>+ <pre>Enumerable.range(1,10).buffer(4)</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Aggregate Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="3">+ aggregate+ </td>+ <td rowspan="3">+ T+ </td>+ <td>+ T func(T, T)+ </td>+ <td>+ <pre>Enumerable.range(1,5).aggregate("a,b=>a*b")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T seed, T func(T, T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).aggregate(100,"a,b=>a+b")</pre>+ </td>+ </tr>+ <tr>+ <td>+ T seed, T func(T, T), T resultSelector(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).aggregate(100,"a,b=>a+b","$*10")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ average+ </td>+ <td rowspan="2">+ Number+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).average()</pre>+ </td>+ </tr>+ <tr>+ <td>+ Number selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:5},{a:"bar",b:20},{a:"foobar",b:10}])+.average("$.b")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ count+ </td>+ <td rowspan="2">+ Number+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).count()</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).count("$>7")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ max+ </td>+ <td rowspan="2">+ Number+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).max()</pre>+ </td>+ </tr>+ <tr>+ <td>+ Number selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:5},{a:"bar",b:20},{a:"foobar",b:10}])+.max("$.b")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ min+ </td>+ <td rowspan="2">+ Number+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).min()</pre>+ </td>+ </tr>+ <tr>+ <td>+ Number selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:5},{a:"bar",b:20},{a:"foobar",b:10}])+.min("$.b")</pre>+ </td>+ </tr>+ <tr>+ <td>+ maxBy+ </td>+ <td>+ T+ </td>+ <td>+ Number selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:5},{a:"bar",b:20},{a:"foobar",b:10}])+.maxBy("$.b").a</pre>+ </td>+ </tr>+ <tr>+ <td>+ minBy+ </td>+ <td>+ T+ </td>+ <td>+ Number selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:5},{a:"bar",b:20},{a:"foobar",b:10}])+.minBy("$.b").a</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ sum+ </td>+ <td rowspan="2">+ Number+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).sum()</pre>+ </td>+ </tr>+ <tr>+ <td>+ Number selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:5},{a:"bar",b:20},{a:"foobar",b:10}])+.sum("$.b")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Paging Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ elementAt+ </td>+ <td>+ T+ </td>+ <td>+ int index+ </td>+ <td>+ <pre>Enumerable.range(1,10).elementAt(3)</pre>+ </td>+ </tr>+ <tr>+ <td>+ elementAtOrDefault+ </td>+ <td>+ T+ </td>+ <td>+ int index, T defaultValue+ </td>+ <td>+ <pre>Enumerable.range(1,10).elementAtOrDefault(15,-1)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ first+ </td>+ <td rowspan="2">+ T+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).first()</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).first("$>4")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ firstOrDefault+ </td>+ <td rowspan="2">+ T+ </td>+ <td>+ T defaultValue+ </td>+ <td>+ <pre>Enumerable.empty().firstOrDefault(-1)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T defaultValue, bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).firstOrDefault(-1,"$>15")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ last+ </td>+ <td rowspan="2">+ T+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).last()</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).last("$<4")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ lastOrDefault+ </td>+ <td rowspan="2">+ T+ </td>+ <td>+ T defaultValue+ </td>+ <td>+ <pre>Enumerable.empty().lastOrDefault(-1)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T defaultValue, bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).lastOrDefault(-1,"$>15")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ single+ </td>+ <td rowspan="2">+ T+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.from("a").single()</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).single("$==4")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ singleOrDefault+ </td>+ <td rowspan="2">+ T+ </td>+ <td>+ T defaultValue+ </td>+ <td>+ <pre>Enumerable.empty().singleOrDefault(-1)</pre>+ </td>+ </tr>+ <tr>+ <td>+ T defaultValue, bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).singleOrDefault(-1,"$==15")</pre>+ </td>+ </tr>+ <tr>+ <td>+ skip+ </td>+ <td>+ Enumerable+ </td>+ <td>+ int count+ </td>+ <td>+ <pre>Enumerable.range(1,10).skip(5)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ skipWhile+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).skipWhile("$<=5")</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T, int index)+ </td>+ <td>+ <pre>Enumerable.range(1,10).skipWhile("value,index=>value+index<=5")</pre>+ </td>+ </tr>+ <tr>+ <td>+ take+ </td>+ <td>+ Enumerable+ </td>+ <td>+ int count+ </td>+ <td>+ <pre>Enumerable.range(1,10).take(5)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ takeWhile+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ bool predicate(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).takeWhile("$<=5")</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool predicate(T, int index)+ </td>+ <td>+ <pre>Enumerable.range(1,10).takeWhile("value,index=>value+index<=5")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ takeExceptLast+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).takeExceptLast()</pre>+ </td>+ </tr>+ <tr>+ <td>+ Number count+ </td>+ <td>+ <pre>Enumerable.range(1,10).takeExceptLast(3)</pre>+ </td>+ </tr>+ <tr>+ <td>+ takeFromLast+ </td>+ <td>+ Enumerable+ </td>+ <td>+ Number count+ </td>+ <td>+ <pre>Enumerable.range(1,10).takeFromLast(3)</pre>+ </td>+ </tr>+ <tr>+ <td>+ indexOf+ </td>+ <td>+ int+ </td>+ <td>+ T item+ </td>+ <td>+ <pre>Enumerable.range(1,10).indexOf(3)</pre>+ <pre>Enumerable.range(1,10).indexOf(15)</pre>+ </td>+ </tr>+ <tr>+ <td>+ lastIndexOf+ </td>+ <td>+ int+ </td>+ <td>+ T item+ </td>+ <td>+ <pre>Enumerable.from([1,2,3,2,5]).lastIndexOf(2)</pre>+ <pre>Enumerable.from([1,2,3,2,5]).lastIndexOf(20)</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Convert Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ toArray+ </td>+ <td>+ Array+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).toArray()</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ toLookup+ </td>+ <td rowspan="3">+ Lookup+ </td>+ <td>+ TKey keySelector(T)+ </td>+ <td>+ <pre>var lookup = Enumerable.from(["temp.xls", "temp.pdf", "temp.jpg", "temp2.pdf"])+.toLookup("$.match(/\\.(.+$)/)[1]");+lookup.toEnumerable().select("$.key() + ' : ' + $.toArray()")</pre>+ </td>+ </tr>+ <tr>+ <td>+ TKey keySelector(T), TElement elementSelector(T)+ </td>+ <td>+ <pre>var lookup = Enumerable.from(["temp.xls", "temp.pdf", "temp.jpg", "temp2.pdf"])+.toLookup("$.match(/\\.(.+$)/)[1]","$.match(/(.+)\\.[^.]+$/)[1]");+lookup.toEnumerable().select("$.key() + ' : ' + $.toArray()")</pre>+ </td>+ </tr>+ <tr>+ <td>+ TKey keySelector(T), TElement elementSelector(T), TCompare compareSelector(TKey)+ </td>+ <td>+ <pre>var lookup = Enumerable.from(["temp.xls", "temp.pdf", "temp.jpg", "temp2.pdf"])+.toLookup("","","$.match(/\\.(.+$)/)[1]");+lookup.toEnumerable().select("$.key() + ' : ' + $.toArray()")</pre>+ </td>+ </tr>+ <tr>+ <td>+ toObject+ </td>+ <td>+ Object+ </td>+ <td>+ String keySelector(T), T elementSelector(T)+ </td>+ <td>+ <pre>var obj = Enumerable.range(1,10).select("value,index=>{id:'id_' + index,value:value}")+.toObject("$.id","$.value");+Enumerable.from(obj).select("$.key + ':' + $.value")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ toDictionary+ </td>+ <td rowspan="2">+ Dictionary+ </td>+ <td>+ TKey keySelector(T), TElement elementSelector(T)+ </td>+ <td>+ <pre>var dict = Enumerable.range(1,10).select("value,index=>{id:'id_' + index,value:value}")+.toDictionary("$.id","$.value");+dict.toEnumerable().select("$.key + ':' + $.value")</pre>+ </td>+ </tr>+ <tr>+ <td>+ TKey keySelector(T), TElement elementSelector(T), TCompare compareSelector(TKey)+ </td>+ <td>+ <pre>var dict = Enumerable.range(1,10).select("value,index=>{id:'id_' + index,value:value}")+.toDictionary("$","$.value","$;id");+dict.toEnumerable().select("$.key.id + ':' + $.value")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ toJSONString+ </td>+ <td rowspan="3">+ String+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>// toJSONString only work Native JSON support browser or include json2.js+Enumerable.from([{Foo:1, Bar:'z'},{Foo:5, Bar:null}]).toJSONString()</pre>+ </td>+ </tr>+ <tr>+ <td>+ TResult replacer(TKey, TValue)+ </td>+ <td>+ <pre>Enumerable.from(["a","b","c"])+.toJSONString(function(k,v){return (typeof v === 'object') ? v : v.toString().toUpperCase()})</pre>+ </td>+ </tr>+ <tr>+ <td>+ TResult replacer(TKey, TValue), Number space+ </td>+ <td>+ <pre>Enumerable.range(1, 5).toJSONString(null, 4)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ toJoinedString+ </td>+ <td rowspan="3">+ String+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(0,10).toJoinedString()</pre>+ </td>+ </tr>+ <tr>+ <td>+ String separator+ </td>+ <td>+ <pre>Enumerable.range(0,10).toJoinedString("-")</pre>+ </td>+ </tr>+ <tr>+ <td>+ String separator, T selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{k:"foo"},{k:"bar"}]).toJoinedString("-","$.k")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Action Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="2">+ doAction+ </td>+ <td rowspan="2">+ Enumerable+ </td>+ <td>+ void action(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).doAction(function(i){+ document.write('do:'+ i +'|');})+ .where("$%2==0")</pre>+ </td>+ </tr>+ <tr>+ <td>+ void action(T, index)+ </td>+ <td>+ <pre>Enumerable.range(1,10).doAction(function(value,index){+ document.write("do:" + index + '-' + value + "<br/>");})+.orderBy("").take(2)</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="4">+ forEach+ </td>+ <td rowspan="4">+ void+ </td>+ <td>+ void action(T)+ </td>+ <td>+ <pre>Enumerable.range(1,10).forEach(function(i){+ document.write(i);})</pre>+ </td>+ </tr>+ <tr>+ <td>+ void action(T, index)+ </td>+ <td>+ <pre>Enumerable.range(1,10).forEach(function(value,index){+ document.write(index + ':' + value + "<br/>");})</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool func(T)+ </td>+ <td>+ <pre>Enumerable.range(1, 10).forEach(function(i)+{+ if (i % 2 == 0) return; // continue+ if (i > 6) return false; // break+ document.write(i + "<br/>");+})</pre>+ </td>+ </tr>+ <tr>+ <td>+ bool func(T, index)+ </td>+ <td>+ <pre>Enumerable.repeat("aaa", 10).forEach(function(s,index)+{+ if (index % 2 == 0) return; // continue+ if (index > 6) return false; // break+ document.write(index + s + "<br/>");+})</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ write+ </td>+ <td rowspan="3">+ void+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).write()</pre>+ </td>+ </tr>+ <tr>+ <td>+ String separator+ </td>+ <td>+ <pre>Enumerable.range(1,10).write("-")</pre>+ </td>+ </tr>+ <tr>+ <td>+ String separator, T selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:1},{a:"bar",b:3}])+.write("-","$.a + ':' + $.b")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ writeLine+ </td>+ <td rowspan="2">+ void+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).writeLine()</pre>+ </td>+ </tr>+ <tr>+ <td>+ T selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:1},{a:"bar",b:3}])+.writeLine("$.a + ':' + $.b")</pre>+ </td>+ </tr>+ <tr>+ <td>+ force+ </td>+ <td>+ void+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).trace().force()</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Functional Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ letBind+ </td>+ <td>+ Enumerable+ </td>+ <td>+ Enumerable<TR> func(Enumerable<T>)+ </td>+ <td>+ <pre>Enumerable.range(1,10).letBind(function(x){return x.zip(x.skip(1),"x,y=>x + ':' + y")})</pre>+ </td>+ </tr>+ <tr>+ <td>+ share+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>var share = Enumerable.range(1,10).share();+share.take(4).writeLine();+document.write("--- <br>");+share.skip(2)</pre>+ </td>+ </tr>+ <tr>+ <td>+ memoize+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>var mem = Enumerable.range(1,10)+.doAction("document.write('--->' + $ + '<br>')").memoize();+mem.where("$%2==0").writeLine();+document.write("--- <br>");+mem.where("$%2==0")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Error Handling Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ catchError+ </td>+ <td>+ Enumerable+ </td>+ <td>+ void handler(Error)+ </td>+ <td>+ <pre>Enumerable.range(1,10).select(function(i){+ if(i == 5) throw new Error("enumerable_error"); else return i;})+.catchError("document.write($.message)")</pre>+ </td>+ </tr>+ <tr>+ <td>+ finallyAction+ </td>+ <td>+ Enumerable+ </td>+ <td>+ void finallyAction()+ </td>+ <td>+ <pre>Enumerable.range(1,5).finallyAction(function(){document.write("finally")})</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ For Debug Methods</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="3">+ trace+ </td>+ <td rowspan="3">+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>// trace is output to console.log+Enumerable.range(1,10).trace().force()</pre>+ </td>+ </tr>+ <tr>+ <td>+ String message+ </td>+ <td>+ <pre>Enumerable.range(1,10).trace("Gen").where("$%3==0").trace("Filtered").force()</pre>+ </td>+ </tr>+ <tr>+ <td>+ String message, T selector(T)+ </td>+ <td>+ <pre>Enumerable.from([{a:"foo",b:1},{a:"bar",b:3}])+.trace("Gen","$.a").force()</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ DisposableEnumerable(inherit Eunmerable)</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ dispose+ </td>+ <td>+ void+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).share().dispose()</pre>+ </td>+ </tr>+ <tr>+ <td>+ All Enumerable Methods+ </td>+ <td>+ -+ </td>+ <td>+ -+ </td>+ <td>+ <pre>-</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Grouping(inherit Eunmerable)</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ <tr>+ <td>+ key+ </td>+ <td>+ TKey+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.from([{id:"foo",x:10},{id:"bar",x:20},{id:"foo",x:100}])+.groupBy("$.id").toArray()[0] // grouping+.key()</pre>+ </td>+ </tr>+ <tr>+ <td>+ All Enumerable Methods+ </td>+ <td>+ -+ </td>+ <td>+ -+ </td>+ <td>+ <pre>-</pre>+ </td>+ </tr>+ </thead>+ </table>+ <h2>+ Utils</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="3">+ createLambda+ </td>+ <td rowspan="3">+ Function+ </td>+ <td>+ null/undefined+ </td>+ <td>+ <pre>Enumerable.Utils.createLambda()</pre>+ </td>+ </tr>+ <tr>+ <td>+ Function expression+ </td>+ <td>+ <pre>Enumerable.Utils.createLambda(function(x){ return x % 2 == 0})</pre>+ </td>+ </tr>+ <tr>+ <td>+ string expression+ </td>+ <td>+ <pre>Enumerable.Utils.createLambda("")</pre>+ <pre>Enumerable.Utils.createLambda("x, y => x + y")</pre>+ <pre>Enumerable.Utils.createLambda("$ * $$ * $$$")</pre>+ </td>+ </tr>+ <tr>+ <td>+ createEnumerable+ </td>+ <td>+ Enumerable+ </td>+ <td>+ Func<IEnumerator> getEnumerator+ </td>+ <td>+ <pre>Enumerable.Utils.createEnumerable(function(){ return Enumerable.Utils.createEnumerator(); })</pre>+ </td>+ </tr>+ <tr>+ <td>+ createEnumerator+ </td>+ <td>+ Enumerable+ </td>+ <td>+ Action initialize, Action tryGetNext, Action dispose+ </td>+ <td>+ <pre>var enumerator;+Enumerable.Utils.createEnumerator(+ function(){ enumerator = Enumerable.range(1,10).getEnumerator(); },+ // tryGetNext's "this" is yielder, it have yieldReturn and yieldBreak+ function(){ return (enumerator.moveNext())+ ? this.yieldReturn(enumerator.current())+ : this.yieldBreak();},+ function(){ enumerator.dispose(); })</pre>+ </td>+ </tr>+ <tr>+ <td>+ extendTo+ </td>+ <td>+ void+ </td>+ <td>+ Constructor type+ </td>+ <td>+ <pre>Enumerable.Utils.extendTo(Array)</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ IEnumerator</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ getEnumerator+ </td>+ <td>+ IEnumerator+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).getEnumerator()</pre>+ </td>+ </tr>+ <tr>+ <td>+ moveNext+ </td>+ <td>+ Boolean+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).getEnumerator().moveNext()</pre>+ </td>+ </tr>+ <tr>+ <td>+ current+ </td>+ <td>+ T+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).getEnumerator().current()</pre>+ </td>+ </tr>+ <tr>+ <td>+ dispose+ </td>+ <td>+ void+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,10).getEnumerator().dispose()</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Dictionary</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ add+ </td>+ <td>+ void+ </td>+ <td>+ TKey key, TValue value+ </td>+ <td>+ <pre>Enumerable.empty().toDictionary().add(1, 'aaa')</pre>+ </td>+ </tr>+ <tr>+ <td>+ get+ </td>+ <td>+ TValue+ </td>+ <td>+ TKey key+ </td>+ <td>+ <pre>Enumerable.empty().toDictionary().get(1)</pre>+ </td>+ </tr>+ <tr>+ <td>+ set+ </td>+ <td>+ Boolean+ </td>+ <td>+ TKey key, TValue value+ </td>+ <td>+ <pre>Enumerable.empty().toDictionary().set(1, 'zzz')</pre>+ </td>+ </tr>+ <tr>+ <td>+ contains+ </td>+ <td>+ Boolean+ </td>+ <td>+ TKey key+ </td>+ <td>+ <pre>Enumerable.empty().toDictionary().contains(1)</pre>+ </td>+ </tr>+ <tr>+ <td>+ clear+ </td>+ <td>+ void+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.empty().toDictionary().clear()</pre>+ </td>+ </tr>+ <tr>+ <td>+ remove+ </td>+ <td>+ void+ </td>+ <td>+ TKey key+ </td>+ <td>+ <pre>Enumerable.empty().toDictionary().remove(1)</pre>+ </td>+ </tr>+ <tr>+ <td>+ count+ </td>+ <td>+ Number+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.empty().toDictionary().count()</pre>+ </td>+ </tr>+ <tr>+ <td>+ toEnumerable+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>var dict = Enumerable.empty().toDictionary();+dict.add("foo", 10); dict.add("bar", 200);+dict.toEnumerable().select("$.key + ':' + $.value")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ Lookup</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ get+ </td>+ <td>+ Enumerable<TElement>+ </td>+ <td>+ TKey key+ </td>+ <td>+ <pre>Enumerable.from([{x:1,s:'a'},{x:1,s:'z'}])+.toLookup("$.x").get(1).select("$.x + ':' + $.s")</pre>+ </td>+ </tr>+ <tr>+ <td>+ contains+ </td>+ <td>+ Boolean+ </td>+ <td>+ TKey key+ </td>+ <td>+ <pre>Enumerable.from([{x:1,s:'a'},{x:1,s:'z'}])+.toLookup("$.x").contains(1)</pre>+ </td>+ </tr>+ <tr>+ <td>+ count+ </td>+ <td>+ Number+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.range(1,5).toLookup().count()</pre>+ </td>+ </tr>+ <tr>+ <td>+ toEnumerable+ </td>+ <td>+ Enumerable<Grouping>+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>Enumerable.from([{a:1,s:'foo'},{a:1,s:'bar'},{a:2,s:'zzzzz'}])+.toLookup("$.a").toEnumerable()+.select("$.key() + ':' + $.select('$.s').toJoinedString('-')")</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ jQuery Extension(linq.jquery.js)</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ tojQuery+ </td>+ <td>+ jQuery+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>// Enumerable.repeat("foo",10).tojQuery()</pre>+ </td>+ </tr>+ <tr>+ <td>+ tojQueryAsArray+ </td>+ <td>+ jQuery+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>// Enumerable.repeat("foo",10).tojQueryAsArray()</pre>+ </td>+ </tr>+ <tr>+ <td>+ toEnumerable+ </td>+ <td>+ Enumerable<jQuery>+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>// $("div").toEnumerable()</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ RxJS Extension(linq.rx.js)</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>+ toObservable+ </td>+ <td>+ Rx.Observable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>// Enumerable.range(1,10).toObservable()</pre>+ </td>+ </tr>+ <tr>+ <td>+ toEnumerable+ </td>+ <td>+ Enumerable+ </td>+ <td>+ ()+ </td>+ <td>+ <pre>// Rx.Observable.range(1,10).toEnumerable()</pre>+ </td>+ </tr>+ </tbody>+ </table>+ <h2>+ QUnit Extension(linq.qunit.js)</h2>+ <table>+ <thead>+ <tr>+ <td>+ method name+ </td>+ <td>+ return type+ </td>+ <td>+ arguments+ </td>+ <td>+ example (click code)+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td rowspan="3">+ is+ </td>+ <td rowspan="3">+ void+ </td>+ <td>+ Object expected, [string message]+ </td>+ <td>+ <pre>// Math.pow(10, 2).is(100, "all objects are extended")</pre>+ </td>+ </tr>+ <tr>+ <td>+ params Object[] expected+ </td>+ <td>+ <pre>// Enumerable.range(1,3).is(1,2,3) // collection deepEqual</pre>+ </td>+ </tr>+ <tr>+ <td>+ Func<T,bool> checker, [string message]+ </td>+ <td>+ <pre>// ({ a: "foo", b: "bar" }).is(function (x) { return x.a == "foo" && x.b == "bar" }, "checker must be function(can not use string lambda)")</pre>+ </td>+ </tr>+ <tr>+ <td rowspan="3">+ isNot+ </td>+ <td rowspan="3">+ void+ </td>+ <td>+ Object expected, [string message]+ </td>+ <td>+ <pre>// Math.pow(10, 2).isNot(-5, "all objects are extended")</pre>+ </td>+ </tr>+ <tr>+ <td>+ params Object[] expected+ </td>+ <td>+ <pre>// Enumerable.range(1,3).isNot(1,2,3,4) // collection deepEqual</pre>+ </td>+ </tr>+ <tr>+ <td>+ Func<T,bool> checker, [string message]+ </td>+ <td>+ <pre>// ({ a: "foo", b: "bar" }).isNot(function (x) { return x.a == "hee" && x.b == "bee" }, "checker must be function(can not use string lambda)")</pre>+ </td>+ </tr>+ <tr>+ <td>+ isExpr+ </td>+ <td>+ void+ </td>+ <td>+ string expression, [string message]+ </td>+ <td>+ <pre>// ({ a: "foo", b: "bar" }).isExpr("$.a == 'foo' && $.b == 'bar'", "checker string is converted to lambda")</pre>+ </td>+ </tr>+ <tr>+ <td>+ isNotExpr+ </td>+ <td>+ void+ </td>+ <td>+ string expression, [string message]+ </td>+ <td>+ <pre>// ({ a: "foo", b: "bar" }).isNotExpr("$.a == 'bar' && $.b == 'foo'", "checker string is converted to lambda")</pre>+ </td>+ </tr>+ <tr>+ <td>+ isTrue+ </td>+ <td>+ void+ </td>+ <td>+ [string message]+ </td>+ <td>+ <pre>// (Enumerable.empty().firstOrDefault() === null).isTrue()</pre>+ </td>+ </tr>+ <tr>+ <td>+ isFalse+ </td>+ <td>+ void+ </td>+ <td>+ [string message]+ </td>+ <td>+ <pre>// Enumerable.range(1, 10).all("$<5").isFalse()</pre>+ </td>+ </tr>+ <tr>+ <td>+ expectError+ </td>+ <td>+ Error+ </td>+ <td>+ Action testCode, [string message]+ </td>+ <td>+ <pre>// Enumerable.Assert.expectError(function () { throw new Error("ERROOOOOR"); })</pre>+ </td>+ </tr>+ <tr>+ <td>+ doesNotThrow+ </td>+ <td>+ void+ </td>+ <td>+ Action testCode, [string message]+ </td>+ <td>+ <pre>// Enumerable.Assert.doesNotThrow(function () { })</pre>+ </td>+ </tr>+ </tbody>+ </table>+</body>+</html>diff --git a/data/manifest.json b/data/manifest.jsonindex f140b02f7..4a7f93a74 100644--- a/data/manifest.json+++ b/data/manifest.json@@ -1,6 +1,6 @@{"name": "TagSpaces",- "version": "1.4.1394",+ "version": "1.4.1396","manifest_version": 2,"description": "TagSpaces Explorer","icons": {diff --git a/lib/ioutils.js b/lib/ioutils.jsindex 6a891fcda..182a04510 100644--- a/lib/ioutils.js+++ b/lib/ioutils.js@@ -2,7 +2,7 @@* Use of this source code is governed by a AGPL3 license that* can be found in the LICENSE file. */-const {Cc,Ci,Cr} = require("chrome");+const {Cc,Ci,Cr,Cu} = require("chrome");var filesIO = require("file");var runtime = require("runtime");@@ -324,12 +324,18 @@ exports.rename = function rename(filePath, newFilePath, worker) {targetDir = newFilePath.substring(0,newFilePath.lastIndexOf("/"));targetFileName = newFilePath.substring(newFilePath.lastIndexOf("/")+1,newFilePath.length);}-// console.log("Target dir: "+targetDir+" filename: "+targetFileName);+ console.log("Target dir: "+targetDir+" filename: "+targetFileName);var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);file.initWithPath(filePath);++ //let FileUtils = Cu.import('resource://gre/modules/FileUtils.jsm').FileUtils;+ //var targetDirFile = new FileUtils.File(targetDir);+var targetDirFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);- targetDirFile.initWithPath(targetDir);-// console.log("After init: "+file.path+" targetdir: "+targetDirFile.path+" targetfilename: "+targetFileName);+ targetDirFile.initWithPath(filesIO.join(targetDir,""));+ //targetDirFile.initWithPath(targetDir);++ console.log("After init: "+file.path+" targetdir: "+targetDirFile.path+" targetfilename: "+targetFileName);file.moveTo(targetDirFile,targetFileName);var targetPath = filesIO.join(targetDir,targetFileName);worker.postMessage({diff --git a/node-webkit/package.json b/node-webkit/package.jsonnew file mode 100644index 000000000..265229296--- /dev/null+++ b/node-webkit/package.json@@ -0,0 +1,13 @@+{+ "name": "TagSpaces",+ "description": "File explorer.",+ "version": "1.4",+ "main": "../data/index.html",+ "window": {+ "icon": "icon128.png",+ "toolbar": true,+ "width": 1024,+ "height": 800+ },+ "nodejs": true+}diff --git a/node-webkit/tagspaces.lnk b/node-webkit/tagspaces.lnknew file mode 100644index 000000000..40b7f88c9Binary files /dev/null and b/node-webkit/tagspaces.lnk differdiff --git a/package.json b/package.jsonindex 047f03e23..81c6529db 100644--- a/package.json+++ b/package.json@@ -2,7 +2,7 @@"name": "tagspaces","license": "AGPL 3.0","author": "Ugg Rock",- "version": "1.4.1394",+ "version": "1.4.1396","fullName": "TagSpaces","id": "jid1-FBaMKxTifTSahQ","description": "TagSpaces is a firefox addon, which allows you to browse your local file system and add tags to your files.",diff --git a/update.rdf b/update.rdfindex 562efa357..d3f806f13 100644--- a/update.rdf+++ b/update.rdf@@ -7,13 +7,13 @@<r:Seq><r:li><r:Description>- <version>1.4.1394</version>+ <version>1.4.1396</version><targetApplication><r:Description><id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id><minVersion>16.0</minVersion><maxVersion>*</maxVersion>- <updateLink>http://tagspaces.com/releases/1.4/tagspaces.1.4.1394.xpi</updateLink>+ <updateLink>http://tagspaces.com/releases/1.4/tagspaces.1.4.1396.xpi</updateLink><updateInfoURL>http://tagspaces.com/releases/1.4/updateInfo.xml</updateInfoURL></r:Description></targetApplication>