Socket
Socket
Sign inDemoInstall

math-interval-formatter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-interval-formatter

Format math interval object to string


Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Math interval formatter Build Status Dependency Status

Parse math interval object to string.

Install

$ npm install --save math-interval-formatter

Usage

format(interval, options)

var format = require('math-interval-formatter');

var interval = {
	from: {
		value: -Math.PI,
		included: true
	},
	to: {
		value: Infinity,
		included: false
	}
};

format(interval);
//=> '[-3.142,Infinity)'

format(interval, {
	format: 'pretty',
	infiniteEndpoints: 'math',
	numberFormat: '+0.0000'
});
//=> '[3.1416, +∞)'

See tests for more details.

Available options

  • format

    • 'default' //=> '[-10,10]'
    • 'pretty' //=> '[-10, 10]'
    • 'interval' //=> '[-10..10]'
  • excludedEndpoints

    • 'parenthesis' //=> '(-10,10)'
    • 'reversed' //=> ']-10,10['
  • infiniteEndpoints

    • 'default' //=> '[0,Infinity)'
    • 'none' //=> '[0,)'
    • 'math' //=> '[0,∞)'
  • numberFormat // default '0.[000]'

License

MIT © Dmitry Semigradsky

Keywords

FAQs

Package last updated on 24 Feb 2015

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