🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

cparse

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cparse - npm Package Compare versions

Comparing version

to
1.0.3

@@ -5,2 +5,4 @@ # Changelog

### [1.0.3](https://github.com/wind2sing/cparse/compare/v1.0.0...v1.0.3) (2020-08-06)
## 1.0.0 (2020-08-06)

@@ -7,0 +9,0 @@

{
"name": "cparse",
"version": "1.0.1",
"version": "1.0.3",
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "jest"
},
"dependencies": {
"cheerio": "^1.0.0-rc.3",
"debug": "^4.1.1"
"cheerio": "^1.0.0-rc.3"
},
"homepage": "https://github.com/wind2sing/cparse"
"keywords": [
"parse",
"cheerio"
],
"homepage": "https://github.com/wind2sing/cparse#readme",
"repository": {
"type": "git",
"url": "https://github.com/wind2sing/cparse.git"
},
"devDependencies": {
"jest": "^26.2.2"
}
}

@@ -1,2 +0,4 @@

const log = require("debug")("crawlx-filters");
const debug = function () {
console.error(...arguments);
};

@@ -12,14 +14,9 @@ module.exports = {

},
bool: v => Boolean(v),
trim: value => (typeof value === "string" ? value.trim() : value),
bool: (v) => Boolean(v),
trim: (value) => (typeof value === "string" ? value.trim() : value),
slice: (value, start, end) => value.slice(start, end),
reverse: value =>
value
.split("")
.reverse()
.join(""),
reverse: (value) => value.split("").reverse().join(""),
date: (v, append) => {
if (append && typeof v === "string") v += append;
let r = new Date(v);
if (isNaN(r)) {

@@ -34,6 +31,5 @@ let m = /(\d{4})\D*(\d{2})\D*(\d{2})\D*(\d{2}:\d{2}(:\d{2})?)?/.exec(v);

size: (() => {
let debug = log.extend("parseSize");
let validAmount = n => !isNaN(parseFloat(n)) && isFinite(n);
let parsableUnit = u => u.match(/\D*/).pop() === u;
return function(input) {
let validAmount = (n) => !isNaN(parseFloat(n)) && isFinite(n);
let parsableUnit = (u) => u.match(/\D*/).pop() === u;
return function (input) {
let parsed = input.toString().match(/.*?([0-9\.,]+)(?:\s*)?(\w*).*/);

@@ -46,3 +42,3 @@ if (!parsed) {

let unit = parsed[2];
let validUnit = function(sourceUnit) {
let validUnit = function (sourceUnit) {
return sourceUnit === unit;

@@ -70,3 +66,3 @@ };

[["Eb"], 1.441e17],
[["e", "E", "eb", "EB", "EiB", "Ei", "ei"], Math.pow(1024, 6)]
[["e", "E", "eb", "EB", "EiB", "Ei", "ei"], Math.pow(1024, 6)],
];

@@ -84,3 +80,3 @@ for (let i = 0; i < increments.length; i++) {

};
})()
})(),
};