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

tcl-js

v2.9.0

Published

tcl-js is a tcl intepreter written completely in Typescript. It is meant to replicate the tcl-sh interpreter as closely as possible.

Downloads

165

Readme

tcl-js

A native javascript tcl interpreter

tcl-js tcl-js Build Status codecov install size

About

tcl-js is an interpreter for TCL written in typescript, it tries to replicate the tcl-sh interpreter as closely as possible. If there are any deviations from the original interpeter, they will be listed below. This interpreter is not built for speed or efficiency, but for security, ease of use and modularity. This also means that every part of the interpreter will be documented as precisely as possible.

Why

I am aware that there already exist packages for NodeJS that link the tcl-sh interpreter directly into node. The reason this project was started was because of security concerns about this method. Because, if you directly give users access to a system level interpreter, you grant them the ability to execute possible dangerous commands. An example might be deleting all files the nodejs process has permissions over. With tcl-js you can easily disable unwanted commands and be absolutely sure that they are never executed. It is also a lot easier to insert already existing javascript functions into the interpreter for your specific needs.

Disclaimer

This project is still a work in progress. While it is unlikely, the api or the way certain things are handled might change in the future.

If you would like to make this project hit a producion fase earlier, you are welcome to submit a pull request.

Getting started

Install tcl-js to your project with

npm install --save tcl-js

Then use it in your project by importing the Tcl component.

// Import the interpreter
const { Tcl } = require('tcl-js');

// Create a new interpreter
// Every interpreter will keep its scope until it is destroyed
let tcl = new Tcl();

// The interpreter works asynchronous, so an async function is used
// Using promises will also work here
async function main() {
  // Print "Hello World!" to the terminal
  await tcl.run('set w "World!"');
  await tcl.run('puts "Hello $w"');

  // Use this to run a file:
  // await tcl.runFile('~/tcl/demo.tcl');
}

// Call the async function
main().catch(console.error);

Documentation

You can find all the documentation here.

Status

Down below is the current project status of tcl-js, here you can see what parts are already implemented and working. Any deviations that have been made from the original tcl-sh interpreter will also be listed here.

Deviations

  • In the expr command:
    • The in operator is unavailable
    • Numbers with leading zeros are just interpreted as decimal and not octal

Currently working tcl commands

These commands should be fully working as documented in the tcl wiki.

  • break
  • continue
  • eval
  • expr
  • for
  • if
  • incr
  • lindex
  • list
  • proc
  • puts
  • set
  • switch
  • unset
  • while

Partially working commands

Only part of these commands are finished and they may not work as expected.

  • info

Other working parts

These are not commands but just general parts of the program. If they are listed here, they work.

  • lexer
  • parser
  • command handler
  • object and array variables
  • list variables
  • custom functions
  • scoping
  • interpreter
  • backslash escape sequences
  • advanced variables
  • asynchronous
  • expression variables
  • looping
  • exiting recursive loops
  • external javascript functions
  • external javascript variables
  • argument expansion