Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

fixy

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

fixy - npm Package Compare versions

Comparing version
1.0.0
to
1.1.0
+0
-0
.travis.yml

@@ -0,0 +0,0 @@ language: node_js

+7
-1

@@ -44,3 +44,9 @@ var internals = {};

}
r[i.name] = symbol + parseFloat(v.splice(i.width - percision, 0, ".")).toFixed(percision);
if(lodash.includes(v, ".")){
r[i.name] = symbol + parseFloat(v).toFixed(percision);
}
else{
r[i.name] = symbol + parseFloat(v.splice(i.width - percision, 0, ".")).toFixed(percision);
}
break;

@@ -47,0 +53,0 @@ case "int":

@@ -0,0 +0,0 @@ The MIT License (MIT)

.PHONY: test
test:
mocha --check-leaks --reporter spec
+1
-1
{
"name": "fixy",
"version": "1.0.0",
"version": "1.1.0",
"description": "A Fixed Width Input Parser",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -136,3 +136,3 @@ [![npm version](https://badge.fury.io/js/fixy.svg)](https://badge.fury.io/js/fixy)

- Float
- type : "float"
- type : "float" (decimal use allowed but not required)
- name (Required) | Name of the Column

@@ -139,0 +139,0 @@ - width (Required) | Length of Column

@@ -261,2 +261,121 @@ var fixy = require("../index");

});
it("should return fixed-width-input as array(object) if decimal within float", function(){
var test = fixy.parse({
map:[{
name: "Age",
width: 2,
start: 1,
type: "int"
},{
name: "Initial",
width: 3,
start: 3,
type: "string"
},{
name: "DateEntered",
width: 8,
start: 6,
type: "date",
inputformat: "YYYYMMDD",
outputformat: "YYYY-MM-DD"
},{
name: "IsBad",
width: 1,
start: 14,
type: "bool",
tVal: "Y",
fVal: "N"
},{
name: "Rating",
width: 4,
start: 15,
type: "float",
percision: 2
}],
options:{
fullwidth: 18,
skiplines: null
}
}, "30SJP20121231N9.20");
assert.deepEqual(test, [{
Age: 30,
Initial: "SJP",
DateEntered: "2012-12-31",
IsBad: false,
Rating: 9.20
}]);
});
it("should return fixed-width-input (multi-leveled) as array(object) if decimal within float", function(){
var test = fixy.parse({
map:[{
name: "Name",
width: 7,
start: 1,
type: "string",
level: "A"
},{
name: "Age",
width: 2,
start: 1,
type: "int",
level: "B"
},{
name: "Initial",
width: 3,
start: 3,
type: "string",
level: "B"
},{
name: "DateEntered",
width: 8,
start: 6,
type: "date",
inputformat: "YYYYMMDD",
outputformat: "YYYY-MM-DD",
level: "B"
},{
name: "IsBad",
width: 1,
start: 14,
type: "bool",
tVal: "Y",
fVal: "N",
level: "B"
},{
name: "Rating",
width: 4,
start: 15,
type: "float",
percision: 2,
level: "B"
}],
options:{
skiplines: null,
levels: {
"A": {
nickname: "A",
start: 0,
end: 0,
fullwidth: 7
},
"B": {
nickname: "B",
start: 1,
end: 2,
fullwidth: 18
}
}
}
}, "Steve \n30SJP20121231N9.20");
assert.deepEqual(test, {
A: [{ Name: "Steve" }],
B: [{
Age: 30,
Initial: "SJP",
DateEntered: "2012-12-31",
IsBad: false,
Rating: 9.20
}]
});
});
});

@@ -263,0 +382,0 @@ describe("#unparse()", function(){

Sorry, the diff of this file is not supported yet