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

26 lines (20 loc) 529 B
var filter = require('./filter'); /** * @return {array} Array of unique items */ function unique(arr, compare){ compare = compare || isEqual; return filter(arr, function(item, i, arr){ var n = arr.length; while (++i < n) { if ( compare(item, arr[i]) ) { return false; } } return true; }); } function isEqual(a, b){ return a === b; } module.exports = unique;