JSPM

strbuilder

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q28649F
  • License MIT

Simple-to-the-task string builder utility.

Package Exports

  • strbuilder

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (strbuilder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stringbuilder

Simple-to-the-task string builder utility.

Installation

    npm install strbuilder

Test

    npm test

Usage in Node

    /* With initialization text */
    var sb = require('strbuilder')("Start text");
    
    /* Or no text initialization. */
    
    var sb1 = require('strbuilder')();
    
    sb.append("Hello,").append(" world!");
    
    console.log(sb.toString()) /* prints 'Hello, world!' */
    console.log(sb.length) /* prints 2.
     

Usage in Browser

<!-- include it at the head section of your page -->
<script src='path/to/stringbuilder.js'></script>
    /* With initialization text */
    var sb = stringbuilder("Start text");
    
    /* Or no text initialization. */
    
    var sb1 = stringbuilder();
    
    sb.append("Hello,").append(" world!");
    
    console.log(sb.toString()) /* prints 'Hello, world!' */
    console.log(sb.length) /* prints 2.
     

Property and methods

  • length: tells us the number of different string appended to it.
  • toString: returns all the strings in it, joined together.
  • append: adds a string to the string builder.

Thanks all.