🚀 Socket Launch Week 🚀 Day 2: Introducing Repository Labels and Security Policies.Learn More
Socket
Sign inDemoInstall
Socket

pnnl-buildingid

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pnnl-buildingid

Unique Building Identification (UBID) for JavaScript

1.0.3
latest
Source
npm
Version published
Weekly downloads
749
-33.42%
Maintainers
1
Weekly downloads
 
Created
Source

Unique Building Identification (UBID)

Website: https://buildingid.pnnl.gov/

Documentation

Install

To complete this guide, npm is required.

Install the pnnl-buildingid package:

npm install pnnl-buildingid

Uninstall

Use npm to uninstall the pnnl-buildingid package.

npm uninstall pnnl-buildingid

Usage

The pnnl-buildingid package supports one usage:

  • Application programming interface (API)

The API

UBID codecs are encapsulated in separate modules:

  • UniqueBuildingIdentification.v3 (format: "C-n-e-s-w")

Modules export the same API:

  • decode(string) ~> UniqueBuildingIdentification.CodeArea
  • encode(number, number, number, number, number, number, number) ~> string
  • encodeCodeArea(UniqueBuildingIdentification.CodeArea) ~> string
  • isValid(string) ~> boolean

In the following example, a UBID code is decoded and then re-encoded:

// Use the "C-n-e-s-w" format for UBID codes.
const UniqueBuildingIdentification = require('pnnl-buildingid');

// Initialize UBID code.
const code = '849VQJH6+95J-51-58-42-50';
console.log(code);

// Decode the UBID code.
const codeArea = UniqueBuildingIdentification.v3.decode(code);
console.log(codeArea);

// Resize the resulting UBID code area.
//
// The effect of this operation is that the height and width of the UBID code
// area are reduced by half an OLC code area.
const newCodeArea = codeArea.resize();
console.log(newCodeArea);

// Encode the new UBID code area.
const newCode = UniqueBuildingIdentification.v3.encodeCodeArea(newCodeArea);
console.log(newCode);

// Test that the new UBID code matches the original.
console.log(code === newCode);

License

The package is available as open source under the terms of The 2-Clause BSD License.

Contributions

Contributions are accepted on GitHub via the fork and pull request workflow. See here for more information.

FAQs

Package last updated on 03 Dec 2018

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