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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tinyml-core

v2.0.16

Published

TinyML-syntax parser

Readme

TinyML Core

TinyML Core is a little, faster and lightweight module that will help you to parse the source code of TinyML.

❌ Please don't use until we delete this message, this lib is under construction 🚫

Installation

npm install tinyml-core

Concept

The structure pattern is similar to HTML, you will get tags, content, params and comments.

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>The page title</title>
    </head>
    <body>
        <!-- This is a comment -->
        <hr/>
        <div class="container">
            <h1>My first title</h1>
            <p>
                Lorem ipsum dolor sit<br>
                amet, consectetur
            <p>
        </div>
    </body>
</html>
{!DOCTYPE html}
html(lang="en") {
    head {
        title {The page title}
    }
    body {
        [ This is a comment ]
        hr;
        div(class="container") {
            h1 {My first title}
            p {
                Lorem ipsum dolor sit\n
                amet, consectetur
            }
        }
    }
}

Functions

From Core

parse

❕ This method will help you to parse synchronically a TinyML-syntax source.

Return

✅ An array with the data

❌ Throw an error.

Params:

🔹 source: string - The source code to parse.

Example:
import { Core } from 'tinyml-core/common';

try {
    var parsed = Core.parse(`
    thisIsATag(param1) {
        This is a raw content
        tag{This is raw content too}
        [This is a commentary]
    } Raw content again
`);
} catch (e) {
    console.error(e);
}

Data description

Core.parse returns an array of the following kind of elements if succedes:

  • Core.Element
  • Core.Raw
  • Core.Comment
  • Core.Code

Global methods & members

The following members & methods will be inherited by Core.Raw, Core.Element, Core.Comment and Core.Code

🔹 tokens: Token[] - All tokens catched for the instance.

🔹 isRaw(): boolean - Checks if the instance is a Core.Raw instance.

🔹 isElement(): boolean - Checks if the instance is a Core.Element instance.

🔹 isComment(): boolean - Checks if the instance is a Core.Comment instance.

🔹 isCode(): boolean - Checks if the instance is a Core.Code instance.

🔹 toString(): string - A string representation of all tokens contained in the instance.

The Token data type

This data type contains information about an element of the source code. It has the following members:

🔹 text: string - The string of the token.

🔹 pos: TokenPosition /* {x: number, y: number} */ - The location of the token in the source code.

🔹 text: TokenType - The token type.

Core.Element

This data type defines an element. It is composed by the following members.

🔹 tag: Token - The token that contain the tag name and location. The type ever will be TokenType.identifier.

🔹 params: Token[] - All tokens that compounds the parameters.

🔹 children: (Core.Element | Core.Raw | Core.Comment | Core.Code)[] | undefined - The content inside of. An array of TinyML elements or undefined.

Core.Raw

This data type different to Core.Element element, generally the content of this last one.

Does not contain new methods or members by itself.

Core.Comment

This data type defines the content between [ and ] characters.

Does not contain new methods or members by itself.

Core.Code

This data type defines the content between unnamed { and } characters.

Does not contain new methods or members by itself.

namedBlock {
    content of named block
}
{
    content of unnamed block
}