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

phid-srcgentools

v1.0.23

Published

Source Generation Tools

Downloads

74

Readme

Source Generation Tools

Source gen tools includes various methods that assist in the generation of source code from the Phidget Specification files.

The module exports two variables SrcGenTools and Lint.

To create and instance:

var PhidgetSrcGenTools = require('phid-srcgentools');
var gentools = new PhidgetSrcGenTools.SrcGenTools()

A number of C language specific bridge packet functions are also defined. Check the source or the SpecTools Class Generator project for details.

Methods

loadPhidgetSpec()

loadPhidgetSpec() loads each of the .js files found in the phidspec folder as node.js modules, and returns them as an array.

The phidspec folder is stored in the SrcGenTools instance specdir member, and defaults to phidhome/phidspec.

Lint is executed on each of the loaded spec files.

var PhidgetSrcGenTools = require('phid-srcgentools');
var gentools = new PhidgetSrcGenTools.SrcGenTools()

var mods = gentools.loadPhidgetSpec();

writeObjectJS(obj, writeln, name)

Writes the contents of the specified object with the specified writeln instance as a JavaScript object named name.

var WriteLn = require('phid-writeln');
var PhidgetSrcGenTools = require('phid-srcgentools');
var gentools = new PhidgetSrcGenTools.SrcGenTools()

var w = new WriteLn();
w.open('output.js');

gentools.writeObjectJS(obj, w, 'Object');

foreachDeviceChannel(cls, cb, arg)

Walks each device and class in Devices.js, an calls the specified callback function cb for each class that matches the specified class cls. arg is a context variable that is supplied by the called and passed to each invocation of the callback cb.

The specified class is expected to have been processed by mkTree(). The class comparison is done via the cls basename and the channel.class.

var PhidgetSrcGenTools = require('phid-srcgentools');
var gentools = new PhidgetSrcGenTools.SrcGenTools()

function cb(cls, dev, ch, arg) {
}

gentools.foreachDeviceChannel(cls, cb, null);

Helper methods

The following methods are added if not already set:

  1. String.endsWith()
  2. String.startsWith()
  3. String.lowerFirst()
  4. String.upperFirst()