Module plist

A property list style handling of {Key, Value} tuples.

Copyright © (C) 2013-2020, Jan Henry Nystrom <JanHenryNystrom@gmail.com> -------------------------------------------------------------------

Authors: Jan Henry Nystrom (JanHenryNystrom@gmail.com).

Description

A property list style handling of {Key, Value} tuples.

Data Types

default()

default() = term()

flag()

flag() = check | nocheck

key()

key() = term()

placement()

placement() = first | last

plist()

plist() = [{key(), value()}]

value()

value() = term()

Function Index

add/3 Extends Plist with the property without checking if it exists.
add/4 Extends Plist with the property checking if it exists if required.
compact/1 Ensures one property per key, with the first given precedence.
delete/2 Restricts Plist on the key without checking if it exists.
delete/3 Restricts Plist on the key without checking if it exists if required.
find/2 Finds the value of the property or undefined if not found.
find/3 Finds the value of the property or Default if not found.
find/4 Finds the value of the property or Default if not found.
find_all/2 Finds the all values associated with the key.
keys/1 Returns all the keys.
member/2 Returns wether the key is to be found in the PList.
new/0 Creates an empty plist.
new/2 Creates a plist from the zipping the lists of keys and values.
replace/3 Replaces the first occurence in the PList, adding if it if not found.
replace/4 Replaces the first occurence in the PList, esuring that i does exist if required.
values/1 Returns all the values.

Function Details

add/3

add(Key::key(), Value::value(), PList::plist()) -> plist()

Extends Plist with the property without checking if it exists.

add/4

add(Key::key(), Value::value(), PList::plist(), X4::flag()) -> plist()

Extends Plist with the property checking if it exists if required.

compact/1

compact(List::plist()) -> plist()

Ensures one property per key, with the first given precedence.

delete/2

delete(Key::key(), PList::plist()) -> plist()

Restricts Plist on the key without checking if it exists.

delete/3

delete(Key::key(), PList::plist(), X3::flag()) -> plist()

Restricts Plist on the key without checking if it exists if required.

find/2

find(Key::key(), PList::plist()) -> value() | undefined

Finds the value of the property or undefined if not found.

find/3

find(Key::key(), PList::plist(), Default::default()) -> value() | default()

Finds the value of the property or Default if not found.

find/4

find(Key::key(), PList::plist(), Value::default(), X4::placement()) -> value() | default()

Finds the value of the property or Default if not found. If more than property is found the one returned if determined by the Placement as being the first or last.

find_all/2

find_all(Key::key(), PList::plist()) -> [value()]

Finds the all values associated with the key.

keys/1

keys(PList::plist()) -> [key()]

Returns all the keys.

member/2

member(Key::key(), PList::plist()) -> boolean()

Returns wether the key is to be found in the PList.

new/0

new() -> plist()

Creates an empty plist.

new/2

new(Keys::[key()], Values::[value()]) -> plist()

Creates a plist from the zipping the lists of keys and values.

replace/3

replace(Key::key(), Value::value(), PList::plist()) -> plist()

Replaces the first occurence in the PList, adding if it if not found.

replace/4

replace(Key::key(), Value::value(), T::plist(), Check::flag()) -> plist()

Replaces the first occurence in the PList, esuring that i does exist if required.

values/1

values(PList::plist()) -> [value()]

Returns all the values.


Generated by EDoc