@tom-s/kquery

1.0.0 • Public • Published

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 git@github.com: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)

Readme

Keywords

none

Package Sidebar

Install

npm i @tom-s/kquery

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

56.8 kB

Total Files

27

Last publish

Collaborators

  • tom-s