@creatrix/common
v1.0.5
Published
Javacript html entities, youtube image, string replace etc....
Downloads
6
Maintainers
Readme
installation
yarn add @creatrix/common
OR
npm i @creatrix/common
example
import {entity} from '@creatrix/common';
const mytitle=entity(`Michek&49;s`); <!-- result: Michel's-->
import {entityReplace} from '@creatrix/common';
const mytitle=entityReplace(`Michek&49;s`,'INTIAL STRING IF EMPTY'); <!-- result: Michel's-->
const mytitle=entityReplace(``,'INTIAL STRING IF EMPTY'); <!-- result: INTIAL STRING IF EMPTY-->
import {StringReplace} from '@creatrix/common';
const mytitle=StringReplace('hello %s','demo','%s'); <!-- result: hello demo-->
import {mutliStringReplace} from '@creatrix/common';
const mytitle=mutliStringReplace({':rowid':'12',':filter':'none'},'/path/:rowid/:filter'); <!-- result: /path/12/none-->
import {ArabicNumbers} from '@creatrix/common';
const mytitle=ArabicNumbers(`1`); <!-- result: ۱ -->
import {ImageYoutube} from '@creatrix/common';
const mytitle=ImageYoutube(`Wq3vimf`); <!-- result: https://img.youtube.com/vi/Wq3vimf/hqdefault.jpg -->
import {getYoutubeVideoID} from '@creatrix/common';
const mytitle=ArabicNumbers(`https://youtu.be/Wq3vimf`); <!-- result: Wq3vimf -->
import {FirstCharOfEachWord} from '@creatrix/common';
const mytitle=FirstCharOfEachWord(`Hello Demo Word`); <!-- result: HDW -->
import {FirstChar} from '@creatrix/common';
const mytitle=FirstChar(`Hello Demo Word`); <!-- result: H -->
import {SizeMBToB} from '@creatrix/common';
const mytitle=SizeMBToB(1); <!-- result: 1,048,576 -->
import {SizeBToMB} from '@creatrix/common';
const mytitle=SizeBToMB(1,048,576); <!-- result: 1 -->
import {SizeKBToMB} from '@creatrix/common';
const mytitle=SizeKBToMB(1024); <!-- result: 1 -->
import {spacetoDash} from '@creatrix/common';
const mytitle=spacetoDash("Hello Word"); <!-- result: Hello-Word -->
import {GetValueKeyOfArray} from '@creatrix/common';
const FromArray=[{id:1,value:Hello},{id:2,value:Word}];
const fromKey='id';
const fromvalue='2';
const selectedkey='value';
const mytitle=GetValueKeyOfArray(FromArray,fromKey,fromvalue,selectedkey); <!-- result: Word -->
import {AddKeyToObject2Steps} from '@creatrix/common';
const FromObject={pageurl:{url:'http',params:{title:'hello'}},otherdata:'demo'};
const mytitle=AddKeyToObject2Steps(FromObject,'pageurl','params',{newdata:'we are here'}); <!-- result: {pageurl:{url:'http',params:{title:'hello',newdata:'we are here' <!--data is added here--> }},otherdata:'demo'} -->