@berish/serber
Advanced tools
Comparing version 1.3.0 to 1.4.0
import { ISerberPlugin, ISerberPluginDefaultParams } from './types'; | ||
export interface SerberInstanceParams { | ||
throwWhenError?: boolean; | ||
} | ||
export declare class Serber<Params extends { | ||
@@ -6,2 +9,4 @@ [key: string]: any; | ||
private _plugins; | ||
private _params; | ||
constructor(params?: SerberInstanceParams); | ||
get plugins(): ISerberPlugin<any, any, any>[]; | ||
@@ -8,0 +13,0 @@ addPlugin<TParams>(plugin: ISerberPlugin<any, any, TParams>): Serber<Params & TParams>; |
@@ -14,4 +14,5 @@ "use strict"; | ||
class Serber { | ||
constructor() { | ||
constructor(params) { | ||
this._plugins = []; | ||
this._params = null; | ||
this.serialize = (obj, params) => { | ||
@@ -43,2 +44,4 @@ params = params || {}; | ||
catch (err) { | ||
if (this._params.throwWhenError) | ||
throw err; | ||
errors.push(err); | ||
@@ -89,2 +92,4 @@ } | ||
catch (err) { | ||
if (this._params.throwWhenError) | ||
throw err; | ||
errors.push(err); | ||
@@ -125,2 +130,4 @@ } | ||
catch (err) { | ||
if (this._params.throwWhenError) | ||
throw err; | ||
errors.push(err); | ||
@@ -171,2 +178,4 @@ } | ||
catch (err) { | ||
if (this._params.throwWhenError) | ||
throw err; | ||
errors.push(err); | ||
@@ -181,2 +190,3 @@ } | ||
}); | ||
this._params = params || {}; | ||
} | ||
@@ -183,0 +193,0 @@ get plugins() { |
{ | ||
"name": "@berish/serber", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Serializable and deserializable adaptive adapter with plugins", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
84920
943