I have two objects and I want to extract only the data that is unique using underscore js.
Object 1 (default)
{
players: "Players: ",
tableLimit: "Table Limits:",
newCardBtn: "Add New Card",
existingCard: "Use existing one",
contactUs: "Contact Us",
test: {
table: 'test'
}
}
Object 2 (overwrite)
{
players: "Players: ",
tableLimit: "Table Limits:",
newCardBtn: "Add New Card",
existingCard: "Use existing one",
test: {
table: 'test'
}
}
The end result should return a list with data that is missing from overwrite. In our case, it should return contactUs: "Contact Us"
Till now I have this but it returns all data from default object without the custom:
var def = {
players: "Players: ",
tableLimit: "Table Limits:",
newCardBtn: "Add New Card",
existingCard: "Use existing one",
contactUs: "Contact Us",
test: {
table: 'test'
}
}
var custom = {
players: "Players: ",
tableLimit: "Table Limits:",
newCardBtn: "Add New Card",
existingCard: "Use existing one",
test: {
table: 'test'
}
}
var out = JSON.stringify(Object.assign({}, def, custom));
fs.writeFile("./out.js", out);