@tom-s/kquery
v1.0.0
Published
TODO: - handle bad user input (selector not string and replace with)
Downloads
2
Readme
kQuery
A jQuery-like capable library.
Example
You can play with kQuery here: https://codesandbox.io/s/unruffled-davinci-8mgyt
OR You can also run the example locally:
git clone [email protected]:tom-s/kQuery.git
cd kQuery
npm install
npm run start
Usage
Add the package to your dependencies
npm install --save @tom-s/kquery
Import the library in your file
import kQuery from "@tom-s/kquery"
Use the library (make sure the DOM is loaded before you run any kQuery)
kQuery('.my-selector').remove()
API documentation
See assignment.md
Test
npm run test
Publication
npm run build`
npm publish`
Technical choices
I have made the following (debattable) choices:
- isolated collection method. Each method (get, find, etc) is isolated it its own file and doesn't require any other method. This way if a method was to to be modified/removed in the future, it wouldn't affect other methods.
- no error handling. No try/catch here, we leave to the user the handling of errors.
- browser compatibility is ensured with babel-env polyfills.
- building and bundling is handled with webpack.
- linting is done with ESLINT.
Improvements
The following improvements could be made in the future:
- make kQuery a singleton (it currently relies on npm import caching mechanism to be a singleton)
- implement more methods and group them into modules (core, traversing, event, aso.)
- add end to end testing (for instance to make sure it works on all browsers)