Socket
Book a DemoInstallSign in
Socket

query-ts

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

query-ts

A jQuery like library based on XStream and FP-TS.

0.9.3
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

query-ts

A jQuery like library based on XStream and FP-TS 2.x.

npm install query-ts

Sample usage:

// Get a single element from the dom and map over the Option
import {Q, QElement} from "query-ts/";
import {UnsafeHtml} from "query-ts/lib/util/UnsafeHtml";
import {pipe} from "fp-ts/lib/pipeable"
import {Option, filter, map, getOrElse} from "fp-ts/lib/Option";

const c: Option<Q<QElement>> = Q.one(".container");

const el: Q<QElement> = pipe(
  c,
  filter(e => e.hasClass("container")), // Filter and map over the Option<Q>
  map(e => e.removeClass("container")),
  getOrElse(() => Q.of(document.createElement("div"))) // Lift an element into Q in case of None
);

const html: UnsafeHtml = el.getOuterHtml();

console.log(html.toString())


// Get a list of elements from the dom and iterate over the list
const l: Q<QElement>[] = Q.all(".container");

l.map(e => console.log(e.hasClass("container")));

Keywords

jQuery

FAQs

Package last updated on 04 Jun 2020

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.