Creating your own JavaScript library/framework

There are a few things I do often in JavaScript (like Ajax calls, emptying elements within an element, etc…) that I’d like to make a custom lightweight library for. What are some good ideas for how to structure such a library?

Thanks!

Namespace it, so that it doesn’t clash with third party scripts.

Don’t forget though, that there are JS libraries for almost everything: http://www.jsdb.io/
So sometimes writing your own isn’t the best way to go.