
Research
Malicious npm Package Brand-Squats TanStack to Exfiltrate Environment Variables
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.
DOM queries that always return an array.
Modern browsers enable us to perform DOM queries natively, e.g:
let cookies = document.querySelectorAll(".cookie");
But we all want to loop over the returned elements. So in practice, we’ve got to do a little more work, particularly converting the resulting NodeList to an array, e.g:
let cookies;
try {
let query = document.querySelectorAll(".cookie");
cookies = Array.prototype.slice.call(query);
} catch (err) {
console.error(err.message);
}
cookies.forEach(cookie => {
// ...
});
Tealight provides a familiar API to perform native queries, without the extra work.
tealight(".cookie").forEach(cookie => {
// ...
});
A simple and fast way to get started is to include this script on your page:
<script src="https://unpkg.com/tealight"></script>
This will create the global variable tealight.
$ npm install tealight
const tealight = require("tealight");
import tealight from "tealight";
tealight accepts a single argument target and will always return an array of 0 or more DOM nodes.
For the examples below, we will query against this HTML fragment:
<div id="jar">
<div class="chocolate-chip cookie"></div>
<div class="peanut-butter cookie"></div>
<div class="short-bread cookie"></div>
</div>
tealight(target: string): Array<HTMLElement>string targets will be used as CSS selectors.
tealight("#jar");
// => [ <div#jar> ]
tealight(".cookie");
// => [ <div.chocolate-chip.cookie>, <div.peanut-butter.cookie>, <div.short-bread.cookie> ]
tealight(target: HTMLElement): Array<HTMLElement>HTMLElement targets will simply be wrapped in an Array
const node = document.querySelector("#jar");
tealight(node);
// => [ <div#jar> ]
tealight(target: HTMLCollection) : Array<HTMLElement>HTMLCollection arguments will be converted to Array.
const nodeList = document.querySelectorAll(".cookie");
tealight(nodeList);
// => [ <div.chocolate-chip.cookie>, <div.peanut-butter.cookie>, <div.short-bread.cookie> ]
tealight(target: Array<any>): Array<HTMLElement>Array targets will be filtered, leaving only HTMLElement
let node = document.querySelector("#jar");
let array = [node, null, ".cookie"];
tealight(array);
// => [ <div#jar> ]
Copyright 2018 Fisssion LLC.
Open source under the MIT License.
FAQs
DOM queries that always return an array
The npm package tealight receives a total of 9,325 weekly downloads. As such, tealight popularity was classified as popular.
We found that tealight demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.