Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
The quadbin-js
is a TypeScript library for working with the Quadbin spatial index.
npm install quadbin
import {cellToParent, getResolution, hexToBigInt} from 'quadbin';
cellToParent(5210915457518796799n) // => 5206425052030959615n
getResolution(hexToBigInt('4830ffffffffffff')) // => 3
Note: we still need to create the npm module
A Quadbin index is a 64-bit integer. This library uses BigInt as a data type to represent quadbin indices, both as parameters and return values for functions.
When working with quadbin indices in other contexts (e.g. passing as a parameter in a URL or serializing as JSON), it is more appropriate to encode the index as a hexidecimal string. The library provides the bigIntToHex()
& hexToBigInt()
to facilitate this conversion.
function bigIntToHex(index: bigint): string
Encodes an index into a string, suitable for use in JSON.
function hexToBigInt(hex: string): bigint
Decodes an string into an index. Inverse of bigIntToHex()
.
function getResolution(quadbin: bigint): bigint
Calculates the resolution of a quadbin cell.
function cellToParent(quadbin: bigint): bigint
Calculates the parent cell.
function tileToCell(tile: {x: number, y: number, z: number}): bigint
Converts a xyz tile into a quadbin cell.
function cellToTile(quadbin: bigint): Tile
Converts quadbin cell into a xyz tile.
FAQs
Utility functions for working with Quadbins
The npm package quadbin receives a total of 62,257 weekly downloads. As such, quadbin popularity was classified as popular.
We found that quadbin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.