Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@amritk/yaml

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

@amritk/yaml - npm Package Compare versions

Comparing version
0.2.0
to
0.2.1
+21
-7
dist/resolve-scalar.js

@@ -84,6 +84,9 @@ /**

return Number.parseInt(text, 10);
// `parseInt` already honours a leading sign, so stripping only the `0x`/`0o`
// base marker leaves e.g. `-10` for it to parse as -16. An extra sign multiply
// here would double-negate and flip `-0x10` back to +16.
if (INT_HEX.test(text))
return Number.parseInt(text.replace('0x', ''), 16) * (text[0] === '-' ? -1 : 1);
return Number.parseInt(text.replace('0x', ''), 16);
if (INT_OCT.test(text))
return Number.parseInt(text.replace('0o', ''), 8) * (text[0] === '-' ? -1 : 1);
return Number.parseInt(text.replace('0o', ''), 8);
if (FLOAT.test(text))

@@ -113,2 +116,4 @@ return Number.parseFloat(text);

};
const lstrip = (s) => s.replace(/^[ \t]+/, '');
const rstrip = (s) => s.replace(/[ \t]+$/, '');
/**

@@ -127,4 +132,2 @@ * Folds the line breaks of a multi-line flow scalar, per the YAML flow folding

*/
const lstrip = (s) => s.replace(/^[ \t]+/, '');
const rstrip = (s) => s.replace(/[ \t]+$/, '');
const foldLines = (text) => {

@@ -195,5 +198,16 @@ const lines = text.split('\n');

const hex = source.slice(i + 2, i + 2 + len);
const code = Number.parseInt(hex, 16);
out += Number.isNaN(code) ? next : String.fromCodePoint(code);
i += 2 + len;
// The escape is only valid with exactly `len` hex digits naming a real Unicode
// code point. A short/non-hex run (`\xZZ`) or an out-of-range value (`\UFFFFFFFF`,
// which would make `String.fromCodePoint` throw) is treated as a literal escape
// letter, consuming just `\x` so the trailing characters are preserved.
const valid = hex.length === len && /^[0-9a-fA-F]+$/.test(hex);
const code = valid ? Number.parseInt(hex, 16) : Number.NaN;
if (code <= 0x10ffff && !Number.isNaN(code)) {
out += String.fromCodePoint(code);
i += 2 + len;
}
else {
out += next;
i += 2;
}
continue;

@@ -200,0 +214,0 @@ }

{
"name": "@amritk/yaml",
"version": "0.2.0",
"version": "0.2.1",
"description": "A fast, featherweight, zero-dependency YAML parser for OpenAPI tooling — with exact source positions (line:column) on every node.",

@@ -5,0 +5,0 @@ "module": "./dist/index.js",