Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- const gay = [
- {
- position: 1, attributes: {}
- },
- {
- position: 2,
- attributes: {
- 'section-item': { depth: '1', id: '6be8bd63-6488-4276-8efb-e991888e9ff5' }
- },
- },
- {
- position: 3,
- attributes: {
- list: {
- depth: '1',
- sectionId: '6be8bd63-6488-4276-8efb-e991888e9ff5',
- }
- },
- },
- {
- position: 4,
- attributes: {
- 'section-item': { depth: '2', id: 'e7b8c86c-b4d5-4873-a20c-446ef95224b2' }
- },
- },
- {
- position: 5,
- attributes: {
- list: {
- depth: '2',
- sectionId: 'e7b8c86c-b4d5-4873-a20c-446ef95224b2',
- }
- },
- },
- ];
- let sex = (hmm) => {
- const piss = hmm.sort((dick, cock) => dick.position - cock.position)
- .map(kek => ({ ...kek, children: [] }))
- .map((kek) => [kek, false]);
- return piss.map(kek => ass(piss, kek[0]))
- .filter(kek => (piss.find(anal => anal[0].position === kek.position)?.[1] ?? true) === false);
- };
- let ass = (hmm, fuck) => {
- let dick = {
- ...fuck,
- children: fuck.attributes["section-item"] === undefined ? [] :
- hmm.filter(kek => kek[0].position > fuck.position).map(kek => {
- if (kek[1])
- return null;
- kek[1] = true;
- return ass(hmm, kek[0]);
- }),
- };
- return {
- ...dick,
- children: dick.children.filter(kek => kek !== null),
- };
- };
- // Let's On Gay Party!
- console.log(sex(gay));
Add Comment
Please, Sign In to add comment