
Security News
npm Introduces minimumReleaseAge and Bulk OIDC Configuration
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.
Fixy is an npm module for parsing fixed formatted strings/files and unparsing an Array of Objects.
npm install fixy --save
var fixy = fixy.parse({
map:[{
name: "Age",
width: 2,
start: 1,
type: "int"
},{
name: "Initial",
width: 3,
start: 3,
type: "string"
}],
options:{
fullwidth: 5,
skiplines: null,
format: "csv"
}
}, "21ABC\n22DEF");
var fixy = fixy.parse({
map:[{
name: "Name",
width: 7,
start: 1,
type: "string",
level: "A"
},{
name: "Age",
width: 2,
start: 1,
type: "int",
level: "B"
}],
options:{
skiplines: null,
levels: {
"A": {
nickname: "A",
start: 0,
end: 0,
fullwidth: 7
},
"B": {
nickname: "B",
start: 1,
end: 2,
fullwidth: 2
}
}
}
}, "Steve \n30");
var fixy = fixy.unparse([{
name: "Age",
width: 7,
padding_position: "end",
padding_symbol: "#"
},{
name: "Initial",
width: 4,
padding_position: "end",
padding_symbol: "@"
}], [{
Age: 30,
Initial: "SJP"
},{
Age: 20,
Initial: "CCS"
}]);
let noDecimal = (value, row) => {
return `${value}`.replace(/\./, '');
}
var fixy = fixy.unparse([{
name: "Name",
width: 10,
padding_position: "start",
padding_symbol: " "
},{
name: "Balance",
width: 10,
padding_position: "start",
padding_symbol: "0",
preprocess: noDecimal
}], [{
Name: "Jenny",
Balance: 86753.09
}]);
const useOther = (value, row) => {
return `${value} ${row.Currency}`;
}
var fixy = fixy.unparse([{
name: "Name",
width: 10,
padding_position: "start",
padding_symbol: " "
},{
name: "Balance",
width: 10,
padding_position: "start",
padding_symbol: "0",
preprocess: useOther
}], [{
Name: "Jenny",
Balance: 86753.09,
Currency: 'CAD'
}]);
var fixy = fixy.unparse([{
name: "Name",
width: 7,
padding_position: "end",
level: "A",
},{
name: "Age",
width: 3,
padding_position: "end",
level: "B"
},{
name: "Initial",
width: 4,
padding_position: "end",
level: "B"
}], {
A: [{ Name: "Mike" }],
B: [{
Age: 30,
Initial: "MAS"
},{
Age: 20,
Initial: "SAM"
}]
}, ["A", "B"]);
A map [array of objects] of the column names, width, starting point, type of value, extra type settings.
skiplines = optional array of rows to be skipped. May be left null
levels = level map object (see example)
"LEVELNAME": { nickname: "NameInMap", start: 0, //row start, zero based end: 0, //row end, zero based fullwidth: 7 // row width per level }
A map [array of objects] of the column names, width, starting point, type of value, extra type settings.
{
A: [{ Name: "Mike" }],
B: [{
Age: 30,
Initial: "MSP"
}]
}
FAQs
A Fixed Width Input Parser
We found that fixy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.

Security News
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.

Research
/Security News
Socket uncovered four malicious NuGet packages targeting ASP.NET apps, using a typosquatted dropper and localhost proxy to steal Identity data and backdoor apps.