npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kwark

v0.0.3

Published

lightweight DOM manipulation library

Downloads

1

Readme

kwark:dom:select

bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies bitHound Code

A minimalistic selector library. NO external dependencies.

insertBefore( targetNode )

Insert selected node before the element passed in as an argument.

const div = select.inline('<div><p>contents</p></div>').nodeify();

div
    .insertBefore(document.querySelector('#nodey'));

insertAfter( targetNode )

Insert selected node after the element passed in as an argument.

div
    .clone()
    .insertAfter(document.querySelector('#nodey'));

kwark:dom:effects

Pre-build effects and animations that extend the standard select library.

kwark:core:utils

Utilities, and standalone functions that make the core of kwark.

partial( fn, [ ...arguments ])

Partial application. Function will fire as soon as it gets enough arguments.

var addThree = function(a,b,c) {
    return a + b + c;
}

var partialAddThree = kwark.partial(addThree);

partialAddThree(1)(2);
// nothing happens, waiting for the third arg

partialAddThree(1,2)(3);
// 6
partialAddThree(1)(2,3);
// 6
partialAddThree(1)(2)(3);
// 6

compose( ...functions )

Functional composition utility (reversed pipeline).

var filteredData = kwark
    .compose(filterById, parseJson);

kwark.ajax('get' url)
    .then(filteredData);

contains( item, array )

Checks whether array contains the given item.

kwark.contains(1,[1,2,3]);
// true

extend( destination, source )

Extends javascript object(s). With ES2015 in mind, rather use native Object.assign() method, or spread operator { ...object}.

nSiblings( targetNode )

All siblings following the target node.

kwark.nSiblings(document.querySelector('#nodey'));

pSiblings( targetNode )

All siblings preceding the target node.

kwark.pSiblings(document.querySelector('#nodey'));

kwark:dom:addons

serialize( targetNode )

Serializes form node which is then ready to be sent as a request.

var formNode = select('#form').node,
    serialized = addons.serialize(formNode);

xmlToJson( XML )

Parses xml file and returns a valid JSON object out of it.

// (...) some request with xmlresponse

var JSON = addons.xmlToJson(xmlresponse);

loadScript( urlSource, [ callback ] )

Fetches and loads the script from external url. The script itself is cleaned up from DOM after being loaded.

addons.loadScript('https://somefancyfancysite.co.uk/script.js');

kwark:async:ajax

A simple promise-based implementation of ajax module.

ajax( method, url ).then( resolve, reject )

Generalised ajax method, supports basic GET and POST requests. Where resolve and reject are functions that take one single argument response, and error, respectiely. Ajax module does not support chaining multiple .then sequences. There is some debate whether it is a better approach than the regular "callback hell". Use functional composition (kwark.compose) instead, it improves the design of your app.

kwark.ajax('get', url)
    .then(resolve, reject);