-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from odogono/chore/8-clean-and-update
chore/8 clean and update
- Loading branch information
Showing
12 changed files
with
231 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Used by "mix format" | ||
[ | ||
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"] | ||
] | ||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,36 @@ | ||
/_build | ||
/deps | ||
# The directory Mix will write compiled artifacts to. | ||
/_build/ | ||
|
||
# If you run "mix test --cover", coverage assets end up here. | ||
/cover/ | ||
|
||
# The directory Mix downloads your dependencies sources to. | ||
/deps/ | ||
|
||
# Where third-party dependencies like ExDoc output generated docs. | ||
/doc/ | ||
|
||
# Ignore .fetch files in case you like to edit your project deps locally. | ||
/.fetch | ||
|
||
# If the VM crashes, it generates a dump, let's ignore it too. | ||
erl_crash.dump | ||
|
||
# Also ignore archive artifacts (built via "mix archive.build"). | ||
*.ez | ||
|
||
# Ignore package tarball (built via "mix hex.build"). | ||
elixir_jason_test-*.tar | ||
|
||
# Temporary files, for example, from tests. | ||
/tmp/ | ||
*~ | ||
|
||
# Ignore macOS files | ||
.DS_Store | ||
node_modules | ||
doc | ||
.elixir_ls | ||
|
||
# Ignore editor files | ||
.elixir_ls | ||
|
||
# Ignore vscode files | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
language: elixir | ||
elixir: | ||
- 1.8 | ||
- 1.9 | ||
- 1.17 | ||
otp_release: | ||
- 22.0 | ||
- 26.0 | ||
sudo: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,75 @@ | ||
ODGN JSONPointer | ||
================= | ||
# ODGN JSONPointer | ||
|
||
[![Build Status](https://travis-ci.org/odogono/elixir-jsonpointer.svg?branch=master)](https://travis-ci.org/odogono/elixir-jsonpointer) | ||
[![Hex.pm](https://img.shields.io/hexpm/v/odgn_json_pointer.svg?style=flat-square)](https://hex.pm/packages/odgn_json_pointer) | ||
|
||
[![Module Version](https://img.shields.io/hexpm/v/odgn_json_pointer.svg)](https://hex.pm/packages/odgn_json_pointer) | ||
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/odgn_json_pointer/) | ||
[![Total Download](https://img.shields.io/hexpm/dt/odgn_json_pointer.svg)](https://hex.pm/packages/odgn_json_pointer) | ||
[![License](https://img.shields.io/hexpm/l/odgn_json_pointer.svg)](https://github.com/odogono/elixir-jsonpointer/blob/master/LICENSE.md) | ||
[![Last Updated](https://img.shields.io/github/last-commit/odogono/elixir-jsonpointer.svg)](https://github.com/odogono/elixir-jsonpointer/commits/master) | ||
|
||
An implementation of [JSON Pointer (RFC 6901)](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08) for Elixir. | ||
|
||
|
||
## Installation | ||
|
||
Add a dependency to your project `mix.exs`: | ||
|
||
```Elixir | ||
```elixir | ||
def deps do | ||
[{:odgn_json_pointer, "~> 3.0.1"}] | ||
[ | ||
{:odgn_json_pointer, "~> 3.1.0"} | ||
] | ||
end | ||
``` | ||
|
||
## Basic Usage | ||
|
||
```Elixir | ||
```elixir | ||
iex> JSONPointer.get( %{ "fridge" => %{ "door" => "milk" } }, "/fridge/door" ) | ||
{:ok, "milk"} | ||
|
||
|
||
iex> JSONPointer.set( %{}, "/example/msg", "hello") | ||
{:ok, %{ "example" => %{ "msg" => "hello" }}, nil } | ||
|
||
|
||
iex> JSONPointer.add( %{ "fridge" => [ "milk", "cheese" ]}, "/fridge/1", "salad") | ||
{:ok, %{ "fridge" => [ "milk", "salad", "cheese" ]}, [ "milk", "cheese" ] } | ||
|
||
|
||
iex> JSONPointer.has?( %{ "milk" => true, "butter" => false}, "/butter" ) | ||
true | ||
|
||
|
||
iex> JSONPointer.test( %{ "milk" => "skimmed", "butter" => false}, "/milk", "skimmed" ) | ||
{:ok, %{ "milk" => "skimmed", "butter" => false} } | ||
|
||
|
||
iex> JSONPointer.remove( %{"fridge" => %{ "milk" => true, "butter" => true}}, "/fridge/butter" ) | ||
{:ok, %{"fridge" => %{"milk"=>true}}, true } | ||
|
||
|
||
iex> JSONPointer.dehydrate( %{"a"=>%{"b"=>["c","d"]}} ) | ||
{:ok, [{"/a/b/0", "c"}, {"/a/b/1", "d"}] } | ||
|
||
|
||
iex> iex> JSONPointer.hydrate( [ {"/a/1/b", "single"} ] ) | ||
{:ok, %{"a" => %{"1" => %{"b" => "single"}}}} | ||
|
||
|
||
iex> JSONPointer.merge( %{"a"=>1}, %{"b"=>2} ) | ||
{:ok, %{"a"=>1,"b"=>2} } | ||
|
||
|
||
iex> JSONPointer.transform( %{ "a"=>4, "b"=>%{ "c" => true }}, [ {"/b/c", "/valid"}, {"/a","/count", fn val -> val*2 end} ] ) | ||
{:ok, %{"count" => 8, "valid" => true}} | ||
|
||
``` | ||
|
||
Full documentation can be found at https://hexdocs.pm/odgn_json_pointer. | ||
|
||
## Acknowledgement | ||
|
||
Inspiration from https://github.com/manuelstofer/json-pointer | ||
|
||
## Ack | ||
|
||
inspiration from https://github.com/manuelstofer/json-pointer | ||
|
||
made without peeking (much) at the source of https://github.com/xavier/json_pointer | ||
Made without peeking (much) at the source of https://github.com/xavier/json_pointer | ||
|
||
Made in Exeter, UK. | ||
|
||
|
||
## License | ||
## Copyright and License | ||
|
||
Copyright (c) 2024 Alexander Veenendaal | ||
|
||
This software is licensed under [the MIT license](LICENSE.md). | ||
This work is free. You can redistribute it and/or modify it under the | ||
terms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.