Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import randomIds from 'uniforms/randomIds';
import createSchema from './_createSchema';
const randomId = randomIds();
const createContext = (schema, context) => ({
context: {
uniforms: {
error: null,
model: {},
name: [],
onChange() {},
onSubmit() {},
...context,
randomId,
schema: createSchema(schema),
state: {
changedMap: {},
import PropTypes from 'prop-types';
import randomIds from 'uniforms/randomIds';
import createSchema from './_createSchema';
const randomId = randomIds();
const createContext = (schema, context) => ({
context: {
uniforms: {
error: null,
model: {},
name: [],
onChange() {},
onSubmit() {},
...context,
randomId,
schema: createSchema(schema),
state: {
changedMap: {},
describe('connectField', () => {
const error = new Error();
const onChange = jest.fn();
const randomId = randomIds();
const state = {
changed: false,
changedMap: {},
submitting: false,
label: true,
disabled: false,
placeholder: false,
showInlineError: true
};
const schema = new SimpleSchemaBridge({
getDefinition(name) {
return {
field: { type: Object, label: 'Field' },
'field.subfield': { type: Number, label: 'Subfield' },
another: { type: String, optional: true }
describe('injectName', () => {
const error = new Error();
const onChange = () => {};
const randomId = randomIds();
const state = {
changed: false,
changedMap: {},
submitting: false,
label: true,
disabled: false,
placeholder: false,
showInlineError: true
};
const schema = new SimpleSchemaBridge({
getDefinition(name) {
return {
fieldA: { type: Object, label: 'FieldA' },
'fieldA.fieldB': { type: Object, label: 'FieldB' },
'fieldA.fieldB.fieldC': { type: String, label: 'FieldC' }
import randomIds from 'uniforms/randomIds'
import createSchema from './uniformsSchema'
const randomId = randomIds()
const createContext = (schema, context) => ({
context: {
uniforms: {
error: null,
model: {},
name: [],
onChange () {},
...context,
randomId,
schema: createSchema(schema),
state: {
changedMap: {},