Comparing version 0.1.10 to 0.1.11
import { ItemPredicate } from './types'; | ||
export default function count<T>(items: T[], predicate: ItemPredicate<T>): number; | ||
export default function count<T>(items: T[], predicate?: ItemPredicate<T>): number; |
"use strict"; | ||
function count(items, predicate) { | ||
let count = 0; | ||
for (var i = 0, ii = items.length; i < ii; i++) { | ||
count = count + (predicate(items[i], i, items) ? 1 : 0); | ||
if (predicate) { | ||
let count = 0; | ||
for (var i = 0, ii = items.length; i < ii; i++) { | ||
count = count + (predicate(items[i], i, items) ? 1 : 0); | ||
} | ||
return count; | ||
} | ||
return count; | ||
else { | ||
return items.length; | ||
} | ||
} | ||
@@ -9,0 +14,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
import { ItemPredicate } from './types'; | ||
export default function count<T>(items: T[], predicate: ItemPredicate<T>): number { | ||
export default function count<T>(items: T[], predicate?: ItemPredicate<T>): number { | ||
if (predicate) { | ||
let count = 0; | ||
for (var i = 0, ii = items.length; i < ii; i++) { | ||
count = count + (predicate(items[i], i, items) ? 1 : 0); | ||
count = count + (predicate(items[i], i, items) ? 1 : 0); | ||
} | ||
return count; | ||
} else { | ||
return items.length; | ||
} | ||
} |
{ | ||
"name": "arrayq", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "Array query methods for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "es6/prototype.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167635
4705