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

fefe

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fefe - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

7

CHANGELOG.md
# Changelog
## [2.0.1] - 2020-02-26
### Fixed
- Fix `optional()` to allow typescript to create optional keys
## [2.0.0] - 2020-01-31

@@ -4,0 +11,0 @@

5

dist/object.d.ts

@@ -16,3 +16,6 @@ import { Validator } from './validate';

export declare function defaultTo<R>(validator: Validator<R>, _default: R | (() => R)): ObjectOptions<R>;
export declare function optional<R>(validator: Validator<R>): ObjectOptions<R>;
export declare function optional<R>(validator: Validator<R>): {
validator: Validator<R>;
optional: true;
};
export {};

@@ -65,4 +65,9 @@ "use strict";

chai_1.expect(options).to.eql({ validator, optional: true });
const validate = object_1.object({ foo: options });
const result = validate({ foo: 'bar' });
chai_1.expect(result).to.eql({ foo: 'bar' });
const emptyResult = validate({});
chai_1.expect(emptyResult).to.eql({});
});
});
//# sourceMappingURL=object.test.js.map

2

package.json
{
"name": "fefe",
"version": "2.0.0",
"version": "2.0.1",
"description": "Validate, sanitize and transform values with proper types.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -72,5 +72,10 @@ import { expect } from 'chai'

const validator = string()
const options: ObjectOptions<string> = optional(validator)
const options = optional(validator)
expect(options).to.eql({ validator, optional: true })
const validate = object({ foo: options })
const result: { foo?: string } = validate({ foo: 'bar' })
expect(result).to.eql({ foo: 'bar' })
const emptyResult: { foo?: string } = validate({})
expect(emptyResult).to.eql({})
})
})

@@ -78,3 +78,3 @@ import { FefeError } from './errors'

export function optional<R> (validator: Validator<R>): ObjectOptions<R> {
export function optional<R> (validator: Validator<R>): {validator: Validator<R>, optional: true} {
return {

@@ -81,0 +81,0 @@ validator,

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