UNPKG

tastypie

Version:

Tastypie is a webservice API framework for Node.js based on Django's Tastypie Framework. It provides a convenient, yet powerful and highly customizable, abstraction for creating REST-style interfaces

29 lines (20 loc) 575 B
/** * Array indicesOf */ function indicesOf(arr, item, fromIndex) { var results = []; if (arr == null) { return results; } fromIndex = typeof fromIndex === 'number' ? fromIndex : 0; var length = arr.length; var cursor = fromIndex >= 0 ? fromIndex : length + fromIndex; while (cursor < length) { if (arr[cursor] === item) { results.push(cursor); } cursor++; } return results; } module.exports = indicesOf;