New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sort-nodes

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sort-nodes

The packege to sort arrays of DOM nodes according to the HTML tree order

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

sort-nodes

The packege to sort arrays of DOM nodes according to the HTML tree order. Based on this code.

Installation

npm i sort-nodes

sortNodes

The sortNodes function returns a new array sorted according to the HTML tree order. This function does not change an original array. You can pass true as the second argument if you need a reverse order.

import { sortNodes } from "sort-nodes";

const sortedNodes = sortNodes(nodes);

// reverse order
const reversed = sortNodes(nodes, true);

compareOrder

The compareOrder function compares order of nodes in the HTML tree. It can be used in the sort method of arrays.

import { compareOrder } from "sort-nodes";

nodes.sort(compareOrder);

reverseCompareOrder

This function is similar to compareOrder but it compares nodes in reverse order.

import { reverseCompareOrder } from "sort-nodes";

nodes.sort(reverseCompareOrder);

Keywords

html

FAQs

Package last updated on 22 Sep 2019

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