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

14 lines (12 loc) 351 B
define(function(){ /** * Gets normalized ratio of value inside range. */ function norm(val, min, max){ if (val < min || val > max) { throw new RangeError('value (' + val + ') must be between ' + min + ' and ' + max); } return val === max ? 1 : (val - min) / (max - min); } return norm; });