New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 1.1.0 to 1.2.0

1

dist/object.d.ts

@@ -15,3 +15,4 @@ import { Validator } from './validate';

}): (value: unknown) => { [k in keyof D]: ObjectReturnType<D[k]>; };
export declare function defaultTo<R>(validator: Validator<R>, _default: R | (() => R)): ObjectOptions<R>;
export declare function optional<R>(validator: Validator<R>): ObjectOptions<R>;
export {};

@@ -52,2 +52,9 @@ "use strict";

exports.object = object;
function defaultTo(validator, _default) {
return {
validator,
default: _default
};
}
exports.defaultTo = defaultTo;
function optional(validator) {

@@ -54,0 +61,0 @@ return {

@@ -53,2 +53,9 @@ "use strict";

});
describe('defaultTo()', () => {
it('should return an object options object with default value/function', () => {
const validator = string_1.string();
const options = object_1.defaultTo(validator, 'foo');
chai_1.expect(options).to.eql({ validator, default: 'foo' });
});
});
describe('optional()', () => {

@@ -55,0 +62,0 @@ it('should return an optional object options object', () => {

2

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

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

@@ -161,2 +161,4 @@ # fefe

You can use the `optional(validator)` helper to generate an optional key validator with the given `validator`.
### `string(options?)`

@@ -163,0 +165,0 @@

import { expect } from 'chai'
import { FefeError } from './errors'
import { object, optional, ObjectOptions } from './object'
import { object, defaultTo, optional, ObjectOptions } from './object'
import { string } from './string'

@@ -61,2 +61,10 @@

describe('defaultTo()', () => {
it('should return an object options object with default value/function', () => {
const validator = string()
const options: ObjectOptions<string> = defaultTo(validator, 'foo')
expect(options).to.eql({ validator, default: 'foo' })
})
})
describe('optional()', () => {

@@ -63,0 +71,0 @@ it('should return an optional object options object', () => {

@@ -71,2 +71,9 @@ import { FefeError } from './errors'

export function defaultTo<R> (validator: Validator<R>, _default: R | (() => R)): ObjectOptions<R> {
return {
validator,
default: _default
}
}
export function optional<R> (validator: Validator<R>): ObjectOptions<R> {

@@ -73,0 +80,0 @@ return {

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