1.0.17 • Published 6 years ago

jsmp-infra-transformer v1.0.17

Weekly downloads
18
License
ISC
Repository
-
Last release
6 years ago

#SJMP-INFRA-TRANSFORMER

This package is my hometask. Don't download it! But if you want, yo could, why not?

#DESCRIPTION

Has a set of two pure functions, which take string (transformString) orarray (transformArray).

  • transformString arguments: 1) string || null || undefined; 2) object || null || undefined: - repeat (number) - capitalize (boolean)
  • transformArray 1) array || null || undefined; 2) object || null || undefined: - newLength (number) - placeholder (string)

#INSTALLATION

try npm i jsmp-infra-transformer -S

or yarn add jsmp-infra-transformer

#EXAMPLES

You need to import this package into your project

import transformer from 'jsmp-infra-transformer'; //ES6 modules

const transformer = require('jsmp-infra-transformer'); //Old-fashioned syntax

Next you could just use it like this:

const string = 'Hello!';
const transformedString = transformer.transform(string, { repeat: 2 }); // Hello!Hello!
const string = 'heLLO!';
const transformedString = transformer.transform(string, { capitlize: true }); // Hello!
const string = 'hello!';
const transformedString = transformer.transform(string, { repeat: 2, capitlize: true }); // Hello!hello!
const array = [];
const transformedArray = transformer.transform(array, { newLength: 2 }); //[empty × 2]
const array = ['somedata', 'someAnotherData'];
const transformedArray = transformer.transform(array, { placeholder: '@' }); //['@', '@']
const array = ['somedata', 'someAnotherData'];
const transformedArray = transformer.transform(array, { placeholder: '@', newLength: 3 }); //['@', '@', '@']
1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago