Range data type parser and serializer for PostgreSQL
Installations
npm install postgres-range
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
20.11.0
NPM Version
10.2.4
Score
99.8
Supply Chain
93.6
Quality
75.6
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
martianboy
Download Statistics
Total Downloads
133,704,433
Last Day
535,411
Last Week
3,352,265
Last Month
13,260,474
Last Year
102,577,780
GitHub Statistics
MIT License
8 Stars
28 Commits
7 Forks
2 Watchers
1 Branches
2 Contributors
Updated on Aug 08, 2024
Bundle Size
2.92 kB
Minified
1.19 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.4
Package Id
postgres-range@1.1.4
Unpacked Size
9.86 kB
Size
3.35 kB
File Count
5
NPM Version
10.2.4
Node Version
20.11.0
Published on
Jan 29, 2024
Total Downloads
Cumulative downloads
Total Downloads
133,704,433
Last Day
0.8%
535,411
Compared to previous day
Last Week
5.4%
3,352,265
Compared to previous week
Last Month
49.9%
13,260,474
Compared to previous month
Last Year
242.5%
102,577,780
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
5
postgres-range 
Parse postgres range columns
Install
npm install --save postgres-range
Usage
1const range = require('postgres-range') 2 3const rng = range.parse('[0,5)', (value) => parseInt(value, 10)) 4rng.isBounded() 5// => true 6rng.isLowerBoundClosed() 7// => true 8rng.isUpperBoundClosed() 9// => false 10rng.hasLowerBound() 11// => true 12rng.hasUpperBound() 13// => true 14 15rng.containsPoint(4) 16// => true 17rng.containsRange(range.parse('[1,2]', x => parseInt(x))) 18// => true 19 20range.parse('empty').isEmpty() 21// => true 22 23range.serialize(new range.Range(0, 5)) 24// => '(0,5)' 25range.serialize(new range.Range(0, 5, range.RANGE_LB_INC | RANGE_UB_INC)) 26// => '[0,5]'
API
parse(input, [transform])
-> Range
input
Required
Type: string
A Postgres range string.
transform
Type: function
Default: identity
A function that transforms non-null bounds of the range.
serialize(range, [format])
-> string
range
Required
Type: Range
A Range
object.
format
Type: function
Default: identity
A function that formats non-null bounds of the range.
License
MIT © Abbas Mashayekh

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/martianboy/postgres-range/test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/martianboy/postgres-range/test.yml/main?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
9 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g
- Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6
- Warn: Project is vulnerable to: GHSA-9crc-q9x8-hgqq
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/26 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Score
2.8
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More