Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

pre-suf

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Issues
File Explorer

Advanced tools

pre-suf

Manipulate strings with prefixes and suffixes.

    1.1.1latest
    GitHub

Version published
Maintainers
1
Weekly downloads
747
increased by10.5%

Weekly downloads

Readme

Source

Build Status

pre-suf

Manipulate strings with prefixes and suffixes.

Install

$ npm install pre-suf --save

Usage

const presuf = require('pre-suf') presuf.ensureLeading('path/to', '/') // '/path/to' presuf.removeEnding('/path/to//', '/') // '/path/to'

presuf.ensureLeading(str, prefix)

Ensures that the new string will have prefix at the beginning of str.

If str does not begin with prefix, prefix will be added to the beggining of str.

presuf.removeLeading(str, prefix)

Removes the leading prefix of str.

presuf.removeLeading('/abc', '/a') // 'bc' presuf.removeLeading('/a/abc', '/a') // 'bc'. removes 2 groups of '/a'

presuf.ensureEnding(str, suffix)

presuf.removeEnding(str, suffix)

License

MIT

Keywords

FAQs

Last updated on 17 Mar 2019

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • 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