31 lines
972 B
JavaScript
31 lines
972 B
JavaScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
/**
|
|
* Function that converts PageRange and ClearRange to a common Range object.
|
|
* PageRange and ClearRange have start and end while Range offset and count
|
|
* this function normalizes to Range.
|
|
* @param response - Model PageBlob Range response
|
|
*/
|
|
export function rangeResponseFromModel(response) {
|
|
const pageRange = (response._response.parsedBody.pageRange || []).map((x) => ({
|
|
offset: x.start,
|
|
count: x.end - x.start,
|
|
}));
|
|
const clearRange = (response._response.parsedBody.clearRange || []).map((x) => ({
|
|
offset: x.start,
|
|
count: x.end - x.start,
|
|
}));
|
|
return {
|
|
...response,
|
|
pageRange,
|
|
clearRange,
|
|
_response: {
|
|
...response._response,
|
|
parsedBody: {
|
|
pageRange,
|
|
clearRange,
|
|
},
|
|
},
|
|
};
|
|
}
|
|
//# sourceMappingURL=PageBlobRangeResponse.js.map
|