Socket
Socket
Sign inDemoInstall

legoino-util

Package Overview
Dependencies
3
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    legoino-util

Create and parse compact logs.


Version published
Weekly downloads
18
increased by1700%
Maintainers
7
Install size
266 kB
Created
Weekly downloads
 

Changelog

Source

2.0.4 (2022-11-23)

Bug Fixes

  • update legoino-devide-information (adcb8bd)

Readme

Source

legoino-util

NPM version build status David deps npm download

Create and parse compact logs.

Installation

$ npm install legoino-util

API Documentation

Example

Create compact log

'use strict';

const { createCompactLog } = require('legoino-util');

let result = createCompactLog(
  {
    id: 65535,
    epoch: 32767,
    parameters: {
      A: 1,
      B: 2,
      C: 3,
      D: 4
    },
    eventId: 5,
    eventValue: 6,
    deviceId: 0xaaaa - 65536
  },
  4
);
// result is a string with value '0000FFFF00007FFF000100020003000400050006AAAA87'

Parse current settings

'use strict';

const { parseCurrentSettings } = require('legoino-util');

let result = parseCurrentSettings('0000FFFF00007FFF000100020003000400050006AAAA87');
// result is a JSON (object)

Parse multi-logs

Parse many lines of logs in one go. The lines must be separated by carriage returns.

'use strict';

const { parseMultilog } = require('legoino-util');

var multilog = `
000100005B77EFBE0046000E003800000000000000000013000C00060000005100010011004080000000000004D242
000100015B77EFC10046000E003800000000000000000044003200100000002000020011004080000000000004D231
000100025B77EFC40047000E00380000000000020002002F0024000A0000003500010011004080000000000004D247
`

let result = parseMultilog(multilog);
// result is a JSON (array of objects)

License

MIT

Keywords

FAQs

Last updated on 23 Nov 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc