Comparing version 0.0.3 to 0.0.4
@@ -28,3 +28,3 @@ var file = require("./file"); | ||
fieldDescriptors.push({ | ||
name: fieldName(fields.toString("ascii", n, n + 11)), | ||
name: fieldName(fields.toString("utf-8", n, n + 11)), | ||
type: fields.toString("ascii", n + 11, n + 12), | ||
@@ -47,3 +47,3 @@ length: fields.readUInt8(n + 16) | ||
stream.emit("record", fieldDescriptors.map(function(field) { | ||
return fieldTypes[field.type](record.toString("ascii", i, i += field.length)); | ||
return fieldTypes[field.type](record.toString("utf-8", i, i += field.length)); | ||
})); | ||
@@ -50,0 +50,0 @@ read(recordBytes, readRecord); |
{ | ||
"name": "shapefile", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "An implementation of the shapefile (.shp) spatial data format.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -26,2 +26,64 @@ var vows = require("vows"), | ||
"The header of an empty dBASE file": { | ||
topic: function() { | ||
var callback = this.callback; | ||
dbf.readStream("./test/empty.dbf") | ||
.on("error", callback) | ||
.on("header", function(header) { callback(null, header); }); | ||
}, | ||
"has the expected values": function(header) { | ||
assert.deepEqual(header, { | ||
count: 0, | ||
date: new Date(Date.UTC(1995, 6, 26, 7)), | ||
version: 3, | ||
fields: [] | ||
}); | ||
} | ||
}, | ||
"The header of a dBASE file with unicode property names": { | ||
topic: function() { | ||
var callback = this.callback; | ||
dbf.readStream("./test/unicode-property.dbf") | ||
.on("error", callback) | ||
.on("header", function(header) { callback(null, header); }); | ||
}, | ||
"has the expected values": function(header) { | ||
assert.deepEqual(header, { | ||
count: 1, | ||
date: new Date(Date.UTC(1995, 6, 26, 7)), | ||
version: 3, | ||
fields: [{name: "☃", type: "C", length: 80}] | ||
}); | ||
} | ||
}, | ||
"The records of a dBASE file with unicode property names": { | ||
topic: function() { | ||
var callback = this.callback, records = []; | ||
dbf.readStream("./test/unicode-property.dbf") | ||
.on("error", callback) | ||
.on("record", function(record) { records.push(record); }) | ||
.on("end", function() { callback(null, records); }); | ||
}, | ||
"have the expected values": function(records) { | ||
assert.deepEqual(records, [ | ||
["ηελλο ςορλδ"] | ||
]); | ||
} | ||
}, | ||
"The records of an empty dBASE file": { | ||
topic: function() { | ||
var callback = this.callback, records = []; | ||
dbf.readStream("./test/empty.dbf") | ||
.on("error", callback) | ||
.on("record", function(record) { records.push(record); }) | ||
.on("end", function() { callback(null, records); }); | ||
}, | ||
"have the expected values": function(records) { | ||
assert.deepEqual(records, []); | ||
} | ||
}, | ||
"The records of a simple dBASE file": { | ||
@@ -28,0 +90,0 @@ topic: function() { |
@@ -26,2 +26,32 @@ var vows = require("vows"), | ||
"The header of an empty shapefile": { | ||
topic: function() { | ||
var callback = this.callback; | ||
shp.readStream("./test/empty.shp") | ||
.on("error", callback) | ||
.on("header", function(header) { callback(null, header); }); | ||
}, | ||
"has the expected values": function(header) { | ||
assert.deepEqual(header, { | ||
fileCode: 9994, | ||
version: 1000, | ||
shapeType: 3, | ||
box: [0, 0, 0, 0] | ||
}); | ||
} | ||
}, | ||
"The records of an empty shapefile": { | ||
topic: function() { | ||
var callback = this.callback, records = []; | ||
shp.readStream("./test/empty.shp") | ||
.on("error", callback) | ||
.on("record", function(record) { records.push(record); }) | ||
.on("end", function() { callback(null, records); }); | ||
}, | ||
"have the expected values": function(records) { | ||
assert.deepEqual(records, []); | ||
} | ||
}, | ||
"The records of a shapefile of points": { | ||
@@ -28,0 +58,0 @@ topic: function() { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38396
74
720
25