I'm trying to make a reusable javascript library for example books class and have createbook, checkforbook, modify book methods
I want to use it like so
import Library, {checkForBook, modifyBook} from 'books'
Library.createBook({
name : 'firstbook',
year: 2012
})
checkForBook('firstBook')
modifyBook('firstBook',{
name: 'secondBook'
})
my problem right now is: how to do it without need to use new keywrod , and how to use methods wihout need to make it like Library.checkForBook and still have access to the list of books