Permalink
Comparing changes
Open a pull request
- 2 commits
- 2 files changed
- 0 commit comments
- 1 contributor
Unified
Split
Showing
with
12 additions
and 37 deletions.
- +4 −29 src/ng/filter/limitTo.js
- +8 −8 src/ngMock/angular-mocks.js
| @@ -81,36 +81,11 @@ function limitToFilter(){ | ||
| limit = int(limit); | ||
| } | ||
|
|
||
| if (isString(input)) { | ||
| //NaN check on limit | ||
| if (limit) { | ||
| return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length); | ||
| } else { | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| var out = [], | ||
| i, n; | ||
|
|
||
| // if abs(limit) exceeds maximum length, trim it | ||
| if (limit > input.length) | ||
| limit = input.length; | ||
| else if (limit < -input.length) | ||
| limit = -input.length; | ||
|
|
||
| if (limit > 0) { | ||
| i = 0; | ||
| n = limit; | ||
| //NaN check on limit | ||
| if (limit) { | ||
| return limit > 0 ? input.slice(0, limit) : input.slice(limit); | ||
| } else { | ||
| i = input.length + limit; | ||
| n = input.length; | ||
| return isString(input) ? "" : []; | ||
| } | ||
|
|
||
| for (; i<n; i++) { | ||
| out.push(input[i]); | ||
| } | ||
|
|
||
| return out; | ||
| }; | ||
| } | ||
| @@ -1838,7 +1838,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header | ||
| * object and returns true if the headers match the current definition. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| * | ||
| * - respond – | ||
| * `{function([status,] data[, headers, statusText]) | ||
| @@ -1861,7 +1861,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * @param {string|RegExp} url HTTP url. | ||
| * @param {(Object|function(Object))=} headers HTTP headers. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| */ | ||
|
|
||
| /** | ||
| @@ -1874,7 +1874,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * @param {string|RegExp} url HTTP url. | ||
| * @param {(Object|function(Object))=} headers HTTP headers. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| */ | ||
|
|
||
| /** | ||
| @@ -1887,7 +1887,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * @param {string|RegExp} url HTTP url. | ||
| * @param {(Object|function(Object))=} headers HTTP headers. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| */ | ||
|
|
||
| /** | ||
| @@ -1901,7 +1901,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * @param {(string|RegExp)=} data HTTP request body. | ||
| * @param {(Object|function(Object))=} headers HTTP headers. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| */ | ||
|
|
||
| /** | ||
| @@ -1915,7 +1915,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * @param {(string|RegExp)=} data HTTP request body. | ||
| * @param {(Object|function(Object))=} headers HTTP headers. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| */ | ||
|
|
||
| /** | ||
| @@ -1929,7 +1929,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * @param {(string|RegExp)=} data HTTP request body. | ||
| * @param {(Object|function(Object))=} headers HTTP headers. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| */ | ||
|
|
||
| /** | ||
| @@ -1941,7 +1941,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { | ||
| * | ||
| * @param {string|RegExp} url HTTP url. | ||
| * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that | ||
| * control how a matched request is handled. | ||
| * controls how a matched request is handled. | ||
| */ | ||
| angular.mock.e2e = {}; | ||
| angular.mock.e2e.$httpBackendDecorator = | ||