1.2.0 • Published 7 years ago

jsmp-infra-test v1.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

This package contains two functions allowing to manipulate with string and arrays.

  1. changeRegister

This function allows to convert string into lower- or upper case depending on provided input params.

Params description:

  • string {string} - Input string, required param
  • register {string} - Register type, optional param. Default to 'upper'.

In case if register is not provided or equal to 'upper', function will return string converted to upper-case In case if equal to 'lower', function will return string converted to lower-case

Usage examples:

  • changeRegister('STRING', 'lower'); // returns 'string'
  • changeRegister('string', 'upper'); // returns'STRING'
  • changeRegister('string'); // returns'STRING'
  1. oddEvenFilter

This function allows to filter array returning either only odd or even values.

Params description:

  • array {array} - Input array, required param
  • numberType {string} - Number types, optional param. Default to 'odd'.

In case if numberType is not provided or equal to 'even', function will return array containing only even values from the original array In case if equal to 'od', function will return array containing only odd values from the original array

Usage examples:

  • oddEvenFilter(1,2,3, 'odd'); // returns 1,3
  • oddEvenFilter(1,2,3); // returns 1,3 as 'odd' is a default filter type
  • oddEvenFilter(1,2,3, 'even'); // returns 2

Have fun :)

1.2.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.0.0

7 years ago