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 🙏

© 2025 – Pkg Stats / Ryan Hefner

senselogic-def

v0.1.21

Published

Data exchange format.

Downloads

58

Readme

DEF

Data Exchange Format.

Features

  • Simple, readable syntax based on indentation.
  • Easy to write, parse and generate.
  • Compact representation for complex data structures.
  • Supports all JSON data types and more:
    • Constants
    • Numbers
    • Multiline strings
    • Arrays
    • Objects
    • Maps
    • Tabular arrays of objects and maps
  • Can execute custom commands to :
    • Generate UUIDs : '#id'
    • Generate base64 UUIDs : '%id'
    • Load a DEF file : '@file.def'
{
    settings
        {
            theme
                dark
            fontSize
                16
            features
                [
                    search
                    filter
                    sort
                ]
            version
                2.0¨
            metrics
                {
                    cpuUsage
                        0.75
                    memoryUsage
                        0.6
                    networkTraffic
                        1234567890
                }
            logging
                true
        }
    plugins
        [
            {
                name
                    Analytics
                status
                    enabled
            }
            {
                name
                    SEO
                status
                    disabled
            }
        ]
    users
        [
            [
                name
                role
            ]
            [
                John Doe
                administrator
            ]
            [
                Jane Smith
                publisher
            ]
        ]{}
    texts
        {
            home
                "Home
                ¨fr:Accueil
                ¨de:Startseite
                ¨ja:ホーム"
            services
                `Services
                ¨fr:Services
                ¨de:Dienstleistungen
                ¨ja:サービス`
            contact
                ´Contact
                ¨fr:Contact
                ¨de:Kontakt
                ¨ja:連絡先´
        }
}

Supported data types

  • Constants: undefined, null, false, true, NaN, -Infinity, Infinity
  • Numbers: decimal integers and reals, hexadecimal naturals
  • Strings: quoted and unquoted multiline texts
  • Arrays: ordered collections
  • Objects: key-value collections using strings as keys
  • Maps: key-value collections
{
    name
        DEF
    version
        1.0¨
    description
        Data exchange format.
    author
        {
            name
                Ecstatic Coder
            email
                [email protected]
        }
    features
        [
            Simple, parseable syntax based on indentation.
            Compact representation for complex data structures.
            Supports all JSON data types and more.
            Flexible multiline string handling.
        ]
    examples
        {
            constants
                [
                    undefined
                    null
                    false
                    true
                    NaN
                    -Infinity
                    Infinity
                ]
            numbers
                [
                    0
                    -1
                    42
                    0xFF
                    3.14159
                    -1.23456e-7
                ]
            strings
                {
                    unquoted string
                        Single-line strings don't need quotes.
                    unquoted string starting and ending with spaces
                            Unquoted strings can start and end with spaces.    ¨
                    unquoted multiline string
                        A backslash escapes the next character.\\\
                        A trailing backslash makes the line continue \
                        over the next line. \
                            Starting spaces are kept. \
                        Ending spaces are not kept unless followed by a backspace \
                        or a diaeresis.    ¨
                    unquoted empty string

                    unquoted empty string with a trailing diaeresis
                        ¨
                    unquoted constant-like string with a trailing diaeresis
                        null¨
                    unquoted number-like string with a trailing diaeresis
                        1.0¨
                    quoted multiline string
                        'Lines are joined using line breaks.
                        A backslash escapes the next character.\'
                        A trailing backslash makes the line continue \
                        over the next line.
                            Starting spaces are kept.
                        Ending spaces are not kept unless followed by a backspace \
                        or a diaeresis.    ¨
                        'Non-ending' quotes don't have to be escaped.'
                    quoted empty string
                        ''
                    double-quoted multiline string
                        "Lines are joined using line breaks.
                        A backslash escapes the next character.\"
                        A trailing backslash makes the line continue \
                        over the next line.
                            Starting spaces are kept.
                        Ending spaces are not kept unless followed by a backspace \
                        or a diaeresis.    ¨
                        "Non-ending" double-quotes don't have to be escaped."
                    double-quoted empty string
                        ""
                    backticked multiline string
                        `Lines are joined using line breaks.
                        A backslash escapes the next character.\`
                        A trailing backslash makes the line continue \
                        over the next line.
                            Starting spaces are kept.
                        Ending spaces are not kept unless followed by a backspace \
                        or a diaeresis.    ¨
                        `Non-ending` backticks don't have to be escaped.`
                    backticked empty string
                        ``
                    ticked multiline string
                        ´Lines are joined using line breaks.
                        A backslash escapes the next character.\´
                        A trailing backslash makes the line continue \
                        over the next line.
                            Starting spaces are kept.
                        Ending spaces are not kept unless followed by a backspace
                        or a diaeresis.    ¨
                        ´Non-ending´ ticks don't have to be escaped.´
                    ticked empty string
                        ´´
                }
            collections
                {
                    array of values
                        [
                            null
                            0
                            one
                            2.0¨
                            '3'
                            "4"
                            `5`
                            ´6´
                        ]
                    array of empty strings
                        [

                            ¨
                            ''
                            ""
                            ``
                            ´´
                        ]
                    object of key/value pairs (where keys are coerced to strings)
                        {
                            key
                                value
                            other key
                                other value
                            123
                                null
                            undefined
                                not found
                            keys
                                [
                                    array value 1
                                    array value 2
                                ]
                            are converted
                                {
                                    object key 1
                                        object value 1
                                    object key 2
                                        object value 2
                                }
                            to strings
                                (
                                    map key 1
                                        map value 1
                                    map key 2
                                        map value 2
                                )
                        }
                    map of key/value pairs (where keys can be of any type)
                        (
                            key
                                value
                            other key
                                other value
                            123
                                null
                            undefined
                                not found
                            [
                                array value 1
                                array value 2
                            ]
                                (
                                    map key 1
                                        map value 1
                                    map key 2
                                        map value 2
                                )
                            {
                                object key 1
                                    object value 1
                                object key 2
                                    object value 2
                            }
                                [
                                    array value 1
                                    array value 2
                                ]
                            (
                                map key 1
                                    map value 1
                                map key 2
                                    map value 2
                            )
                                {
                                    object key 1
                                        object value 1
                                    object key 2
                                        object value 2
                                }
                        )
                    array of objects
                        [
                            {
                                name
                                    John Doe
                                role
                                    administrator
                            }
                            {
                                name
                                    Jane Smith
                                role
                                    publisher
                            }
                        ]
                    tabular array of objects
                        [
                            [
                                name
                                role
                            ]
                            [
                                John Doe
                                administrator
                            ]
                            [
                                Jane Smith
                                publisher
                            ]
                        ]{}
                    array of maps
                        [
                            (
                                name
                                    John Doe
                                role
                                    administrator
                            )
                            (
                                name
                                    Jane Smith
                                role
                                    publisher
                            )
                        ]
                    tabular array of maps
                        [
                            [
                                name
                                role
                            ]
                            [
                                John Doe
                                administrator
                            ]
                            [
                                Jane Smith
                                publisher
                            ]
                        ]()
                }
        }
}

