Socket
Socket
Sign inDemoInstall

@tom-s/kquery

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tom-s/kquery

TODO: - handle bad user input (selector not string and replace with)


Version published
Weekly downloads
1
Maintainers
1
Install size
726 kB
Created
Weekly downloads
 

Readme

Source

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)

FAQs

Last updated on 29 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc