New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

btwn

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btwn - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.travis.yml

4

index.js

@@ -1,4 +0,4 @@

Number.prototype.btwn = function(min, max, closed = true) {
Number.prototype.btwn = function(min, max, inclusive = true) {
var n = this.valueOf();
if (closed) {
if (inclusive) {
return n >= min && n <= max;

@@ -5,0 +5,0 @@ } else {

{
"name": "btwn",
"version": "1.0.0",
"version": "1.0.1",
"description": "Check if a number is in your min-max bounds.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,3 @@

# btwn
# btwn [![npm](https://img.shields.io/npm/v/btwn.svg)]() [![npm](https://img.shields.io/npm/dt/btwn.svg)]() [![Build Status](https://travis-ci.org/moriczgergo/btwn.svg?branch=master)](https://travis-ci.org/moriczgergo/btwn)
Check if a number is in your min-max bounds.

@@ -20,3 +21,3 @@

```
```js
require('btwn');

@@ -35,10 +36,14 @@

### Number.btwn(min, max, [closed])
### Number.btwn(min, max, [inclusive])
* min - Minimum value.
* max - Maximum value.
* closed - Are the bounds closed or not. If this is true, min and max are inclusive. (Default: true)
* inclusive - Are min and max inclusive. (Default: true)
## To-do
* [ ] Integrate into dates
## Tests
Run `mocha`.

@@ -5,11 +5,11 @@ var assert = require('assert');

var i = 17;
it("checks the number with closed bounds", function() {
it("checks the number with inclusive bounds", function() {
var x = i.btwn(1, 17);
assert.equal(x, true, 'i.btwn(1,17) is true (i=17)');
});
it("checks the number with open bounds", function() {
it("checks the number with exclusive bounds", function() {
var x = i.btwn(1, 17, false);
assert.equal(x, false, 'i.btwn(1,17, false) is false (i=17)');
});
it("throws error if min and max are the same and using open bounds", function() {
it("throws error if min and max are the same and using exclusive bounds", function() {
assert.throws(function() {

@@ -16,0 +16,0 @@ var x = i.btwn(17,17,false);

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