![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
JSON transformer for use in data hygene and proxy
let jsonitron = require('jsonitron');
let userTransformer = new jsonitron.Transformer();
userTransformer.use(jsonitron.Factory.renameKey('name', 'full_name'));
userTransformer.use(jsonitron.Factory.upperCase('full_name'));
userTransformer.use(jsonitron.Factory.upperCase('friends.*.name.first'));
userTransformer.use(jsonitron.Factory.upperCase('friends.*.name.last'));
userTransformer.use(jsonitron.Factory.new('friends.*.phone', function (val, key) {
let match = ((val || '').match(/(^\d{3,3})(\d{3,3})(\d{4,4})$/) || [])
match.shift();
this.setVal(match.join('-'));
}));
let result = userTransformer.exec({
name: 'john hof',
friends: [{
phone: '1232341234',
name: {
first: 'joe',
last: 'smith'
}
}, {
phone: '2342342345',
name: {
first: 'jenny',
last: 'doe'
}
}]
});
console.log(result);
// => {
// full_name: 'JOHN HOF',
// friends: [{
// phone: '123-234-1234',
// name: {
// first: 'JOE',
// last: 'SMITH'
// }
// }, {
// phone: '234-234-2345',
// name: {
// first: 'JENNY',
// last: 'DOE'
// }
// }]
// }
Class for creating a reusable transformation
Object
[optional]
config.name
(String
) - Name of the transformconfig.path
(String
) - Path to match and perform the actionconfig.params
: (Mixed
) - Params to be passed to the action in addition to key
and value
config.action
(Function
) - Action to be performed// EXAMPLE ACTION:
// { user_details.name: 'john hof' }
// becomes
// { user_details.full_name: 'JOHN HOF' }
let fooTransform = new jsonitron.Transfrom({
name: 'foo',
path: 'user_details.name',
params: 'foo',
action: function (value, key, params) {
this.setVal(value.toUpperCase()); // OR .setValue
this.setkey('full_name');
}
});
String
prop.subProps[0].foo
*
as a wildcard: prop.subProps.*.foo
fooTransform.setPath(`prop.subProps.*.foo`);
// Applies to all elements in subProps:
// {
// prop: {
// subProps: [
// { foo: 'bar' }
// { foo: 'baz' }
// ]
// }
// }
//
// AND
// {
// prop: {
// subProps: {
// biz: { foo: 'bar' }
// faz: { foo: 'baz' }
// }
// }
// }
String
fooTransform.setName('fooRenamed');
Function
(value, key, params)
[READ ONLY]this
- refers to:
this.setKey('String')
- update the key name of the propertythis.setValue
- update the value of the properythis.setVal
- see this.setValue
fooTransform.setAction(function (value, key, params) {
this.setVal(value.toUpperCase()); // OR .setValue
this.setkey('full_name');
});
Object
Object
) result of the transformlet result = fooTransform.exec({ object: { to: ['transform'] } });
Utility for generating and accessing transforms
path
(String
)[required] - path to matchaction
(Function
)[required] - action to perform (see Transform object documentation)params
(Mixed
)[optional] - additional params to pass to the actionname
(String
)[optional] - name of the transformObject
) result of the transformjsonitron.Factory.build('foo.bar', function (v, k, p) {
// See Transfrom object documentation
} , { some: 'param' }, 'fooTransform');
name
(String
) - unique name of the transformaction
(Function
) - action to perform (see Transform object documentation)jsonitron.Factory.register('fooAction', function (v, k, p) {
// See Transfrom object documentation
});
jsonitron.Factory.fooAction('foo.bar') // returns new Transform
jsonitron.Factory.createFooAction('foo.bar') // returns new Transform
jsonitron.Factory.buildFooAction('foo.bar') // returns new Transform
jsonitron.Factory.newFooAction('foo.bar') // returns new Transform
.upperCase(path)
- EXAMPLE OUTPUT.camelCas(path)e
- exmapleOutput.constantCase(path)
- EXAMPLE_OUTPUT.dotCase(path)
- example.output.headerCase(path)
- Example-Output.lowerCase(path)
- example output.lowerFirstCase(path)
- eXAMPLE OUTPUT.noCase(path)
- example output.paramCase(path)
- example-output.pascalCase(path)
- ExampleOutput.pathCase(path)
- example/output.sentenceCase(path)
- Example output.snakeCase(path)
- exmaple_output.swapCase(path)
- eXAMPLE oUTPUT.titleCase(path)
- Example Output.upperCase(path)
- EXAMPLE OUTPUT.upperFirstCase(path)
- Example output.upperCaseKey(path)
- EXAMPLE OUTPUT.camelCasKey(path)
- exmapleOutput.constantCaseKey(path)
- EXAMPLE_OUTPUT.dotCaseKey(path)
- example.output.headerCaseKey(path)
- Example-Output.lowerCaseKey(path)
- example output.lowerFirstCaseKey(path)
- eXAMPLE OUTPUT.noCaseKey(path)
- example output.paramCaseKey(path)
- example-output.pascalCaseKey(path)
- ExampleOutput.pathCaseKey(path)
- example/output.sentenceCaseKey(path)
- Example output.snakeCaseKey(path)
- exmaple_output.swapCaseKey(path)
- eXAMPLE oUTPUT.titleCaseKey(path)
- Example Output.upperCaseKey(path)
- EXAMPLE OUTPUT.upperFirstCaseKey(path)
- Example output.renameKey(path, newName)
{ test: 'foo '}
=> renameKey('test', 'bar')
=> { bar: 'foo' }
A thin wrapper to execute a set of transforms
let transformer = new jsonitron.Transfromer();
Transform
(Function
)[required] - transform to be executedtransformer.use(TransformFactory.upperCase('foo.bar'));
Transform
(Function
)[required] - transform to be executedtransformer.useAll([
TransformFactory.upperCase('foo.bar'),
TransformFactory.lowerCase('foo.biz'),
]);
Object
Object
) result of the transformslet result = transformer.exec({ object: { to: ['transform'] } });
FAQs
Json transformer for use in data hygene and proxy
The npm package jsonitron receives a total of 2 weekly downloads. As such, jsonitron popularity was classified as not popular.
We found that jsonitron demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.