npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

string-transfer

v1.0.3

Published

This is a function for parsing into specified string pattern based on the parameters of function to pass.

Downloads

1

Readme

string-transfer v1.0.0

This is a function for parsing into specified string pattern based on the parameters of function to pass.

这是一个功能,它根据要传递的函数参数转换成指定的字符串模式。

How to get start

npm i string-transfer@latest

How to import function of 'string-transfer'.

const stringmode = require('string-transfer').method;

How to use

There are some methods to call in the listA.

var listA = [
    'camel', 
    'class',
    'lower', 
    'upper',
    'const',
    'underln', 
    'underlnIncludeFirst',  
    'midln', 
    'midlnIncludeFirst', 
    'doller', 
    'dollerIncludeFirst', 
    'reverse', 
    'upperlower', 
    'upperlowerAndReverse', 
    'reverseByWord', 
    'upperlowerByWord', 
    'upperlowerAndReverseByWord'
]
  1. Following down two situations you will get the string of null: a. You are passing a parameter which is a string of null; b. You a't passed any parameter.
stringmode.camel('') => '';
stringmode.underln() => '';
  1. Following down you will get the same string if the function parameter is not in [A-Za-z].
stringmode.camel(',') => ',';
stringmode.camel(']STr') => ']Str';
stringmode.camel['is', 'NuMber,)'] => 'isNumber,)';
  1. As examples => camel.
stringmode.camel('a') => 'a';
stringmode.camel('Is') => 'iS';
stringmode.camel('icaMel') => 'iCamel';
stringmode.camel('ica]Mel') => 'iCa]mel';
stringmode.camel('IS', 'caMel') => 'isCamel';
stringmode.camel('Is', 'CAmel', 'or', 'modE') => 'isCamelOrMode';
stringmode.camel('Is', 'CAmel', 'or', ',modE') => 'isCamelOr,Mode';
  1. As examples => class.
stringmode.class('b') => 'B';
stringmode.class('Is') => 'Is';
stringmode.class('iClaSS') => 'Iclass';
stringmode.class('iCla.SS') => 'Icla.ss';
stringmode.class('is', 'cLAss') => 'IsClass';
stringmode.class('is', 'CLass', 'oR', 'Mode') => 'IsClassOrMode';
stringmode.class('is', 'CLass', 'o/R', 'Mode') => 'IsClassO/rMode';
  1. As examples => lower.
stringmode.lower('C') => 'c';
stringmode.lower('Is') => 'is';
stringmode.lower('iLOwer') => 'ilower';
stringmode.lower('iL-Ower') => 'il-ower';
stringmode.lower('is', 'loWer') => 'islower';
stringmode.lower('is', 'LOwEr', 'oR', 'mode') => 'islowerormode';
stringmode.lower('is', 'LOwE;r', 'oR', 'mode') => 'islowe;rormode';
  1. As examples => upper(the same as function of const).
stringmode.upper('D') => 'D';
stringmode.upper('Is') => 'IS';
stringmode.upper('iUppER') => 'IUPPER';
stringmode.const('iUpp=ER') => 'IUPP=ER';
stringmode.const('is', 'upper') => 'ISUPPER';
stringmode.const('is', 'UPPer', 'or', 'moDe') => 'ISUPPERORMODE';
stringmode.const('is', 'UP?Per', 'or', 'moDe') => 'ISUP?PERORMODE';
  1. As examples => underln | underlnIncludeFirst
// underln
stringmode.underln('E') => 'E';
stringmode.underln('Is') => 'I_s';
stringmode.underln('IunderLN') => 'I_underLN';
stringmode.underln('IunderL<>N') => 'I_underL<>N';
stringmode.underln('is', 'underLN') => 'is_underLN';
stringmode.underln('is', 'underLN', 'or', 'modE') => 'is_underLN_or_modE';
stringmode.underln('is', 'underL<>N', 'or', 'modE') => 'is_underL<>N_or_modE';

// underlnIncludeFirst
stringmode.underlnIncludeFirst('E') => '_E';
stringmode.underlnIncludeFirst('Is') => '_I_s';
stringmode.underlnIncludeFirst('IunderLN') => '_I_underLN';
stringmode.underlnIncludeFirst('IunderL<>N') => '_I_underL<>N';
stringmode.underlnIncludeFirst('is', 'underLN') => '_is_underLN';
stringmode.underlnIncludeFirst('is', 'underLN', 'or', 'modE') => '_is_underLN_or_modE';
stringmode.underlnIncludeFirst('is', 'underL<>N', 'or', 'modE') => '_is_underL<>N_or_modE';
  1. As examples => midln | midlnIncludeFirst
// midln
stringmode.midln('f') => 'f';
stringmode.midln('Is') => 'I-s';
stringmode.midln('iMIDln') => 'i-MIDln';
stringmode.midln('iM==IDln') => 'i-M==IDln';
stringmode.midln('is', 'MIDln') => 'is-MIDln';
stringmode.midln('is', 'MIDln', 'or', 'mODe') => 'is-MIDln-or-mODe';
stringmode.midln('is', 'MID''ln', 'or', 'mODe') => 'is-MID''ln-or-mODe';

// midlnIncludeFirst
stringmode.midlnIncludeFirst('f') => '-f';
stringmode.midlnIncludeFirst('Is') => '-I-s';
stringmode.midlnIncludeFirst('iMIDln') => '-i-MIDln';
stringmode.midlnIncludeFirst('iM==IDln') => '-i-M==IDln';
stringmode.midlnIncludeFirst('is', 'MidLN') => '-is-MidLN';
stringmode.midlnIncludeFirst('is', 'MidLN', 'or', 'modE') => '-is-MidLN-or-modE';
stringmode.midlnIncludeFirst('is', 'iM==IDln', 'or', 'modE') => '-is-iM==IDln-or-modE';
  1. As examples => doller | dollerIncludeFirst
