Werdox
Werdox
Explore posts from servers
PPrisma
Created by Werdox on 6/19/2024 in #help-and-questions
omit with condition
--- Here is the omitArray function for anyone finding this later
export function omitArray<Data extends object, Keys extends keyof Data>(
data: Data[],
keys: Keys[]
): Omit<Data, (typeof keys)[number]>[] {
const result = [];

for (const obj of [...data]) {
const modifiedObj = { ...obj };
for (const key of keys) {
delete modifiedObj[key];
}

result.push(modifiedObj);
}

return result;
}
export function omitArray<Data extends object, Keys extends keyof Data>(
data: Data[],
keys: Keys[]
): Omit<Data, (typeof keys)[number]>[] {
const result = [];

for (const obj of [...data]) {
const modifiedObj = { ...obj };
for (const key of keys) {
delete modifiedObj[key];
}

result.push(modifiedObj);
}

return result;
}
11 replies
PPrisma
Created by Werdox on 6/19/2024 in #help-and-questions
omit with condition
Hmm I need the data in the original order. I do have an omitArray function which removes a property from all indecies of an array I guess I should use that then. Thought there might be a native solution.
11 replies
PPrisma
Created by Werdox on 6/19/2024 in #help-and-questions
omit with condition
Pretty small for now, so no paginating
11 replies
PPrisma
Created by Werdox on 6/19/2024 in #help-and-questions
omit with condition
Hmm this would be possible but it intentionally orders the list to type 1 and then type 0
11 replies
NNuxt
Created by Werdox on 3/30/2024 in #❓・help
Nuxt Image with ssr false
generate
4 replies
NNuxt
Created by Werdox on 3/17/2024 in #❓・help
page layout remounts when changing to a route using the same layout
Hah... this seems to only happen because i have a layout transition on one of my pages. but why?
2 replies