From 6eee1b709e3ac985cf698cc87cb404e2ea040f7a Mon Sep 17 00:00:00 2001
From: Madeorsk
- +
## Introduction @@ -27,7 +27,7 @@ Sharkitek is a Javascript / TypeScript library designed to ease development of client-side models. With Sharkitek, you define the architecture of your models by specifying their properties and their types. -Then, you can use the defined methods like `serialize`, `deserialize`, `save` or `serializeDiff`. +Then, you can use the defined methods like `serialize`, `deserialize`, `patch` or `serializeDiff`. ```typescript class Example extends s.model({ @@ -227,7 +227,7 @@ const result = model.serializeDiff(); // result = {} ``` -#### `save()` +#### `patch()` Get difference between original values and current ones, then reset it. Similar to call `serializeDiff()` then `resetDiff()`. @@ -246,7 +246,7 @@ const model = (new TestModel()).deserialize({ model.title = "A new title for a new world"; -const result = model.save(); +const result = model.patch(); // if `id` is defined as the model identifier: // result = { id: 5, title: "A new title for a new world" } // if `id` is not defined as the model identifier: diff --git a/package.json b/package.json index 23a9cdc..8e1478d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sharkitek/core", - "version": "3.2.2", + "version": "3.3.0", "description": "TypeScript library for well-designed model architectures.", "keywords": [ "deserialization", diff --git a/src/Model/Model.ts b/src/Model/Model.ts index 36b4daa..c9a3d2d 100644 --- a/src/Model/Model.ts +++ b/src/Model/Model.ts @@ -105,7 +105,7 @@ export interface ModelDefinition