Skip to content

Instantly share code, notes, and snippets.

@perjo927
Created September 8, 2020 13:45
Show Gist options
  • Save perjo927/8085f3988bb1ae2c099aca2939919950 to your computer and use it in GitHub Desktop.
Save perjo927/8085f3988bb1ae2c099aca2939919950 to your computer and use it in GitHub Desktop.
Create Todo Item
import { generateId } from "../id/index.js";
export const createTodoBase = (text) => ({ text, done: false });
export const createTodoItem = (todoObj, idObj) => ({
...todoObj,
...idObj,
});
export const getTodoItem = (text) => {
const idObj = generateId();
const todoObj = createTodoBase(text);
return createTodoItem(todoObj, idObj);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment