forked from cujojs/rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentity.js
39 lines (32 loc) · 761 Bytes
/
entity.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Copyright 2012 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (define) {
'use strict';
define(function (require) {
var interceptor;
interceptor = require('../interceptor');
/**
* Returns the response entity as the response, discarding other response
* properties.
*
* @param {Client} [client] client to wrap
*
* @returns {Client}
*/
return interceptor({
response: function (response) {
if ('entity' in response) {
return response.entity;
}
return response;
}
});
});
}(
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }
// Boilerplate for AMD and Node
));