Skip to content
Aierse edited this page Oct 17, 2023 · 1 revision

Remove targets

import JSONExtend from "@aierse/json-extend";

const json = 
{
    id: "test",
    password: "test",
    phone: "010-1234-5678",
    memo: "",
    etc: undefined,
}

// Remove targets
json = JSONExtend.filter(json, [null, undefined, ""]);
/*
{
    id: "test",
    password: "test",
    phone: "010-1234-5678",
}
*/

Clone this wiki locally