Lets say I have a simple JS library. Most of the JS code is inside an object named after the library with the properties being the method functions. Some of these method functions require other method functions (Example, methodC() requires methodA()).
const myLibrary = {
methodA: function() {...},
methodB: functiom() {...},
methodC: function() {...},
methodD: function() {...}
}
How would I split these methods up into modules and split up this code into multiple files to make it a standard file structure for a NPM package. Currently all of the code is in one large JS file, and it could be broken down into modules. I would like to keep it all in the one object myLibrary like most NPM packages which when used, have the following syntax...
myLibrary.methodB(true, true);
Were all the methods are contained inside a object.
Any help will be most appreciated.