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

ascii-grid

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ascii-grid - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

src/get-data-length.js

11

package.json
{
"name": "ascii-grid",
"version": "1.3.1",
"version": "1.3.2",
"description": "Identify and Read an ARC/INFO ASCII Grid",

@@ -13,7 +13,8 @@ "main": "src/index.js",

"src/for-each-ascii-grid-point.js",
"src/iter-ascii-grid-point.js"
"src/iter-ascii-grid-point.js",
"src/get-data-length.js"
],
"scripts": {
"format": "prettier --arrow-parens=avoid --print-width=160 --trailing-comma=none --write test.js src/*.js",
"test": "node test.js"
"format": "npx prettier --arrow-parens=avoid --print-width=160 --trailing-comma=none --write test/*.js src/*.js",
"test": "for f in ./test/*; do node $f; done"
},

@@ -44,4 +45,4 @@ "repository": {

"fast-min": "0.0.0",
"find-and-read": "^1.0.2",
"flug": "^1.1.0",
"prettier": "^2.2.1",
"toab": "^1.0.2"

@@ -48,0 +49,0 @@ },

const getByte = require("get-byte");
const getDataLength = require("./get-data-length");
const parseAsciiGridMetaData = require("./parse-ascii-grid-meta");

@@ -32,19 +33,23 @@

if (end_column < start_column) throw new Error("[ascii-grid/for-each-point] end_column must be greater than or equal to start_column");
if (end_row < start_row) throw new Error("[ascii-grid/for-each-point] end_row must be greater than or equal to start_row");
if (end_column < start_column) throw new Error("[ascii-grid/iter-each-point] end_column must be greater than or equal to start_column");
if (end_row < start_row) throw new Error("[ascii-grid/iter-each-point] end_row must be greater than or equal to start_row");
const read_length = Math.min(data.length, max_read_length);
if (debug_level >= 1) console.log("[ascii-grid/for-each-point] read_length:", read_length);
if (!data) throw new Error("[ascii-grid/iter-each-point] can't iterate without data!");
const data_length = getDataLength({ data });
const read_length = Math.min(data_length, max_read_length);
if (debug_level >= 1) console.log("[ascii-grid/iter-each-point] read_length:", read_length);
if (!meta) meta = parseAsciiGridMetaData({ cache, data, max_read_length });
if (debug_level >= 1) console.log("[ascii-grid/for-each-point] meta:", meta);
if (debug_level >= 1) console.log("[ascii-grid/iter-each-point] meta:", meta);
if (!end_row) end_row = meta.nrows - 1;
if (debug_level >= 1) console.log("[ascii-grid/for-each-point] end_row:", end_row);
if (debug_level >= 1) console.log("[ascii-grid/iter-each-point] end_row:", end_row);
if (!end_column) end_column = meta.ncols - 1;
if (debug_level >= 1) console.log("[ascii-grid/for-each-point] end_column:", end_column);
if (debug_level >= 1) console.log("[ascii-grid/iter-each-point] end_column:", end_column);
let i = start_of_data_byte !== undefined ? start_of_data_byte : meta.last_metadata_byte + 1;
if (debug_level >= 1) console.log("[ascii-grid/for-each-point] i:", i);
if (debug_level >= 1) console.log("[ascii-grid/iter-each-point] i:", i);

@@ -67,3 +72,3 @@ // index of current row

if (debug_level >= 2) console.log("[ascii-grid/for-each-point] i, byte:", [i, String.fromCharCode(byte)]);
if (debug_level >= 2) console.log("[ascii-grid/iter-each-point] i, byte:", [i, String.fromCharCode(byte)]);

@@ -89,3 +94,3 @@ if (byte === SPACE_CHARCODE || byte === NEWLINE_CHARCODE || byte === NULL_CHARCODE) {

} else {
if (debug_level >= 2) console.log("[ascii-grid/for-each-point] skipping value at [", r, "][", c, "]");
if (debug_level >= 2) console.log("[ascii-grid/iter-each-point] skipping value at [", r, "][", c, "]");
}

@@ -112,3 +117,3 @@

} else if (debug_level >= 2) {
console.error("[ascii-grid/for-each-point]: unknown byte", [byte]);
console.error("[ascii-grid/iter-each-point]: unknown byte", [byte]);
}

@@ -115,0 +120,0 @@

const getByte = require("get-byte");
const getDataLength = require("./get-data-length");

@@ -16,3 +17,5 @@ const cached = new Map();

const read_length = Math.min(data.length, max_read_length);
const data_length = getDataLength({ data });
const read_length = Math.min(data_length, max_read_length);
for (i = 0; i < read_length; i++) {

@@ -19,0 +22,0 @@ const byte = getByte(data, i);

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