Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

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

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
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

mathematics

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