1.0.50 • Published 3 years ago

json-megatron v1.0.50

Weekly downloads
47
License
MIT
Repository
github
Last release
3 years ago

Megatron Megatron Coverage Status

Install

yarn add json-megatron

Use

const Megatron = require('json-megatron');

Examples

Return a simple value and parse from string to number

const template = {
 newValue: {
   type: 'number',
   path: '$.value',
 }
};

const input = {
  value: '10',
};

const result = Megatron(template, input);

// result
{
  "newValue": 10,
}

Example with text-transform

We use lib TextTranform to offer string transformations.

const template = {
   newValue: {
     type: 'string',
     path: '$.value',
     textTransform: 'uppercase',
   },
 };

const input = {
  value: 'Testing',
};

const result = Megatron(template, input);

// result
{
  "newValue": 'TESTING',
}

Example with string-mask

We use lib StringMask to offer mask for strings.

const template = {
   newValue: {
     type: 'string',
     path: '$.value',
     stringMask: '000.000.000-00',
   },
 };

const input = {
  value: 12965815620,
};

const result = Megatron(template, input);

// result
{
  "newValue": '129.658.156-20',
}

Properties

1.0.48

4 years ago

1.0.47

4 years ago

1.0.49

3 years ago

1.0.50

3 years ago

1.0.46

4 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.45

4 years ago

1.0.41

4 years ago

1.0.40

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.27

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago