Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pasteObjectByUUID(data, object, uuid) {
- if(Array.isArray(data)) {
- return data.reduce((res, item) => {
- if(item.data) {
- for(const key in item.data) {
- item.data[key] = pasteObjectByUUID(item.data[key], object, uuid);
- }
- }
- res.push(item);
- if(item.uuid == uuid) res.push(object);
- return res;
- }, []).filter(q => q);
- } else {
- return data;
- }
- return data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement