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

tiny-decoders

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-decoders - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

9

CHANGELOG.md

@@ -0,3 +1,12 @@

### Version 2.0.0 (2019-06-07)
- Changed: `mixedArray` now returns `$ReadOnlyArray<mixed>` instead of
`Array<mixed>`. See this Flow issue for more information:
<https://github.com/facebook/flow/issues/7684>
- Changed: `mixedDict` now returns `{ +[string]: mixed }` (readonly) instead of
`{ [string]: mixed }`. See this Flow issue for more information:
<https://github.com/facebook/flow/issues/7685>
### Version 1.0.0 (2018-11-13)
- Initial release.

4

dist/index.d.ts

@@ -11,5 +11,5 @@ // TODO: TypeScript Version: 3.0

export function mixedArray(value: unknown): Array<unknown>;
export function mixedArray(value: unknown): ReadonlyArray<unknown>;
export function mixedDict(value: unknown): { [key: string]: unknown };
export function mixedDict(value: unknown): { readonly [key: string]: unknown };

@@ -16,0 +16,0 @@ export function constant<

"use strict";
exports.__esModule = true;
exports.boolean = boolean;
exports["boolean"] = _boolean;
exports.number = number;

@@ -25,3 +25,3 @@ exports.string = string;

// strict
function boolean(value) {
function _boolean(value) {
if (typeof value !== "boolean") {

@@ -180,4 +180,5 @@ throw new TypeError("Expected a boolean, but got: " + repr(value));

function optional(decoder, // This parameter is implicitly optional since `U` is allowed to be `void`
// (undefined), but don’ mark it with a question mark `defaultValue?: U`
// (undefined), but don’ mark it with a question mark (`defaultValue?: U`)
// because that causes `name: optional(string)` in the `User` test in
// `flow/user.js` not to be an error for a `name: string` type annotation!
defaultValue) {

@@ -184,0 +185,0 @@ return function optionalDecoder(value) {

{
"name": "tiny-decoders",
"version": "1.0.0",
"version": "2.0.0",
"license": "MIT",

@@ -37,26 +37,26 @@ "author": "Simon Lydell",

"devDependencies": {
"@babel/cli": "7.1.5",
"@babel/core": "7.1.5",
"@babel/preset-env": "7.1.5",
"@babel/cli": "7.4.4",
"@babel/core": "7.4.5",
"@babel/preset-env": "7.4.5",
"@babel/preset-flow": "7.0.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-jest": "23.6.0",
"decoders": "1.10.6",
"doctoc": "1.3.1",
"dtslint": "0.3.0",
"eslint": "5.9.0",
"eslint-config-lydell": "11.0.0",
"eslint-plugin-flowtype": "3.2.0",
"eslint-plugin-flowtype-errors": "3.6.0",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jest": "22.0.0",
"eslint-plugin-prettier": "3.0.0",
"eslint-plugin-sort-imports-es6-autofix": "0.3.0",
"flow-bin": "0.86.0",
"jest": "23.6.0",
"npm-run-all": "4.1.3",
"prettier": "1.15.2",
"babel-jest": "24.8.0",
"decoders": "1.14.0",
"doctoc": "1.4.0",
"dtslint": "0.7.8",
"eslint": "5.16.0",
"eslint-config-lydell": "14.0.0",
"eslint-plugin-flowtype": "3.9.1",
"eslint-plugin-flowtype-errors": "4.1.0",
"eslint-plugin-import": "2.17.3",
"eslint-plugin-jest": "22.6.4",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-simple-import-sort": "3.1.1",
"flow-bin": "0.100.0",
"jest": "24.8.0",
"npm-run-all": "4.1.5",
"prettier": "1.18.0",
"shelljs": "0.8.3"
}
}

@@ -348,7 +348,6 @@ # tiny-decoders [![Build Status][travis-badge]][travis-link] ![no dependencies][deps-tiny-decoders] [![minified size][min-tiny-decoders]][bundlephobia-tiny-decoders]

// You can use `field` with `group` to rename keys on a record.
const personDecoder = (mixed) =>
(Person = group({
firstName: field("first_name", string),
lastName: field("last_name", string),
}));
const personDecoder: (mixed) => Person = group({
firstName: field("first_name", string),
lastName: field("last_name", string),
});

@@ -655,3 +654,3 @@ type Point = {|

`(value: mixed) => Array<mixed>`
`(value: mixed) => $ReadOnlyArray<mixed>`

@@ -669,3 +668,3 @@ Usually you want to use [array] instead. `array` actually uses this decoder

`(value: mixed) => { [string]: mixed }`
`(value: mixed) => { +[string]: mixed }`

@@ -786,3 +785,3 @@ Usually you want to use [dict] or [record] instead. `dict` and `record` actually

The errors of tiny-decoders are shorter and a little bit more cryptic. As
opposed to [nive/decoders], it stops at the _first_ error in a record (instead
opposed to [nvie/decoders], it stops at the _first_ error in a record (instead
of showing them all). First, the missing “id” field:

@@ -827,3 +826,3 @@

You can need [Node.js] 10 and npm 6.
You need [Node.js] 10 and npm 6.

@@ -830,0 +829,0 @@ ### npm scripts

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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