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

typedconverter

Package Overview
Dependencies
Maintainers
1
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedconverter - npm Package Compare versions

Comparing version 1.0.0-alpha.0 to 1.0.0-alpha.1

16

lib/index.d.ts

@@ -1,3 +0,6 @@

declare type ConverterMap = Map<Function, Converter>;
declare type Converter = (value: any, path: string[], expectedType: Function | Function[], converters: ConverterMap) => any;
interface ConverterMap {
key: Function;
converter: Converter;
}
declare type Converter = (value: any, path: string[], expectedType: Function | Function[], converters: Map<Function, Converter>) => any;
declare class ConversionError extends Error {

@@ -18,13 +21,10 @@ issues: {

function dateConverter(rawValue: {}, path: string[]): Date;
function modelConverter(value: {}, path: string[], expectedType: Function | Function[], converters: ConverterMap): any;
function arrayConverter(value: {}[], path: string[], expectedType: Function[], converters: ConverterMap): any;
function modelConverter(value: {}, path: string[], expectedType: Function | Function[], converters: Map<Function, Converter>): any;
function arrayConverter(value: {}[], path: string[], expectedType: Function[], converters: Map<Function, Converter>): any;
}
declare function converter(option?: {
type?: Function | Function[];
converters?: {
key: Function;
converter: Converter;
}[];
converters?: ConverterMap[];
}): (value: any, type?: Function | Function[] | undefined, path?: string[]) => any;
export { Converter, DefaultConverters, ConverterMap, ConversionError };
export default converter;

@@ -18,3 +18,3 @@ "use strict";

function createConversionError(value, typ, path) {
const typeName = Array.isArray(typ) ? `Array<${typ[0].name}>` : typ;
const typeName = Array.isArray(typ) ? `Array<${typ[0].name}>` : typ.name;
return new ConversionError({ path: path, messages: [`Unable to convert "${value}" into ${typeName}`] });

@@ -21,0 +21,0 @@ }

{
"name": "typedconverter",
"version": "1.0.0-alpha.0",
"version": "1.0.0-alpha.1",
"description": "Convert object into classes match with TypeScript type annotation",

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

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