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 (21 loc) 527 B
define(['./filter'], function(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; } return unique; });