JavaScript API

// -- IMPORTS

import { buildDefText, getDumpText, parseDefText } from 'senselogic-def';

// -- STATEMENTS

let object =
    {
        name: 'John Doe',
        age: 30,
        skills: [ 'JavaScript', 'TypeScript', 'Node.js' ]
    };

let text = buildDefText( object );
console.log( text );
/*
{
    name
        John Doe
    age
        30
    skills
        [
            JavaScript
            TypeScript
            Node.js
        ]
}
*/

let value = parseDefText( text );
console.log( getDumpText( value ) );
/*
{
  "name": "John Doe",
  "age": 30,
  "skills": [
    "JavaScript",
    "TypeScript",
    "Node.js"
  ]
}
*/

let map = new Map();

map.set(
    [
        'first',
        'key'
    ],
    {
        first: 'value',
        second: 'value'
    }
    );

map.set(
    [
        'second',
        'key'
    ],
    {
        first: 'value',
        second: 'value',
        third: 'value'
    }
    );

text = buildDefText( map );
console.log( text );
/*
(
    [
        first
        key
    ]
        {
            first
                value
            second
                value
        }
    [
        second
        key
    ]
        {
            first
                value
            second
                value
            third
                value
        }
)
*/

value = parseDefText( text );
console.log( getDumpText( value ) );
/*
Map(2) {
  [
    "first",
    "key"
  ] => {
    "first": "value",
    "second": "value"
  },
  [
    "second",
    "key"
  ] => {
    "first": "value",
    "second": "value",
    "third": "value"
  }
}
*/

Limitations

  • Tab characters are automatically replaced by a fixed number of spaces, regardless of their position in the line.

Version

0.1

Author

Eric Pelzer ([email protected]).

License

This project is licensed under the GNU Lesser General Public License version 3.

See the LICENSE.md file for details.