Skip to content

Worried about pluck operator deprecation #7108

Answered by kwonoj
DarioSoller asked this question in Q&A
Discussion options

You must be logged in to vote
  1. The recommended equivalent is use optional chaining as you said. Any reason you can't use it?
map((value) => ({ key, value:  exampleObj2?.[key] }))
  1. Deprecation does not mean you are not allowed to use those implementation anymore. It simply means core rxjs api surface will not maintain - but the implementation of pluck is a variant of map operator less than 10 lines:
    return map((x) => {
    let currentProp: any = x;
    for (let i = 0; i < length; i++) {
    const p = currentProp?.[properties[i]];
    if (typeof p !== 'undefined') {
    currentProp = p;
    } else {
    return undefined;
    }
    }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DarioSoller
Comment options

Answer selected by kwonoj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants