Socket
Socket
Sign inDemoInstall

avolitty-concatenator

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    avolitty-concatenator

Create repeated text patterns with a fast and unique string concatenating algorithm.


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

JavaScript Avolitty Concatenator

Description

Create repeated text patterns with a fast and unique string concatenating algorithm.

  • All MDN modern web browsers supported
  • Browser JavaScript and Node.js supported
  • Considers C programming constraints relevant to JavaScript
  • Extended compatability with all browsers and Node.js versions
  • Faster than any JavaScript string repetition algorithm
  • Faster than using the built-in String.prototype.repeat() function
  • Minified and readable code with single-letter variable names
  • No conditional statements in loops
  • No dependencies
  • No redundant memory storage for pattern and result strings
  • Option to concatenate with an existing string
  • Repeats strings within bounds of repeat() without string length errors
  • Unicode supported
Usage

Install the NPM module in the current directory with the command npm install.

npm install avolitty-concatenator

Include the module in Node.js with the function require().

const avolittyConcatenator = require("avolitty-concatenator");

The following example uses code from the file test.js to concatenate repeated strings.

const a = "string";
const b = "🥑";
const c = 5;
const d = avolittyConcatenator(a, b, c);
console.log(d);

The function avolittyConcatenator() outputs a string with a concatenated string appended with a specific number of repetitions.

The return value is a string defined as the variable b appended to the variable a repeatedly to the count of the variable c.

The first argument variable a is a string defined as the original string to concatenate to.

The second argument variable b is a string defined as the string to concatenate with the variable a.

The third argument variable c is a number defined as the count of the variable b appended to the variable a repeatedly.

The node CLI can process a list of defined test inputs from the file test.js.

node test

The output is a list of test inputs with corresponding outputs from the function avolittyConcatenator().

Input: avolittyConcatenator("string", "1", 0);
Output: "string"
Passed: Yes

Input: avolittyConcatenator("string", "1", 1);
Output: "string1"
Passed: Yes

Input: avolittyConcatenator("string", "1", 2);
Output: "string11"
Passed: Yes

Input: avolittyConcatenator("string", "11", 3);
Output: "string111111"
Passed: Yes

Input: avolittyConcatenator("string", "111", 4);
Output: "string111111111111"
Passed: Yes

Input: avolittyConcatenator("string", "🥑", 5);
Output: "string🥑🥑🥑🥑🥑"
Passed: Yes

Input: avolittyConcatenator(avolittyConcatenator("", "string", 2), "🥑", 10);
Output: "stringstring🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑"
Passed: Yes

Keywords

FAQs

Last updated on 26 May 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc