Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

replaceall

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replaceall

Replace all instances in a JavaScript string

  • 0.1.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is replaceall?

The replaceall npm package is a simple utility for replacing all instances of a substring within a string. It provides a straightforward API to perform global replacements without the need for regular expressions.

What are replaceall's main functionalities?

Basic Replacement

This feature allows you to replace all occurrences of a substring with another substring. In this example, all instances of 'foo' are replaced with 'bar'.

const replaceall = require('replaceall');
const result = replaceall('foo', 'bar', 'foo is foo');
console.log(result); // 'bar is bar'

Case Sensitive Replacement

This feature performs case-sensitive replacements. Only the exact matches of the substring will be replaced. In this example, only 'Foo' is replaced with 'bar', while 'foo' remains unchanged.

const replaceall = require('replaceall');
const result = replaceall('Foo', 'bar', 'Foo is foo');
console.log(result); // 'bar is foo'

Replacing Special Characters

This feature allows you to replace special characters within a string. In this example, all instances of '?' are replaced with '!'.

const replaceall = require('replaceall');
const result = replaceall('?', '!', 'Hello? How are you?');
console.log(result); // 'Hello! How are you!'

Other packages similar to replaceall

Keywords

FAQs

Package last updated on 23 Apr 2015

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc