1.0.50 • Published 2 years ago

json-megatron v1.0.50

Weekly downloads
47
License
MIT
Repository
github
Last release
2 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

2 years ago

1.0.47

2 years ago

1.0.49

2 years ago

1.0.50

2 years ago

1.0.46

2 years ago

1.0.44

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.45

3 years ago

1.0.41

3 years ago

1.0.40

3 years ago

1.0.39

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.27

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago