Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rdpcrystal-edi-library

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdpcrystal-edi-library

ASCII X12 EDI Library

  • 1.0.1
  • npm
  • Socket score

Version published
Weekly downloads
475
decreased by-83.15%
Maintainers
1
Weekly downloads
 
Created
Source

RDPCrystal EDI Library

RDPCrystal EDI Library is a NodeJS library that is used to Create, Parse, Load, Validate, View, Edit, Split, Join and Scrub EDI data. RDPCrystal EDI Library is located at rdpcrystal.com

Installation

npm i rdpcrystal-edi-library

Usage

Validate an EDI File

const fs = require('fs');
const edi = require('RDPCrystalEDILibrary').RDPCrystalEDILibrary;

//Create a new validator
let validator = new edi.EDIValidator();

//While validating also load the data in memory
validator.LoadValidatedData = true;

//Load a 5010 270 validation rules
let validationRules = fs.readFileSync('Rules_5010_270_005010X279A1.Rules').toString();

validator.EDIRulesFileData = validationRules;

//Set the EDI data to validate and load.  This can also be read in from a file
validator.EDIDataString = "ISA*00*..........*01*SECRET....*ZZ*SUBMITTERS.ID..*ZZ*RECEIVERS.ID...*030101*1253*^*00501*000000905*1*T*:~" +
    "GS*Hk*SENDER CODE*RECEIVERCODE*19991231*0802*1*X*005010X279A1~" +
    "ST*271*1234*005010X279A1~" +
    "BHT*0022*13*10001234*20060501*1319~" +
    "HL*1**20*1~" +
    "NM1*PR*2*ABC COMPANY*****PI*842610001~" +
    "HL*2*1*21*1~" +
    "NM1*1P*2*BONE AND JOINT CLINIC*****SV*2000035~" +
    "HL*3*2*22*0~" +
    "TRN*1*93175-012547*9877281234~" +
    "NM1*IL*1*SMITH*ROBERT****MI*11122333301~" +
    "DMG*D8*19430519~" +
    "DTP*291*D8*20060501~" +
    "EQ*30~" +
    "SE*13*1234~" +
    "GE*1*1~" +
    "IEA*1*000000905~";

console.log("Validating 5010 271 EDI Files");
validator.validate();

console.log("Errors Found");
//Get all errors from the EDI data
for (let i = 0; i < validator.Errors.Count; i++) {
    let error = validator.Errors.getItem(i);

    console.log(
        {
            Type: "Error",
            Line: error.LineNumber,
            Transaction: "",
            SnipLevel: error.SnipLevel,  //SnipTestLevel Enum
            Message: error.Message, //EDIValidationMessage Enum
            Loop: error.Loop,
            Segment: error.Segment,
            Element: error.ElementOrdinal,
            Composite: error.CompositeElementOrdinal,
            Description: error.Description,
            Ordinal: error.SegmentOrdinal
        });
}

License

http://www.rdpcrystal.com/free-trial/

Keywords

FAQs

Package last updated on 31 Aug 2019

Did you know?

Socket

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.

Install

Related posts

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