UNPKG

972 BJavaScriptView Raw
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT license.
3/**
4 * Function that converts PageRange and ClearRange to a common Range object.
5 * PageRange and ClearRange have start and end while Range offset and count
6 * this function normalizes to Range.
7 * @param response - Model PageBlob Range response
8 */
9export function rangeResponseFromModel(response) {
10 const pageRange = (response._response.parsedBody.pageRange || []).map((x) => ({
11 offset: x.start,
12 count: x.end - x.start,
13 }));
14 const clearRange = (response._response.parsedBody.clearRange || []).map((x) => ({
15 offset: x.start,
16 count: x.end - x.start,
17 }));
18 return Object.assign(Object.assign({}, response), { pageRange,
19 clearRange, _response: Object.assign(Object.assign({}, response._response), { parsedBody: {
20 pageRange,
21 clearRange,
22 } }) });
23}
24//# sourceMappingURL=PageBlobRangeResponse.js.map
\No newline at end of file