// doller
stringmode.doller('g') => 'g';
stringmode.doller('IS') => 'I$S';
stringmode.doller('iDOLLer') => 'i$DOLLer';
stringmode.doller('i{}DOLLer') => 'i${}DOLLer';
stringmode.doller('is', 'DOLLer') => 'is$DOLLer';
stringmode.doller('is', 'DOLLer', 'or', 'mODe') => 'is$DOLLer$or$mODe';
stringmode.doller('i[]s', 'DOLLer', 'or', 'mODe') => 'i[]s$DOLLer$or$mODe';

// dollerIncludeFirst
stringmode.dollerIncludeFirst('g') => '$g';
stringmode.dollerIncludeFirst('IS') => '$I$S';
stringmode.dollerIncludeFirst('iDOLLer') => '$i$DOLLer';
stringmode.dollerIncludeFirst('i{}DOLLer') => '$i${}DOLLer';
stringmode.dollerIncludeFirst('is', 'DOLLer') => '$is$DOLLer';
stringmode.dollerIncludeFirst('is', 'DOLLer', 'or', 'mODe') => '$is$DOLLer$or$mODe';
stringmode.dollerIncludeFirst('i[]s', 'DOLLer', 'or', 'mODe') => '$i[]s$DOLLer$or$mODe';
  1. As examples => reverse | upperlower | upperlowerAndReverse
// reverse
stringmode.reverse('h') => 'h';
stringmode.reverse('is') => 'si';
stringmode.reverse('iReverse') => 'esreveRi';
stringmode.reverse('iRever.,se') => 'es,.reveRi';
stringmode.reverse('is', 'reverse') => 'esreversi';
stringmode.reverse('is', 'reverse', 'or', 'mODe') => 'eDOmroesreversi';
stringmode.reverse('is', 'rever()se', 'or', 'mODe') => 'eDOmroes)(reversi';

// upperlower
stringmode.upperlower('h') => 'H';
stringmode.upperlower('is') => 'IS';
stringmode.upperlower('iReverse') => 'IrEVERSE';
stringmode.upperlower('iRever.,se') => 'IrEVER.,SE';
stringmode.upperlower('is', 'reverse') => 'ISREVERSE';
stringmode.upperlower('is', 'reverse', 'or', 'mODe') => 'ISREVERSEORModE';
stringmode.upperlower('is', 'rever()se', 'or', 'mODe') => 'ISREVER()SEORModE';

// upperlowerAndReverse
stringmode.upperlowerAndReverse('h') => 'h';
stringmode.upperlowerAndReverse('is') => 'SI';
stringmode.upperlowerAndReverse('iReverse') => 'ESREVErI';
stringmode.upperlowerAndReverse('iRever.,se') => 'ES,.REVErI';
stringmode.upperlowerAndReverse('is', 'reverse') => 'ESREVERSI';
stringmode.upperlowerAndReverse('is', 'reverse', 'or', 'mODe') => 'EdoMROESREVERSI';
stringmode.upperlowerAndReverse('is', 'rever()se', 'or', 'mODe') => 'EdoMROES)(REVERSI';
  1. As examples => reverseByWord | upperlowerByWord | upperlowerAndReverseByWord
// reverseByWord
stringmode.reverseByWord('i') => 'i';
stringmode.reverseByWord('is') => 'si';
stringmode.reverseByWord('iReverse') => 'esreveRi';
stringmode.reverseByWord('iRever.,se') => 'es,.reveRi';
stringmode.reverseByWord('is', 'reverse') => 'reverseis';
stringmode.reverseByWord('is', 'reverse', 'or', 'mODe') => 'mODeorreverseis';
stringmode.reverseByWord('is', 'rever()se', 'or', 'mODe') => 'mODeorrever()seis';

// upperlowerByWord
stringmode.upperlowerByWord('i') => 'I';
stringmode.upperlowerByWord('is') => 'IS';
stringmode.upperlowerByWord('iReverse') => 'IrEVERSE';
stringmode.upperlowerByWord('iRever.,se') => 'IrEVER.,SE';
stringmode.upperlowerByWord('is', 'reverse') => 'ISREVERSE';
stringmode.upperlowerByWord('is', 'reverse', 'or', 'mODe') => 'ISREVERSEORModE';
stringmode.upperlowerByWord('is', 'rever()se', 'or', 'mODe') => 'ISREVER()SEORModE';

// upperlowerAndReverseByWord
stringmode.upperlowerAndReverseByWord('i') => 'I';
stringmode.upperlowerAndReverseByWord('is') => 'SI';
stringmode.upperlowerAndReverseByWord('iReverse') => 'ESREVErI';
stringmode.upperlowerAndReverseByWord('iRever.,se') => 'ES,.REVErI';
stringmode.upperlowerAndReverseByWord('is', 'reverse') => 'REVERSEIS';
stringmode.upperlowerAndReverseByWord('is', 'reverse', 'or', 'mODe') => 'ModEORREVERSEIS';
stringmode.upperlowerAndReverseByWord('is', 'rever()se', 'or', 'mODe') => 'ModEORREVER()SEIS';
  1. As examples => Union of the functions.
stringmode.lower(stringmode.underln('lower', 'AND', 'underLN')) => 'lower_and_underln' 
stringmode.upper(stringmode.midln('uppEr', 'AND', 'midln')) => 'UPPER-AND-MIDLN' 

More detail: How to use the function please to see the example of the file which is in the foleder of test => test/stringmode.test.js.