Refs

Refs

import { Refs } from 'ancient-refs';

Source:

Methods

generate(storage, id) → {String}

refs.generate('items', 'abc'); // 'items/abc'

Parameters:
Name Type Description
storage String
id String
Source:
Throws:
  • StorageName must be a string!

  • Id must be a string!

Returns:

ref

Type
String

get(ref, callbackopt) → {Object|undefined}

refs.get('items/abc'); // 123

Parameters:
Name Type Attributes Description
ref String
callback Refs~callback <optional>
Source:
Returns:

[document]

Type
Object | undefined

id(ref) → {String}

Parameters:
Name Type Description
ref String
Source:
Returns:

id

Type
String

parse(ref) → {Array.<String>|undefined}

refs.parse('items/abc'); // ['items','abc']

Parameters:
Name Type Description
ref String
Source:
Returns:

[_ref]

Type
Array.<String> | undefined

storage(ref) → {*}

Parameters:
Name Type Description
ref String
Source:
Returns:

[storage]

Type
*

Type Definitions

callback(erroropt, dataopt)

Callback from get method.

Parameters:
Name Type Attributes Description
error Error <optional>
data * <optional>
Source:

getter(id, callbackopt) → {*}

Adapter for get data from storage by id.

Parameters:
Name Type Attributes Description
id String
callback Refs~callback <optional>
Source:
Returns:

[data]

Type
*