0% found this document useful (0 votes)
19 views

Timeline Data Serialize R

Uploaded by

mahoraga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Timeline Data Serialize R

Uploaded by

mahoraga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import hasOwnProperty from 'shared/hasOwnProperty';

import isArray from 'shared/isArray';

function formatLanes(laneArray) {
const lanes = laneArray.reduce((current, reduced) => current + reduced, 0);
return '0b' + lanes.toString(2).padStart(31, '0');
}

// test() is part of Jest's serializer API


export function test(maybeTimelineData) {
if (
maybeTimelineData != null &&
typeof maybeTimelineData === 'object' &&
hasOwnProperty.call(maybeTimelineData, 'lanes') &&
isArray(maybeTimelineData.lanes)
) {
return true;
}

return false;
}

// print() is part of Jest's serializer API


export function print(timelineData, serialize, indent) {
return serialize({
...timelineData,
lanes: formatLanes(timelineData.lanes),
});
}

You might also like