This package has been deprecated

Author message:

Moved to ltype_string

lamed_string

1.11.18 • Public • Published

lamed_string

AS A "JavaScript developer" I WANT TO HAVE "I want to manage string function in one place" SO THAT I CAN "reap the benefit in all projects"

Part of See it Done

npm downloads Build Status codecov CodeFactor Code size license

NPM

JavaScript Style Guide

Install

npm

npm i lamed_string -s

yarn

yarn add lamed_string

Usage

Node

const _lstring = require('lamed_string');

Array Functions

Functions Description
Array.replaceAll(find, replace) Replace all occurrences of a string in an array.
Array.toLowerCase() Change array elements to lower case.
Array.toUpperCase() Change array elements to upper case.
Array.includesAny('???') Removes all occurrences of a set of strings in an array
Array.removeAny(Array) Removes all occurrences of a set of strings in an array

## Other functions

Functions Description
'???'.includeAll(???) Test if all argument items are included in String. If argument is array, the array items will be used.
'???'.includeAny(???) Test if any argument items are included in String. If argument is array, the array items will be used.
'???'.replaceAll(find, replace) Replace all occurrences of a string
Date.toStr('/') Outputs the date as yyyy/mm/dd
substring_BetweenChars(str, strStart, strEnd) Returns from str the string between srtStat and strEnd.
object2Str(object, format = false) Convert object to string; @param format - if true then format the object string

Description

'???'.replaceAll(find, replace)

  • Replace all occurrences of a string in an array.
Parameter Description
find The string to search for
replace The string to replace all occurances with

'hello, there, my, pet.'.replaceAll(',', ''); // hello there my pet.


'???'.toLowerCase()

  • Change array elements to lower case.

'HELLO, THERE, MY, PET.'.toLowerCase(',', ''); // hello, there, my, pet.


'???'.toUpperCase()

  • Change array elements to upper case.

'hello, there, my, pet.'.toUpperCase(',', ''); // HELLO, THERE, MY, PET.


'???'.includeAll()

  • Test if all argument items are included in String. If argument is array, the array items will be used.
    /* string parameter */
    "absdefg_aa_bb".includesAll();                  //false
    "absdefg_aa_bb".includesAll('');                //true  - This is useful when search items are not provided
    "absdefg_aa_bb".includesAll(undefined);         //false
    "absdefg_aa_bb".includesAll(null);              //false
    "absdefg_aa_bb".includesAll('a');               //true
    "absdefg_aa_bb".includesAll('a', 'z');          //false
    "absdefg_aa_bb".includesAll('a', 'aa');         //true
    "absdefg_aa_bb".includesAll('a', 'aa', 'bb');   //true
    
    /* array parameter */
    "absdefg_aa_bb".includesAll(['a', 'aa', 'bb']);         //true
    "absdefg_aa_bb".includesAll(['a', 'aa', 'bb', '']);     //true
    "absdefg_aa_bb".includesAll(['a', 'aa', 'bb', 'dd']);   //false

'???'.includeAny()

  • Test if any argument items are included in String. If argument is array, the array items will be used.
     /* string parameter */   
    "absdefg_aa_bb".includesAny();                      //false
    "absdefg_aa_bb".includesAny('');                    //false
    "absdefg_aa_bb".includesAny(undefined);             //false
    "absdefg_aa_bb".includesAny(null);                  //false
    "absdefg_aa_bb".includesAny('a');                   //true
    "absdefg_aa_bb".includesAny('a', 'z');              //true
    "absdefg_aa_bb".includesAny('a', 'aa');             //true
    "absdefg_aa_bb".includesAny('a', 'aa', 'bb', 'g');  //true
    "absdefg_aa_bb".includesAny('z');                   //false
    "absdefg_aa_bb".includesAny(' ');                   //false
    'ROUTE'.includesAny(' ', '{', ';', '/', ':', '.');  //false
    
    /* array parameter */
    "absdefg_aa_bb".includesAny(['a', 'aa', 'bb', 'g']);        //true
    "absdefg_aa_bb".includesAny(['a1', 'aa1', 'bb1', 'g']);     //true
    "absdefg_aa_bb".includesAny(['a1', 'aa1', 'bb1', 'g1']);    //false

Readme

Keywords

none

Package Sidebar

Install

npm i lamed_string

Weekly Downloads

7

Version

1.11.18

License

MIT

Unpacked Size

110 kB

Total Files

21

Last publish

Collaborators

  • perezlamed