New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

meteor-simple-schema-transform

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meteor-simple-schema-transform - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

dist/clean.js

2

dist/for-redux-form.js

@@ -27,3 +27,3 @@ 'use strict';

var context = mySchemaObject.namedContext(contextName ? contextName : 'myContext');
if (context.validate(values)) {
if (context.validate(mySchemaObject.clean(values))) {
// isValid

@@ -30,0 +30,0 @@ return {};

{
"name": "meteor-simple-schema-transform",
"version": "1.0.1",
"version": "1.0.2",
"description": "Build validate functions for redux-form from Meteor SimpleSchema",

@@ -5,0 +5,0 @@ "repository": {

@@ -8,7 +8,72 @@ # meteor-simple-schema-transform

## buildValidateForReduxForm
# SST (SimpleSchemaTransform)
A helper to turn a
[Meteor SimpleSchema](https://github.com/aldeed/meteor-simple-schema)
into a validate function for use with
into a variety of translations and transformations,
for use with any other form builder, validator, submitter, etc.
The goal is to make SimpleSchema a portable source, for other libraries.
## Status
This is a very early idea project.
Take a look at this
[forum thread](https://forums.meteor.com/t/simple-schema-redux-form-or-yup-or-formsy-or-formal-for-react/21777)
Also checkout the excellent [uniforms](https://github.com/vazco/uniforms/) project
for a more complete solution for forms (though more tied to Meteor).
## Install
```shell
npm i --save meteor-simple-schema-transform
```
## Usage
There are various parts you may want to use.
Include only those tools you need.
Missing a tool/translation? _(add it and submit a PR)_
### SST.buildClean
Build SimpleSchema into a value cleanup function - clean values object based on schema
```js
// MyContainer
import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import { MyPage } from '../pages/MyPage';
import SST from 'meteor-simple-schema-transform';
const mySchema = new SimpleSchema({
name: {
label: "Friendly Name",
type: String,
min: 3,
max: 30,
}
});
const cleaner = SST.buildClean(mySchema);
export default createContainer(({ params }) => {
// ....
saveData (data) {
Meteor.call('myMethod', cleaner(data), (err) => {
if (err) console.error('Got Error on saveData', err);
});
}
return {
saveData
}
}, MyPage);
```
### SST.forReduxForm.buildValidate
Build SimpleSchema into a validate function for use with
[ReduxForm](http://redux-form.com/)

@@ -33,2 +98,3 @@

const cleaner = SST.buildClean(mySchema);
const validate = SST.forReduxForm.buildValidate(mySchema);

@@ -39,3 +105,3 @@

saveData (data) {
Meteor.call('myMethod', data, (err) => {
Meteor.call('myMethod', cleaner(data), (err) => {
if (err) console.error('Got Error on saveData', err);

@@ -49,2 +115,3 @@ });

}, MyPage);
```

@@ -51,0 +118,0 @@ ## Roadmap

@@ -19,3 +19,3 @@ // A helper to turn a Meteor SimpleSchema

);
if (context.validate(values)) {
if (context.validate(mySchemaObject.clean(values))) {
// isValid

@@ -22,0 +22,0 @@ return {};

@@ -0,6 +1,9 @@

import * as buildClean from './build-clean.js';
import * as forReduxForm from './for-redux-form.js';
//export const forReduxForm;
export buildClean;
export forReduxForm;
export const SimpleSchemaTransform = {
buildClean,
forReduxForm,

@@ -7,0 +10,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc