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

json-edm-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-edm-parser

This is a JSON streaming parser for node.js. It will handle the Entity Data Model (EDM) types to be compatitable with odata.

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
186K
decreased by-3.45%
Maintainers
1
Weekly downloads
 
Created
Source

json-edm-parser

Build Status

This is a JSON streaming parser for node.js. It will handle the Entity Data Model (EDM) types to be compatitable with odata.

When you use JSON to represent an odata entity, a number without a decimal point in the JSON will have Edm.Int32 by default and will have Edm.Double if there are non-zero digits after the decimal point. However, if the value is set to *.0, Most JSON parsers will take it as an integer. To keep the type information, this parser will add an additional member "@odata.type": "Edm.Double" to the object.

Install

npm install json-edm-parser

Usage

var Parser = require('json-edm-parser');

var p = new Parser();
p.write('{ "doubleIntNumber": 12.00,');
p.write('"doubleNormalNumber": 1.2,');
p.write('"doubleLargeNumber": 12345678901234546789.0000000000000000000000000001,');
p.write('"int64LargeNumber": 12345678901234567890123456789}');

/*
* You will get 
*  { 'doubleIntNumber@odata.type': 'Edm.Double',
*    doubleIntNumber: '12.00',
*    doubleNormalNumber: 1.2,
*    'doubleLargeNumber@odata.type': 'Edm.Double',
*    doubleLargeNumber: '12345678901234546789.0000000000000000000000000001',
*    int64LargeNumber: '12345678901234567890123456789' }
*/
p.onValue = function (value) {
  // Deal with the value
};

Keywords

FAQs

Package last updated on 12 May 2016

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