Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

formstate

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formstate - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# 1.4.0
* Update for how `isArrayLike` needs to be done for latest version of mobx. [ref](https://github.com/formstate/formstate/pull/79)
# 1.3.0

@@ -2,0 +5,0 @@ * `.compose`d `FormState` should run its `validators` as soon as all sub fields have been *validated*. Previously it only ran when sub fields where *validated* and *changed*. This shouldn't cause any need for a refactor as normally `.validate` is only called after a user interaction with fields. [ref](https://github.com/formstate/formstate/issues/66)

13

CONTRIBUTING.md
# Setup
`npm install`
# Run Demos / Tests
# Run Docs / Demos / Tests
* `npm start`
* Visit http://localhost:4000/demos/ Edit `src/scripts/demos.ts`
* Edit tests, see terminal for results
Demos:
* Visit http://localhost:4000/all/, Edit `src/scripts/demos.ts`
Tests:
* See terminal for results, Edit tests
Docs:
* Visit http://localhost:8080, Edit demo/README.md, then refresh the browser.
# Write Docs

@@ -10,0 +17,0 @@ * Edit `demo/README.md`

@@ -54,5 +54,4 @@ import { ComposibleValidatable, Validator } from './types';

* onUpdate is called whenever we change something in our local state that is significant
* - value
* - $
* - error
* - any validation() call
* - any reset() call
*/

@@ -59,0 +58,0 @@ onUpdate: (handler: (state: FieldState<TValue>) => any) => this;

@@ -63,5 +63,4 @@ "use strict";

* onUpdate is called whenever we change something in our local state that is significant
* - value
* - $
* - error
* - any validation() call
* - any reset() call
*/

@@ -68,0 +67,0 @@ this.onUpdate = function (handler) {

import { ComposibleValidatable, Validator } from './types';
/** Each key of the object is a validatable */
export declare type ValidatableMapOrArray = {
export declare type ValidatableMapOrArray =
/** Mode: object */
{
[key: string]: ComposibleValidatable<any>;

@@ -5,0 +7,0 @@ }

@@ -9,6 +9,7 @@ "use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -48,2 +49,5 @@ });

var types_1 = require("./types");
function isArrayLike(x) {
return Array.isArray(x) || mobx_1.isObservableArray(x);
}
/**

@@ -113,3 +117,3 @@ * Just a wrapper around the helpers for a set of FieldStates or FormStates

};
this.mode = mobx_1.isArrayLike($) ? 'array' : utils_1.isMapLike($) ? 'map' : 'object';
this.mode = isArrayLike($) ? 'array' : utils_1.isMapLike($) ? 'map' : 'object';
/** If they didn't send in something observable make the local $ observable */

@@ -116,0 +120,0 @@ if (!mobx_1.isObservable(this.$)) {

@@ -9,6 +9,7 @@ "use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -15,0 +16,0 @@ });

{
"name": "formstate",
"version": "1.3.0",
"version": "1.4.0",
"description": "Painless and simple MobX form management",

@@ -8,10 +8,14 @@ "main": "./lib/index.js",

"scripts": {
"build": "tsc -p .",
"unittest": "mocha ./lib/tests/**/*.js",
"test": "npm run build && npm run unittest",
"docs": "docute ./docs",
"demos": "eze ./src/scripts/demos",
"tsc:build": "tsc -p .",
"test:build": "mocha ./lib/tests/**/*.js",
"demos:build": "eze ./src/scripts/demos.ts",
"docs:build": "echo 'docute needs no build'",
"tsc:start": "tsc -p . -w --preserveWatchOutput",
"test:start": "mocha ./lib/tests/**/*.js --watch",
"demos:start": "npm run demos:build -- --serve",
"docs:start": "docute ./demo",
"build": "npm run tsc:build && npm run test:build && npm run demos:build && npm run docs:build",
"start": "npm run tsc:build && concurrently \"npm run tsc:start\" \"npm run test:start\" \"npm run demos:start\" \"npm run docs:start\"",
"preversion": "npm run build",
"postversion": "git push --follow-tags && npm publish",
"start": "ts-node ./src/starts",
"publishdocs": "ts-node ./src/scripts/publishdocs.ts"

@@ -35,23 +39,25 @@ },

"devDependencies": {
"@material-ui/core": "3.9.2",
"@types/fs-extra": "5.0.5",
"@types/mocha": "^5.2.6",
"@types/node": "^11.9.5",
"@types/react": "16.8.5",
"@types/react-dom": "16.8.2",
"csstips": "0.3.0",
"eze": "0.10.10",
"fs-extra": "^7.0.1",
"gh-pages": "^2.0.1",
"mobx": "5.9.0",
"mobx-react": "5.4.3",
"mocha": "6.0.2",
"@material-ui/core": "4.9.3",
"@types/fs-extra": "8.0.0",
"@types/mocha": "5.2.6",
"@types/node": "12.7.4",
"@types/react": "16.9.2",
"@types/react-dom": "16.9.0",
"concurrently": "4.1.2",
"csstips": "1.1.0",
"docute-cli": "0.6.0",
"eze": "0.12.0",
"fs-extra": "8.1.0",
"gh-pages": "2.1.1",
"mobx": "5.13.0",
"mobx-react": "6.1.3",
"mocha": "6.2.0",
"moment": "2.24.0",
"react": "16.8.3",
"react-dom": "16.8.3",
"starts": "^0.8.0",
"ts-node": "8.0.2",
"typescript": "3.3.3333",
"typestyle": "2.0.1"
"react": "16.9.0",
"react-dom": "16.9.0",
"starts": "0.8.0",
"ts-node": "8.3.0",
"typescript": "3.6.2",
"typestyle": "2.0.4"
}
}

@@ -39,1 +39,5 @@ # FormState

[npm-url]:https://npmjs.org/package/formstate
# Related Work
We built FormState with our own opinions. It's totally fine if there are problems on which you hold different points with us. [formstate-x](https://github.com/qiniu/formstate-x) is another library which offers similar API, but with some different opinions, which you may want to have a try.

@@ -88,5 +88,4 @@ import { observable, action, computed, runInAction } from 'mobx';

* onUpdate is called whenever we change something in our local state that is significant
* - value
* - $
* - error
* - any validation() call
* - any reset() call
*/

@@ -93,0 +92,0 @@ @action public onUpdate = (handler: (state: FieldState<TValue>) => any) => {

@@ -1,5 +0,9 @@

import { action, computed, isArrayLike, isObservable, observable, runInAction } from 'mobx';
import { action, computed, isObservable, isObservableArray, IObservableArray, observable, runInAction } from 'mobx';
import { isMapLike } from "../internal/utils";
import { applyValidators, ComposibleValidatable, Validator } from './types';
function isArrayLike(x: any): x is any[] | IObservableArray {
return Array.isArray(x) || isObservableArray(x);
}
/** Each key of the object is a validatable */

@@ -6,0 +10,0 @@ export type ValidatableMapOrArray =

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