View Source jhn_plist (jhn_stdlib v5.3.2)

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

Summary

Functions

Extends Plist with the property without checking if it exists.

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

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

Restricts Plist on the key without checking if it exists.

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

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

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

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.

Finds the all values associated with the key.

Returns all the keys.

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

Creates an empty plist.

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

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

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

Returns all the values.

Types

-type default() :: _.
-type flag() :: check | nocheck.
-type key() :: _.
-type placement() :: first | last.
-type plist() :: [{key(), value()}].
-type value() :: _.

Functions

-spec add(key(), value(), plist()) -> plist().

Extends Plist with the property without checking if it exists.

Link to this function

add(Key, Value, PList, _)

View Source
-spec add(key(), value(), plist(), flag()) -> plist().

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

-spec compact(plist()) -> plist().

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

-spec delete(key(), plist()) -> plist().

Restricts Plist on the key without checking if it exists.

-spec delete(key(), plist(), flag()) -> plist().

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

-spec find(key(), plist()) -> value() | undefined.

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

Link to this function

find(Key, PList, Default)

View Source
-spec find(key(), plist(), default()) -> value() | default().

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

Link to this function

find(Key, PList, Value, _)

View Source
-spec find(key(), plist(), default(), 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.

-spec find_all(key(), plist()) -> [value()].

Finds the all values associated with the key.

-spec keys(plist()) -> [key()].

Returns all the keys.

-spec member(key(), plist()) -> boolean().

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

-spec new() -> plist().

Creates an empty plist.

-spec new([key()], [value()]) -> plist().

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

Link to this function

replace(Key, Value, PList)

View Source
-spec replace(key(), value(), plist()) -> plist().

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

Link to this function

replace(Key, Value, T, Check)

View Source
-spec replace(key(), value(), plist(), flag()) -> plist().

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

-spec values(plist()) -> [value()].

Returns all the values.