Skip to content

Instantly share code, notes, and snippets.

@hernanBeiza
Last active November 5, 2020 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hernanBeiza/54754b975230a483df65af88abe37cf6 to your computer and use it in GitHub Desktop.
Save hernanBeiza/54754b975230a483df65af88abe37cf6 to your computer and use it in GitHub Desktop.
TS - Filtar dos arreglos
const todosLosUsuarios = [{ userid: "100", nombre: "NN", rowid: "0" },{ userid: "101", nombre: "HB", rowid: "1" },{ userid: "102", nombre: "Marcus", rowid: "2" }];
const usuariosFiltro = [{ userid: "101", nombre: "HB", rowid: "1" }];
console.log("todosLosUsuarios", todosLosUsuarios);
console.log("usuariosFiltro", usuariosFiltro);
const encontrados = todosLosUsuarios.filter(array => !usuariosFiltro.some(filter => filter.userid !== array.userid));
console.log("encontrados", encontrados);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment