KO
|
EN
gitlite โ search
Search
#javascript
#ios
#css
#python
#swift
#gulp
#html
#wordpress
#php
#objective-c
#hacktoberfest
#promise
mendoza-js
โ 46
Open GitHub โ
Mendoza decoder in TypeScript
Download README (.md)
Explore Similar Repositories
Federated-XGBoost
:
Federated Learning on XGBoost
ClimateSatellite.jl
:
Julia package that downloads satellite measurements and observational data
eldar
:
Boolean text search in Python
Attack-Adaptive-Aggregation-in-Federated-Learning
:
This is the code for our paper `Robust Federated Learning with Attack-Adaptive Aggregation' accepted by FTL-IJCAI'21.
ansible
:
๐๏ธ Ansible Playbooks
// repository documentation
Was this content helpful?
โ 0
(0 ratings)
Select Rating:
โ
โ
โ
โ
โ
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
mendoza-js
?
Download (.md)
# mendoza-js [](https://npm-stat.com/charts.html?package=mendoza) [](https://www.npmjs.com/package/mendoza) [![gzip size][gzip-badge]][bundlephobia] [![size][size-badge]][bundlephobia] [Mendoza](https://github.com/sanity-io/mendoza) decoder in TypeScript. ## Installation ```bash npm install mendoza ``` or ```bash pnpm install mendoza ``` or ```bash yarn add mendoza ``` ## Usage Basic example: ```typescript import {applyPatch} from "mendoza" let left = {โฆ}; let patch = [โฆ]; let right = applyPatch(left, patch); ``` Incremental patcher: ```typescript import {incremental} from "mendoza" const {Value, rebaseValue, wrap, unwrap, getType, applyPatch} = incremental // Create an empty initial version: const ROOT = wrap(null, null); // Input of patches: let patches = [โฆ]; // `origin` can be whatever you want to identify where a change comes from: let origin = 0; // Reference to the latest version: let value = ROOT; // Rebasing is for maintaing history across deleted versions: let rebaseTarget; for (let patch of patches) { // Apply the patch: let newValue = applyPatch(value, patch, origin); // Rebase if needed: if (rebaseTarget) { newValue = rebaseValue(rebaseTarget, newValue); } // If the document was deleted, store the previous version so we can rebase: if (getType(newValue) === "null") { rebaseTarget = value; } else { rebaseTarget = null; } value = newValue; origin++; } // Return the final full object: console.log(unwrap(value)); ``` ## License MIT ยฉ [Sanity.io](https://www.sanity.io/) ## Release new version Run the ["CI & Release" workflow](https://github.com/sanity-io/mendoza-js/actions). Make sure to select the main branch and check "Release new version". Semantic release will only release on configured branches, so it is safe to run release on any branch. [gzip-badge]: https://img.shields.io/bundlephobia/minzip/mendoza?label=gzip%20size&style=flat-square [size-badge]: https://img.shields.io/bundlephobia/min/mendoza?label=size&style=flat-square [bundlephobia]: https://bundlephobia.com/package/mendoza