1.0.3 • Published 5 years ago

jsmp-infra-test-k-package v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

jsmp-infra-test-k-package

Contains functions that update string or array and return it.


###Installation

npm install jsmp-infra-test-k-package

###Functions

camelCase(string, case);

Arguments

string - the string to convert. case - type of case to convert.

Returns

Returns the changed string. If no case type is specified, transforms to camelcase by default. If no arguments are given, returns an empty string.


changeArray(array, action);

Arguments

array - the array to convert. action - conversion type.

Returns

Returns the changed array. If no action type is specified, returns the same array. If no arguments are given, returns an empty array.

###Usage examples

const {changeCase} = require('jsmp-infra-test-k-package');

changeCase('Foo Bar', 'camel');         //'fooBar'
changeCase('--foo-bar--', 'camel');     //'fooBar'
changeCase('__FOO_BAR__', 'camel');     //'fooBar'

changeCase('Foo Bar', 'kebab');         //'foo-bar'
changeCase('fooBar', 'kebab');          //'foo-bar'
changeCase('__FOO_BAR__', 'kebab');     //'foo-bar'

changeCase('--Foo-Bar--', 'lower');     //'foo bar'
changeCase('fooBar', 'lower');          //'foo bar'
changeCase('__FOO_BAR__', 'lower');     //'foo bar'

changeCase('Foo Bar', 'snake');         //'foo_bar'
changeCase('fooBar', 'snake');          //'foo_bar'
changeCase('--FOO-BAR--', 'snake');     //'foo_bar'

changeCase('--foo-bar--', 'start');     //'Foo Bar'
changeCase('fooBar', 'start');          //'Foo Bar'
changeCase('__FOO_BAR__', 'start');     //'FOO BAR'

changeCase('--foo-bar', 'upper');       //'FOO BAR'
changeCase('fooBar', 'upper');          //'FOO BAR'
changeCase('__foo_bar__', 'upper');     //'FOO BAR'

changeCase('Foo Bar');                  //'fooBar'
changeCase('--foo-bar--');              //'fooBar'
changeCase('__FOO_BAR__');              //'fooBar'

changeCase();                           //''

const {changeArray} = require('jsmp-infra-test-k-package');

changeArray([1, [2, [3, [4]], 5]], 'flatten');      //[1, 2, 3, 4, 5]

changeArray([1, 2, 3], 'reverse');                  //[3, 2, 1]

changeArray([0, 1, false, 2, '', 3], 'compact');    //[1, 2, 3]

changeArray([1, 2, 3]);                             //[1, 2, 3]

changeArray();                                      //[]
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago