From 50b9ba6b82ac2cc3c7fb5510c3e36a2c86ef46c7 Mon Sep 17 00:00:00 2001 From: David Raznick Date: Wed, 22 Nov 2017 12:12:03 +0000 Subject: [PATCH] Add ordering readme.md and bump version --- README.md | 15 +++++++++++++++ setup.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ee3f0d..c4f2ce8 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ print(result) # {'a': 2, 'b': 3} ``` + Create Patch example ``` @@ -60,6 +61,20 @@ print(patch) # {'a': 2, 'b': 3} ``` +Merge example preserving order. Inputs need to be OrderedDicts. Will error otherwise. +Argument "position" can either be 'first', 'last'. + +``` +import json_merge_patch + +input1 = OrderedDict([("a", 1)]) +input2 = OrderedDict([("a", 1), ("b", 3)]) + +result = json_merge_patch.merge(input1, input2, position="first") +print(result) +# {'b': 3, 'a': 2} +``` + Usage as a command line tool ---------------------------- diff --git a/setup.py b/setup.py index c88adb6..ed49c00 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup setup(name='json-merge-patch', - version='0.1', + version='0.2', description='JSON Merge Patch library (https://tools.ietf.org/html/rfc7386)', author='David Raznick', author_email='mr.raznick@gmail.com',