New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

table-sort-js

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table-sort-js - npm Package Compare versions

Comparing version 1.20.0 to 1.21.0

2

package.json
{
"name": "table-sort-js",
"version": "1.20.0",
"version": "1.21.0",
"description": "A JavaScript client-side HTML table sorting library with no dependencies required.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -24,9 +24,9 @@ ![npm version](https://img.shields.io/npm/v/table-sort-js)

```javascript
<script src="https://cdn.jsdelivr.net/npm/table-sort-js/table-sort.js"></script>
<script src="https://cdn.jsdelivr.net/npm/table-sort-js/table-sort.min.js"></script>
```
Or Minified (smaller size, but harder to debug!):
Or non-minified version (larger size, but easier to debug!):
```javascript
<script src="https://cdn.jsdelivr.net/npm/table-sort-js/table-sort.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/table-sort-js/table-sort.js"></script>
```

@@ -76,3 +76,4 @@

| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| "numeric-sort" | Sorts numbers including decimals - Positive, Negative (in both minus and parenthesis representations) |
| "numeric-sort" | Sorts numbers including decimals - Positive, Negative (in both minus and parenthesis representations). |
| | Supports common currencies e.g ($£€¥) and percentage signs e.g (0.39%) |
| "dates-dmy-sort" | Sorts dates in dd/mm/yyyy format. e.g (18/10/1995). Can use "/" or "-" as separator. |

@@ -79,0 +80,0 @@ | "dates-ymd-sort" | Sorts dates in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) yyyy/mm/dd format. e.g (2021/10/28). Use "/" or "-" as separator. |

@@ -67,5 +67,5 @@ /*

const ymdRegex = /^(\d\d\d\d)[/-](\d\d?)[/-](\d\d?)/;
// const numericRegex = /^(?:\(\d+(?:\.\d+)?\)|-?\d+(?:\.\d+)?)$/; doesn't handle commas
const numericRegex =
/^-?(?:\d{1,3}(?:[',]\d{3})*(?:\.\d+)?|\d+(?:\.\d+)?(?:[',]\d{3})*?)$/;
/^-?(?:[$£€¥₩₽₺₣฿₿Ξξ¤¿\u20A1\uFFE0]\d{1,3}(?:[',]\d{3})*(?:\.\d+)?|\d+(?:\.\d+)?(?:[',]\d{3})*?)(?:%?)$/;
const inferableClasses = {

@@ -95,7 +95,8 @@ runtime: { regexp: runtimeRegex, class: "runtime-sort", count: 0 },

let classRegexp = inferableClasses[key].regexp;
if (tableColumn.innerText !== undefined) {
if (tableColumn.innerText.match(classRegexp)) {
foundMatch = true;
inferableClasses[key].count++;
}
let columnOfTd = testingTableSortJS
? tableColumn.textContent
: tableColumn.innerText;
if (columnOfTd !== undefined && columnOfTd.match(classRegexp)) {
foundMatch = true;
inferableClasses[key].count++;
}

@@ -346,3 +347,3 @@ if (inferableClasses[key].count >= threshold) {

str = str.slice(0, str.indexOf("#"));
if (str.match(/^\((\d+(?:\.\d+)?)\)$/)) {
if (str.match(/^\(-?(\d+(?:\.\d+)?)\)$/)) {
num = -1 * Number(str.slice(1, -1));

@@ -364,7 +365,9 @@ } else {

function handleNumbers(str1, str2) {
let num1, num2;
str1 = str1.replaceAll(",", "");
str2 = str2.replaceAll(",", "");
num1 = parseNumberFromString(str1);
num2 = parseNumberFromString(str2);
const matchCurrencyCommaAndPercent = /[$£€¥₩₽₺₣฿₿Ξξ¤¿\u20A1\uFFE0,% ]/g;
str1 = str1.replace(matchCurrencyCommaAndPercent, "");
str2 = str2.replace(matchCurrencyCommaAndPercent, "");
const [num1, num2] = [
parseNumberFromString(str1),
parseNumberFromString(str2),
];

@@ -371,0 +374,0 @@ if (!isNaN(num1) && !isNaN(num2)) {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc