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

advlib

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

advlib - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

25

lib/advlib.js

@@ -16,5 +16,7 @@ /**

* priority.
* @param {Array} interpreters The optional interpreter(s) to use, in order of
* priority.
* @return {Object} The processed packets as JSON.
*/
function process(data, processors) {
function process(data, processors, interpreters) {
if(!data || !Array.isArray(processors) || (processors.length < 1)) {

@@ -42,2 +44,4 @@ return null;

if(isSomeValidPacket) {
invokeInterpreters(processedPackets, interpreters);
return processedPackets;

@@ -77,2 +81,21 @@ }

/**
* Interpret processed packet to add/refine semantically meaningful information.
* @param {Object} processedPacket The processed packet as JSON.
* @param {Array} interpreters The packet interpreter(s) to use, in order of
* priority.
*/
function invokeInterpreters(processedPacket, interpreters) {
if(Array.isArray(interpreters)) {
for(const interpreter of interpreters) {
let isValidInterpreter = utils.hasFunction(interpreter, 'interpret');
if(isValidInterpreter) {
interpreter.interpret(processedPacket);
}
}
}
}
/**
* Merge the properties of the source object into the target object, handling

@@ -79,0 +102,0 @@ * duplicate properties appropriately.

2

package.json

@@ -18,3 +18,3 @@ {

],
"version": "1.0.1",
"version": "1.1.0",
"engines": {

@@ -21,0 +21,0 @@ "node": ">=6.0.0"

advlib
======
Library for wireless advertising packet decoding. __advlib__ is protocol-agnostic and currently supports the following processor modules:
Library for wireless advertising packet decoding. __advlib__ is protocol-agnostic and currently supports the following _processor_ modules:
- [advlib-ble](https://github.com/reelyactive/advlib-ble) for Bluetooth Low Energy
and the following _interpreter_ modules:
- [advlib-interoperable](https://github.com/reelyactive/advlib-interoperable) for [InteroperaBLE identifiers](https://reelyactive.github.io/diy/best-practices-ble-identifiers/#part04).
The _purpose_ of __advlib__ is to extract all potentially relevant information from ambient data packets and to organise this information in a consistent manner, regardless of the radio protocol.

@@ -23,3 +26,3 @@

For example, process several raw packets received from a beacon by selecting Bluetooth Low Energy as the processor ([advlib-ble](https://github.com/reelyactive/advlib-ble)) and including any relevant processing libraries (don't forget to first install these using npm).
For example, process several raw packets received from a beacon by selecting Bluetooth Low Energy as the processor ([advlib-ble](https://github.com/reelyactive/advlib-ble)) and including any relevant processor and interpreter libraries (don't forget to first install these using npm).

@@ -35,2 +38,3 @@ ```javascript

];
const INTERPRETERS = [ require('advlib-interoperable') ];

@@ -42,3 +46,3 @@ let packets = [

];
let processedPackets = advlib.process(packets, PROCESSORS);
let processedPackets = advlib.process(packets, PROCESSORS, INTERPRETERS);
console.log(processedPackets);

@@ -45,0 +49,0 @@ ```

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