Socket
Socket
Sign inDemoInstall

strip-outer

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    strip-outer

Strip a substring from the start/end of a string


Version published
Weekly downloads
3.9M
increased by0.01%
Maintainers
1
Install size
3.45 kB
Created
Weekly downloads
 

Package description

What is strip-outer?

The strip-outer npm package is designed to remove the outermost matching substring from a given string. It is particularly useful for trimming specific characters or patterns from the start and end of strings, allowing for more precise string manipulation than traditional trim methods.

What are strip-outer's main functionalities?

Strip specific characters from the start and end of a string

This feature allows you to remove specific characters or patterns from both the start and end of a string. In the provided code sample, the 'strip-outer' package is used to remove the '---' characters from around the 'Hello World' string.

"use strict";\nconst stripOuter = require('strip-outer');\nconsole.log(stripOuter('---Hello World---', '---')); // 'Hello World'

Strip patterns using regular expressions

This feature demonstrates the ability to use regular expressions to define the pattern to be stripped from the string. In the example, all '#' characters are removed from the start and end of the 'Hello World' string.

"use strict";\nconst stripOuter = require('strip-outer');\nconsole.log(stripOuter('###Hello World###', /#+/)); // 'Hello World'

Other packages similar to strip-outer

Readme

Source

strip-outer

Strip a substring from the start/end of a string

Install

$ npm install strip-outer

Usage

import stripOuter from 'strip-outer';

stripOuter('foobarfoo', 'foo');
//=> 'bar'

stripOuter('unicorncake', 'unicorn');
//=> 'cake'

Keywords

FAQs

Last updated on 19 Aug 2021

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