dist/hello.all.js
function getPath(url) {

		// Format the string if it needs it
		url = url.replace(/\@\{([a-z\_\-]+)(\|.*?)?\}/gi, function(m, key, defaults) {
			var val = defaults ? defaults.replace(/^\|/, '') : '';
			if (key in p.query) {
				val = p.query[key];
				delete p.query[key];
			}
			else if (p.data && key in p.data) {
				val = p.data[key];
				delete p.data[key];
			}
			else if (!defaults) {
				promise.reject(error('missing_attribute', 'The attribute ' + key + ' is missing from the request'));
			}

			return val;
		});

		// Add base
		if (!url.match(/^https?:\/\//)) {
			url = o.base + url;
		}

		// Define the request URL
		p.url = url;

		// Make the HTTP request with the curated request object
		// CALLBACK HANDLER
		// @ response object
		// @ statusCode integer if available
		utils.request(p, function(r, headers) {

			// Is this a raw response?
			if (!p.formatResponse) {
				// Bad request? error statusCode or otherwise contains an error response vis JSONP?
				if (typeof headers === 'object' ? (headers.statusCode >= 400) : (typeof r === 'object' && 'error' in r)) {
					promise.reject(r);
				}
				else {
					promise.fulfill(r);
				}

				return;
			}

			// Should this be an object
			if (r === true) {
				r = {success:true};
			}
			else if (!r) {
				r = {};
			}

			// The delete callback needs a better response
			if (p.method === 'delete') {
				r = (!r || utils.isEmpty(r)) ? {success:true} : r;
			}

			// FORMAT RESPONSE?
			// Does self request have a corresponding formatter
			if (o.wrap && ((p.path in o.wrap) || ('default' in o.wrap))) {
				var wrap = (p.path in o.wrap ? p.path : 'default');
				var time = (new Date()).getTime();

				// FORMAT RESPONSE
				var b = o.wrap[wrap](r, headers, p);

				// Has the response been utterly overwritten?
				// Typically self augments the existing object.. but for those rare occassions
				if (b) {
					r = b;
				}
			}

			// Is there a next_page defined in the response?
			if (r && 'paging' in r && r.paging.next) {

				// Add the relative path if it is missing from the paging/next path
				if (r.paging.next[0] === '?') {
					r.paging.next = p.path + r.paging.next;
				}

				// The relative path has been defined, lets markup the handler in the HashFragment
				else {
					r.paging.next += '#' + p.path;
				}
			}

			// Dispatch to listeners
			// Emit events which pertain to the formatted response
			if (!r || 'error' in r) {
				promise.reject(r);
			}
			else {
				promise.fulfill(r);
			}
		});
	}
function getPath(url) {

		// Format the string if it needs it
		url = url.replace(/\@\{([a-z\_\-]+)(\|.*?)?\}/gi, function(m, key, defaults) {
			var val = defaults ? defaults.replace(/^\|/, '') : '';
			if (key in p.query) {
				val = p.query[key];
				delete p.query[key];
			}
			else if (p.data && key in p.data) {
				val = p.data[key];
				delete p.data[key];
			}
			else if (!defaults) {
				promise.reject(error('missing_attribute', 'The attribute ' + key + ' is missing from the request'));
			}

			return val;
		});

		// Add base
		if (!url.match(/^https?:\/\//)) {
			url = o.base + url;
		}

		// Define the request URL
		p.url = url;

		// Make the HTTP request with the curated request object
		// CALLBACK HANDLER
		// @ response object
		// @ statusCode integer if available
		utils.request(p, function(r, headers) {

			// Is this a raw response?
			if (!p.formatResponse) {
				// Bad request? error statusCode or otherwise contains an error response vis JSONP?
				if (typeof headers === 'object' ? (headers.statusCode >= 400) : (typeof r === 'object' && 'error' in r)) {
					promise.reject(r);
				}
				else {
					promise.fulfill(r);
				}

				return;
			}

			// Should this be an object
			if (r === true) {
				r = {success:true};
			}
			else if (!r) {
				r = {};
			}

			// The delete callback needs a better response
			if (p.method === 'delete') {
				r = (!r || utils.isEmpty(r)) ? {success:true} : r;
			}

			// FORMAT RESPONSE?
			// Does self request have a corresponding formatter
			if (o.wrap && ((p.path in o.wrap) || ('default' in o.wrap))) {
				var wrap = (p.path in o.wrap ? p.path : 'default');
				var time = (new Date()).getTime();

				// FORMAT RESPONSE
				var b = o.wrap[wrap](r, headers, p);

				// Has the response been utterly overwritten?
				// Typically self augments the existing object.. but for those rare occassions
				if (b) {
					r = b;
				}
			}

			// Is there a next_page defined in the response?
			if (r && 'paging' in r && r.paging.next) {

				// Add the relative path if it is missing from the paging/next path
				if (r.paging.next[0] === '?') {
					r.paging.next = p.path + r.paging.next;
				}

				// The relative path has been defined, lets markup the handler in the HashFragment
				else {
					r.paging.next += '#' + p.path;
				}
			}

			// Dispatch to listeners
			// Emit events which pertain to the formatted response
			if (!r || 'error' in r) {
				promise.reject(r);
			}
			else {
				promise.fulfill(r);
			}
		});
	}
function getPath ( url ) { // Format the string if it needs it url = url . replace ( / \@\{([a-z\_\-]+)(\|.*?)?\} / gi , function ( m , key , defaults ) { var val = defaults ? defaults . replace ( / ^\| / , '' ) : '' ; if ( key in p . query ) { val = p . query [ key ] ; delete p . query [ key ] ; } else if ( p . data && key in p . data ) { val = p . data [ key ] ; delete p . data [ key ] ; } else if ( ! defaults ) { promise . reject ( error ( 'missing_attribute' , 'The attribute ' + key + ' is missing from the request' ) ) ; } return val ; } ) ; // Add base if ( ! url . match ( / ^https?:\/\/ / ) ) { url = o . base + url ; } // Define the request URL p . url = url ; // Make the HTTP request with the curated request object // CALLBACK HANDLER // @ response object // @ statusCode integer if available utils . request ( p , function ( r , headers ) { // Is this a raw response? if ( ! p . formatResponse ) { // Bad request? error statusCode or otherwise contains an error response vis JSONP? if ( typeof headers === 'object' ? ( headers . statusCode >= 400 ) : ( typeof r === 'object' && 'error' in r ) ) { promise . reject ( r ) ; } else { promise . fulfill ( r ) ; } return ; } // Should this be an object if ( r === true ) { r = { success : true } ; } else if ( ! r ) { r = { } ; } // The delete callback needs a better response if ( p . method === 'delete' ) { r = ( ! r || utils . isEmpty ( r ) ) ? { success : true } : r ; } // FORMAT RESPONSE? // Does self request have a corresponding formatter if ( o . wrap && ( ( p . path in o . wrap ) || ( 'default' in o . wrap ) ) ) { var wrap = ( p . path in o . wrap ? p . path : 'default' ) ; var time = ( new Date ( ) ) . getTime ( ) ; // FORMAT RESPONSE var b = o . wrap [ wrap ] ( r , headers , p ) ; // Has the response been utterly overwritten? // Typically self augments the existing object.. but for those rare occassions if ( b ) { r = b ; } } // Is there a next_page defined in the response? if ( r && 'paging' in r && r . paging . next ) { // Add the relative path if it is missing from the paging/next path if ( r . paging . next [ 0 ] === '?' ) { r . paging . next = p . path + r . paging . next ; } // The relative path has been defined, lets markup the handler in the HashFragment else { r . paging . next += '#' + p . path ; } } // Dispatch to listeners // Emit events which pertain to the formatted response if ( ! r || 'error' in r ) { promise . reject ( r ) ; } else { promise . fulfill ( r ) ; } } ) ; }
If url needs a base Wrap everything in
If url needs a base Wrap everything in