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

34 lines (28 loc) 798 B
define(['../lang/toString', './WHITE_SPACES'], function(toString, WHITE_SPACES){ /** * Remove chars from beginning of string. */ function ltrim(str, chars) { str = toString(str); chars = chars || WHITE_SPACES; var start = 0, len = str.length, charLen = chars.length, found = true, i, c; while (found && start < len) { found = false; i = -1; c = str.charAt(start); while (++i < charLen) { if (c === chars[i]) { found = true; start++; break; } } } return (start >= len) ? '' : str.substr(start, len); } return ltrim; });