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

ltgt

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ltgt - npm Package Compare versions

Comparing version 2.1.3 to 2.2.0

32

index.js

@@ -47,5 +47,5 @@

var lowerBound = exports.lowerBound = function (range) {
var lowerBound = exports.lowerBound = function (range, def) {
var k = lowerBoundKey(range)
return k && range[k]
return k ? range[k] : def
}

@@ -82,7 +82,28 @@

var upperBound = exports.upperBound = function (range) {
var upperBound = exports.upperBound = function (range, def) {
var k = upperBoundKey(range)
return k && range[k]
return k ? range[k] : def
}
exports.start = function (range, def) {
return range.reverse ? upperBound(range, def) : lowerBound(range, def)
}
exports.end = function (range, def) {
return range.reverse ? lowerBound(range, def) : upperBound(range, def)
}
exports.startInclusive = function (range) {
return (
range.reverse
? upperBoundInclusive(range)
: lowerBoundInclusive(range)
)
}
exports.endInclusive = function (range) {
return (
range.reverse
? lowerBoundInclusive(range)
: upperBoundInclusive(range)
)
}
function id (e) { return e }

@@ -151,4 +172,1 @@

{
"name": "ltgt",
"description": "",
"version": "2.1.3",
"version": "2.2.0",
"homepage": "https://github.com/dominictarr/ltgt",

@@ -6,0 +6,0 @@ "repository": {

@@ -113,2 +113,22 @@ # ltgt

## ltgt.start(range, default)
The start of the range. This takes into account direction (reverse)
If a `start` is not provided, `default` is used.
## ltgt.end(range, default)
The end of the range. This takes into account direction (reverse)
If a `end` is not provided, `default` is used.
## ltgt.startInclusive(range)
returns true if the range should start at the exact value returned
by `start(range)` otherwise, it should skip one input.
## ltgt.endInclusive(range)
returns true if the range should include the exact value returned
by `end(range)` otherwise, it should end on that value.
## ltgt.toLtgt(range, _range, map, lowerBound, upperBound)

@@ -128,1 +148,5 @@

MIT

@@ -240,3 +240,34 @@ var tape = require('tape')

tape('start, end', function (t) {
// t.equal(ltgt.upperBound({start: 'b', reverse: true}), 'b')
// t.equal(ltgt.upperBoundInclusive({start: 'b', reverse: true}), true)
// t.equal(ltgt.upperBound({end: 'b', reverse: false}), 'b')
//
// t.equal(ltgt.lowerBound({start: 'b', reverse: true}), undefined)
// t.equal(ltgt.lowerBound({end: 'b', reverse: false}), undefined)
// t.equal(ltgt.upperBoundInclusive({start: 'b', reverse: true}), true)
// t.equal(ltgt.upperBoundInclusive({end: 'b', reverse: false}), true)
t.equal(ltgt.start({lt: 'b', reverse: true}), 'b')
t.equal(ltgt.start({lte: 'b', reverse: true}), 'b')
t.equal(ltgt.end({lt: 'b', reverse: true}, null), null)
t.equal(ltgt.end({lte: 'b', reverse: true}, null), null)
t.equal(ltgt.end({lt: 'b'}), 'b')
t.equal(ltgt.end({lte: 'b'}), 'b')
t.equal(ltgt.start({lt: 'b'}, undefined), undefined)
t.equal(ltgt.start({lte: 'b'}, undefined), undefined)
t.equal(ltgt.endInclusive({lt: 'b'}), false)
t.equal(ltgt.endInclusive({lte: 'b'}), true)
t.equal(ltgt.startInclusive({gt: 'b'}), false)
t.equal(ltgt.startInclusive({gte: 'b'}), true)
t.end()
})
var strings = ['00', '01', '02']

@@ -351,7 +382,1 @@ var sranges = [

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