Skip to content

Commit a6ae868

Browse files
authored
Merge pull request #9 from odogono/chore/8-clean-and-update
chore/8 clean and update
2 parents 651aada + 363c8ce commit a6ae868

12 files changed

Lines changed: 231 additions & 180 deletions

File tree

.formatter.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Used by "mix format"
12
[
2-
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
3-
]
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

.gitignore

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
1-
/_build
2-
/deps
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
317
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
420
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
elixir_jason_test-*.tar
24+
25+
# Temporary files, for example, from tests.
26+
/tmp/
527
*~
28+
29+
# Ignore macOS files
630
.DS_Store
7-
node_modules
8-
doc
9-
.elixir_ls
31+
32+
# Ignore editor files
33+
.elixir_ls
34+
35+
# Ignore vscode files
36+
.vscode

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: elixir
22
elixir:
3-
- 1.8
4-
- 1.9
3+
- 1.17
54
otp_release:
6-
- 22.0
5+
- 26.0
76
sudo: false

CHANGELOG.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
## Changelog
1+
# Changelog
2+
23
Written with guidance from [Keep a CHANGELOG](http://keepachangelog.com/).
34
This project adheres to [Semantic Versioning](http://semver.org/).
45

56
## [Unreleased]
67

7-
## v3.0.1
8+
9+
## v3.1.0 (2024-09-11)
10+
### Changed
11+
- updated package dependencies
12+
- error handling for get on invalid containers
13+
- error message format changed to be more consistent
14+
15+
## v3.0.1 (2019-07-31)
816
### Fixed
917
- crash when retrieving a path which contains a null value
1018

1119

12-
## v3.0.0
20+
## v3.0.0 (2019-02-27)
1321
### Added
1422
- add/add! - adds values indicated by pointers
1523
- options can be passed to operations. only option so far is :strict which affects set/add behaviour
@@ -25,23 +33,23 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2533
- corrected parsing of /~01
2634

2735

28-
## v2.5.0
36+
## v2.5.0 (2019-02-22)
2937
### Added
3038
- support for special array rules - /01 is not evaluated to an integer
31-
- the /- pointer when used with set either appends the value to the end of a list, or
39+
- the /- pointer when used with set either appends the value to the end of a list, or
3240
creates a new list with the value
3341

3442

35-
## v2.4.0
43+
## v2.4.0 (2019-04-01)
3644
### Fixed
3745
- pointers are no longer uri decoded, so the rfc example of "/c%d" now works correctly
3846

3947

40-
## v2.3.0
48+
## v2.3.0 (2018-05-09)
4149
### Changed
4250
- JSONPointer.apply changed to JSONPointer.transform
4351

44-
## v2.2.0
52+
## v2.2.0 (2018-04-12)
4553
### Added
4654
- hydrate and dehydrate functions added
4755
- apply added - a utility to transform a source container
@@ -50,32 +58,32 @@ creates a new list with the value
5058
- extract - renamed to dehydrate
5159

5260

53-
## v2.1.0
61+
## v2.1.0 (2018-04-12)
5462
### Added
5563
- set!, extract!, merge!
5664

5765

58-
## v2.0.0
66+
## v2.0.0 (2018-01-19)
5967
### Changed
6068
- passing a string to get/set will raise an argument error
6169
- new elixir formatter applied to code
6270
- code refactored to use defguard - which means this package is > 1.6 only
6371

64-
## v1.3.0
72+
## v1.3.0 (2017-12-21)
6573
### Fixed
6674
- deprecation warning for String.ltrim
6775
- Unsafe variable warnings
6876

69-
## v1.2.0
77+
## v1.2.0 (2016-04-11)
7078
### Added
7179
- parse will take a list of strings
72-
- JSONPointer.extract returns a list of paths that make up an object
80+
- JSONPointer.extract returns a list of paths that make up an object
7381
- JSONPointer.merge combines dst into src
7482

75-
## v1.1.0
76-
## Added
83+
## v1.1.0 (2016-03-04)
84+
### Added
7785
- pointers can be passed as lists as well as strings
7886

7987

80-
## v1.0.0
88+
## v1.0.0 (2016-03-03)
8189
* Initial Release

LICENSE renamed to LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The MIT License (MIT)
1+
# The MIT License (MIT)
22

3-
Copyright (c) [2019] [Alexander Veenendaal]
3+
Copyright (c) 2024 Alexander Veenendaal
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,75 @@
1-
ODGN JSONPointer
2-
=================
1+
# ODGN JSONPointer
2+
33
[![Build Status](https://travis-ci.org/odogono/elixir-jsonpointer.svg?branch=master)](https://travis-ci.org/odogono/elixir-jsonpointer)
44
[![Hex.pm](https://img.shields.io/hexpm/v/odgn_json_pointer.svg?style=flat-square)](https://hex.pm/packages/odgn_json_pointer)
5-
5+
[![Module Version](https://img.shields.io/hexpm/v/odgn_json_pointer.svg)](https://hex.pm/packages/odgn_json_pointer)
6+
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/odgn_json_pointer/)
7+
[![Total Download](https://img.shields.io/hexpm/dt/odgn_json_pointer.svg)](https://hex.pm/packages/odgn_json_pointer)
8+
[![License](https://img.shields.io/hexpm/l/odgn_json_pointer.svg)](https://github.com/odogono/elixir-jsonpointer/blob/master/LICENSE.md)
9+
[![Last Updated](https://img.shields.io/github/last-commit/odogono/elixir-jsonpointer.svg)](https://github.com/odogono/elixir-jsonpointer/commits/master)
610

711
An implementation of [JSON Pointer (RFC 6901)](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08) for Elixir.
812

9-
1013
## Installation
1114

1215
Add a dependency to your project `mix.exs`:
1316

14-
```Elixir
17+
```elixir
1518
def deps do
16-
[{:odgn_json_pointer, "~> 3.0.1"}]
19+
[
20+
{:odgn_json_pointer, "~> 3.1.0"}
21+
]
1722
end
1823
```
1924

2025
## Basic Usage
2126

22-
```Elixir
27+
```elixir
2328
iex> JSONPointer.get( %{ "fridge" => %{ "door" => "milk" } }, "/fridge/door" )
2429
{:ok, "milk"}
2530

26-
2731
iex> JSONPointer.set( %{}, "/example/msg", "hello")
2832
{:ok, %{ "example" => %{ "msg" => "hello" }}, nil }
2933

30-
3134
iex> JSONPointer.add( %{ "fridge" => [ "milk", "cheese" ]}, "/fridge/1", "salad")
3235
{:ok, %{ "fridge" => [ "milk", "salad", "cheese" ]}, [ "milk", "cheese" ] }
3336

34-
3537
iex> JSONPointer.has?( %{ "milk" => true, "butter" => false}, "/butter" )
3638
true
3739

38-
3940
iex> JSONPointer.test( %{ "milk" => "skimmed", "butter" => false}, "/milk", "skimmed" )
4041
{:ok, %{ "milk" => "skimmed", "butter" => false} }
4142

42-
4343
iex> JSONPointer.remove( %{"fridge" => %{ "milk" => true, "butter" => true}}, "/fridge/butter" )
4444
{:ok, %{"fridge" => %{"milk"=>true}}, true }
4545

46-
4746
iex> JSONPointer.dehydrate( %{"a"=>%{"b"=>["c","d"]}} )
4847
{:ok, [{"/a/b/0", "c"}, {"/a/b/1", "d"}] }
4948

50-
5149
iex> iex> JSONPointer.hydrate( [ {"/a/1/b", "single"} ] )
5250
{:ok, %{"a" => %{"1" => %{"b" => "single"}}}}
5351

54-
5552
iex> JSONPointer.merge( %{"a"=>1}, %{"b"=>2} )
5653
{:ok, %{"a"=>1,"b"=>2} }
5754

58-
5955
iex> JSONPointer.transform( %{ "a"=>4, "b"=>%{ "c" => true }}, [ {"/b/c", "/valid"}, {"/a","/count", fn val -> val*2 end} ] )
6056
{:ok, %{"count" => 8, "valid" => true}}
61-
6257
```
6358

6459
Full documentation can be found at https://hexdocs.pm/odgn_json_pointer.
6560

61+
## Acknowledgement
6662

63+
Inspiration from https://github.com/manuelstofer/json-pointer
6764

68-
## Ack
69-
70-
inspiration from https://github.com/manuelstofer/json-pointer
71-
72-
made without peeking (much) at the source of https://github.com/xavier/json_pointer
65+
Made without peeking (much) at the source of https://github.com/xavier/json_pointer
7366

7467
Made in Exeter, UK.
7568

7669

77-
## License
70+
## Copyright and License
71+
72+
Copyright (c) 2024 Alexander Veenendaal
7873

79-
This software is licensed under [the MIT license](LICENSE.md).
74+
This work is free. You can redistribute it and/or modify it under the
75+
terms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details.

config/config.exs

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)