Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finished lab #228

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@
* @param {Object} store - An object representing a single store. See the instructions for details on its shape.
* @returns {Object[]} The same `stores` array that was inputted.
*/
function addNewStore(stores, store) {}
function addNewStore(stores, store) {
stores.push(store)
return stores
}

/**
* Removes a store object at the given position.
* @param {Object[]]} stores - An array of store objects.
* @param {number} index - A number representing the index of the store to be removed from the array.
* @returns {Object[]} The same `stores` array that was inputted.
*/
function removeStoreAtPosition(stores, index) {}
function removeStoreAtPosition(stores, index) {
stores.splice(index,1)
return stores
}

/**
* Creates a duplicate of the `store` object. No references should be shared between the inputted `store` and the result.
* @param {Object} store - An object representing a single store. See the instructions for details on its shape.
* @returns {Object} The duplicated store object. This should not be the same as the store that was inputted.
*/
function duplicateStore(store) {}

function duplicateStore(store) {
let newStore = JSON.parse(JSON.stringify(store))
return newStore
}
module.exports = {
addNewStore,
removeStoreAtPosition,
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.