Production of strange particles in charged jets in p–Pb and Pb–Pb collisions measured with ALICE at the LHC