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

@qpyracuk/text-builder

v0.0.4-alpha

Published

Fast and powerful object to text serializer

Downloads

13

Readme

@qpyracuk/text-builder

Introduction

Immediately after writing an object serializer in XML @qpyracuk/xml-builder, an idea came to me - based on an already existing “engine”, create an object serializer into plain text. Having brewed 1 more cup of coffee, I got to work, and half an hour later, another bag was ready!

Installation

This is a JS library available through the npm registry. Before installation, you need to download and install Node.js. Requires Node.js v8.0.0 or higher.

If this is a completely new project, be sure to create a package.json file using the npm init command.

To install the package, enter the npm install @qpyracuk/text-builder command in the console.

npm install @qpyracuk/text-builder

Features

  • Support for Map and Set data structures;
  • Pretty output mode;
  • Adjusting tab size in pretty mode;
  • Displaying variable types;
  • High serialization speed;
  • Changing the encoding.

Quick Start

After installing the package, import the library.

For ESMAScript modules:

import TEXT from '@qpyracuk/text-builder';

For CommonJS modules:

const TEXT = require('@qpyracuk/text-builder');

Usage example

We create an object that needs to be traversed

const futureText = {
  primitive: '1',
  object: {
    primitive: 3,
    array: ['1', 2, 'three'],
    set: new Set([1, 2, new Map([['key', { field: { value: 100 } }]])]),
    map: new Map([['key', { value: 10 }]])
  }
};

const builder = TEXT.createBuilder({ pretty: true, typed: true });
const text = builder.stringify(futureText);

Options

pretty: boolean

Generate a text model of an object with indents and tabs.

typed: boolean

Sign the type of fields of objects or variables.

tab: number | 'tab'

Tab size in spaces if specified as a positive numeric value. Is it possible to specify 'tab' and then all whitespace characters will become \t.

Builder methods

stringify(data: any): string

Serializes data into text. Yes, it's simple!

Author

The author of the library is Pobedinskiy David.

Bugs

If you encounter unexpected errors, please let me know. By e-mail [email protected] or in Telegram.

Support the author

If my work has helped you make your life easier, you can support me with your donations.

Boosty

Patreon

Search npm for other libraries with the @qpyracuk prefix. Perhaps you will find something useful for your project.