New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

strility

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strility

Strility is a string manipulation library

  • 1.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

strility

Travis

Strility is a string manipulation library

[Work in progress]

Usage

$ npm i --save strility

Api

const { isUpperCase } = require('strility');

isUpperCase('string')
  • string, the input string.
  • returns true or false
const { isLowerCase } = require('strility');

isLowerCase('string')
  • string, the input string.
  • returns true or false
const { isString } = require('strility');

isString('string')
  • string, the input string.
  • returns true or false
// Uses the Fisher-Yates algorithm
const { shuffle } = require('strility');

shuffle('string') // 'trsgni'
  • string, the input string.
  • returns shuffled string
const { chars } = require('strility');

chars('string') // [ 's', 't', 'r', 'i', 'n', 'g' ]
  • string, the input string.
  • returns array of characters
const { surround } = require('strility');

surround('dog', '*') // '*dog*'
  • string, the input string.
  • surround, the substring to surround the input string
  • returns surrounded string
const { replaceAll } = require('strility');

replaceAll(
    'The quick brown fox jumps over the lazy dog', 
    ['quick', 'dog'],
    ['sleepy', 'cat']
);
// The sleepy brown fox jumps over the lazy cat
  • string, the input string.
  • search, the array of search strings
  • replace, the array of replace strings
  • returns replaced string
const { swapCase } = require('strility');

swapCase('My STRING has UPPER CASE and lower case') // 'mY string HAS upper case AND LOWER CASE'
  • string, the input string.
  • returns swapped lower/upper case string

Between is an among proxy

const { between } = require('strility');

const find = between('{{', '}}');

find('The [quick] [brown] {{fox}} $jumps$ over the [lazy] {{dog}}') // [ 'fox', 'dog' ]

Tests

$ npm test

Contribution

Contributions are appreciated.

License

MIT-licensed. See LICENSE.

Keywords

FAQs

Package last updated on 07 Jun 2017

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