New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@toluwap/complete-string

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toluwap/complete-string

The completeString function is a JavaScript function that ensures a given string ends with a desired ending. If the string already ends with the desired ending, the function returns the original string. Otherwise, the function adds the missing characters

latest
Source
npmnpm
Version
0.0.10
Version published
Maintainers
0
Created
Source

Complete String

The completeString function is a JavaScript function that ensures a given string ends with a desired ending. If the string already ends with the desired ending, the function returns the original string. Otherwise, the function adds the missing characters to the end of the string.

import { completeString } from "@toluwap/complete-string"

const result = completeString(inputString, desiredEnding);

The completeString function takes two arguments:

inputString (string): The input string to be checked. desiredEnding (string): The desired ending that the input string should have. The function returns the original string with the desired ending appended, if necessary.

console.log(completeString("https://url.com", "/api/v4")); // output: https://url.com/api/v4

console.log(completeString("https://url.com/api", "/api/v4")); // output: https://url.com/api/v4

console.log(completeString("https://url.com/api/v4", "/api/v4")); // output: https://url.com/api/v4

test

$ npm test

Keywords

complete end

FAQs

Package last updated on 11 Nov 2024

Did you know?

Socket

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