npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@labjack/ljswitchboard-ljm_special_addresses

v2.2.0

Published

This module allows Kipling to interface with LJM's special address/specific ip feature.

Downloads

2

Readme

ljswitchboard-ljm_special_addresses

This module allows Kipling to interface with LJM's Special Addresses/Specific IPs feature. Documentation for this feature can be found on LabJack's website: LJM Special Addresses.

Installing the LJM Library

The LJM library can be downloaded and installed for free on LabJack's website on the LJM Library Installers page.

Installation:

Install with npm:

npm install ljswitchboard-ljm_special_addresses

Including

var ljm_special_addresses = require('@labjack/ljswitchboard-ljm_special_addresses');

Examples

The most up to date list of examples can be found in the examples directory of this repository. This module exposes the following functions:

  • parse
  • load
  • save
  • addIP
  • addIPs
  • getDefaultFilePath

Example usage of the "parse" function:

/*
 * The parse function parses the specified .config file.  There is an optional
 * options argument where file path can be specified:
 * ljm_special_addresses.parse({'filePath': '[customFilePath]'})
 */
ljm_special_addresses.parse()
.then(function(res) {
	console.log('Config File Path:', res.filePath);
	console.log('Special IP Addresses:');
	console.log(res.fileData);
}, function(err) {
	console.log('Error parsing', err);
});

Output:

> node ./examples/parse_special_addresses.js

Config File Path: C:\ProgramData\LabJack\LJM\ljm_special_addresses.config
Special IP Addresses:
[ { ip: '192.168.1.10', comments: [ 'My First IP' ] },
  { ip: '192.168.1.11', comments: [ 'My Second IP' ] } ]

Example usage of the "load" function:

/*
 * The load function parses and instructs LJM to load the 
 * specified .config file.  There is an optional
 * options argument where file path can be specified:
 * ljm_special_addresses.load({'filePath': '[customFilePath]'})
 */
ljm_special_addresses.load()
.then(function(res) {
	console.log('Config File Path:', res.filePath);
	console.log('Special IP Addresses:');
	console.log(res.fileData);
}, function(err) {
	console.log('Error parsing', err);
});

Output:

> node ./examples/load_special_addresses.js

Config File Path: C:\ProgramData\LabJack\LJM\ljm_special_addresses.config
Special IP Addresses:
[ { ip: '192.168.1.10', comments: [ 'My First IP' ] },
  { ip: '192.168.1.11', comments: [ 'My Second IP' ] } ]
LJM's Special Addresses Status String:
Success. IPs: [192.168.1.10, 192.168.1.11]

Example usage of the "save" function:

// The IP addresses to save to the .config file.
var userIPs = [
	{'ip': '192.168.1.10', 'comments': ['My First IP']},
	{'ip': '192.168.1.11', 'comments': ['My Second IP']},
];

/*
 * The save function formats, saves, and instructs LJM to load the 
 * specified .config file.  There is an optional
 * options argument where file path can be specified:
 * ljm_special_addresses.save(userIPs, {'filePath': '[customFilePath]'})
 */
ljm_special_addresses.save(userIPs)
.then(function(res) {
	console.log('Config File Path:', res.filePath);
	console.log('Special IP Addresses:');
	console.log(res.fileData);
}, function(err) {
	console.log('Error parsing', err);
});

Output:

> node ./examples/save_special_addresses.js

Config File Path: C:\ProgramData\LabJack\LJM\ljm_special_addresses.config
Special IP Addresses:
[ { ip: '192.168.1.10', comments: [ 'My First IP' ] },
  { ip: '192.168.1.11', comments: [ 'My Second IP' ] } ]
LJM's Special Addresses Status String:
Success. IPs: [192.168.1.10, 192.168.1.11]

Example usage of the "addIP" function:

// New IP Address to add to the .config file.
var userIP = {'ip': '192.168.1.12', 'comments': ['My First Single New IP']};

/*
 * The addIP function parses the specified .config file, adds the new userIP,
 * removes duplicate IP addresses, formats, saves, and instructs LJM to load the 
 * specified .config file.  There is an optional
 * options argument where file path can be specified:
 * ljm_special_addresses.addIP(userIPs, {'filePath': '[customFilePath]'})
 */
ljm_special_addresses.addIP(userIP)
.then(function(res) {
	console.log('Config File Path:', res.filePath);
	console.log('Special IP Addresses:');
	console.log(res.fileData);
	console.log('LJM\'s Special Addresses Status String:');
	console.log(res.ljmStatus);
}, function(err) {
	console.log('Error parsing', err);
});

Output:

> node ./examples/add_special_address.js

Config File Path: C:\ProgramData\LabJack\LJM\ljm_special_addresses.config
Special IP Addresses:
[ { ip: '192.168.1.10', comments: [ 'My First IP' ] },
  { ip: '192.168.1.11', comments: [ 'My Second IP' ] },
  { ip: '192.168.1.12', comments: [ 'My First Single New IP' ] } ]
LJM's Special Addresses Status String:
Success. IPs: [192.168.1.10, 192.168.1.11, 192.168.1.12]

Example usage of the "addIPs" function:

// New IPs to add to the .config file.
var userIPs = [
	{'ip': '192.168.1.10', 'comments': ['My First New IP']},
	{'ip': '192.168.1.11', 'comments': ['My Second New IP']},
];

/*
 * The addIPs function parses the specified .config file, adds the new userIPs,
 * removes duplicate IP addresses, formats, saves, and instructs LJM to load the 
 * specified .config file.  There is an optional
 * options argument where file path can be specified:
 * ljm_special_addresses.addIPs(userIPs, {'filePath': '[customFilePath]'})
 */
ljm_special_addresses.addIPs(userIPs)
.then(function(res) {
	console.log('Config File Path:', res.filePath);
	console.log('Special IP Addresses:');
	console.log(res.fileData);
	console.log('LJM\'s Special Addresses Status String:');
	console.log(res.ljmStatus);
}, function(err) {
	console.log('Error parsing', err);
});

Output:

> node ./examples/add_special_addresses.js

Config File Path: C:\ProgramData\LabJack\LJM\ljm_special_addresses.config
Special IP Addresses:
[ { ip: '192.168.1.10', comments: [ 'My First New IP' ] },
  { ip: '192.168.1.11', comments: [ 'My Second New IP' ] },
  { ip: '192.168.1.12', comments: [ 'My First Single New IP' ] } ]
LJM's Special Addresses Status String:
Success. IPs: [192.168.1.10, 192.168.1.11, 192.168.1.12]