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
15 lines (13 loc) • 378 B
JavaScript
define(['./difference', './slice'], function (difference, slice) {
/**
* Insert item into array if not already present.
*/
function insert(arr, rest_items) {
var diff = difference(slice(arguments, 1), arr);
if (diff.length) {
Array.prototype.push.apply(arr, diff);
}
return arr.length;
}
return insert;
});