new Cite(data, optionsopt)
Create a Cite
object with almost any kind of data, and manipulate it with its default methods.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
module:@citation-js/core~InputData | Input data |
||
options |
module:@citation-js/core~InputOptions |
<optional> |
{} | Input options |
- Source:
Members
(protected) _options :module:@citation-js/core~InputOptions
The default options for the output. See input options
Type:
- Source:
(protected) data :Array.<module:@citation-js/core~CSL>
The parsed data
Type:
- Array.<module:@citation-js/core~CSL>
- Source:
(constant) defaultOptions :module:@citation-js/core~OutputOptions
default output options
Type:
- Source:
(protected) log :Array.<Array.<String>>
The saved-images-log
Type:
- Array.<Array.<String>>
- Source:
Methods
add(data, optionsopt, logopt) → {module:@citation-js/core.Cite}
Add an object to the array of objects
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
module:@citation-js/core~InputData | The data to add to your object |
||
options |
module:@citation-js/core~InputOptions |
<optional> |
Options |
|
log |
Boolean |
<optional> |
false | Show this call in the log |
- Source:
Returns:
The updated parent object
(async) addAsync(data, optionsopt, logopt) → {Promise.<module:@citation-js/core.Cite>}
Add an object to the array of objects
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
module:@citation-js/core~InputData | The data to add to your object |
||
options |
module:@citation-js/core~InputOptions |
<optional> |
Options |
|
log |
Boolean |
<optional> |
false | Show this call in the log |
- Source:
Returns:
The updated parent object
- Type
- Promise.<module:@citation-js/core.Cite>
currentVersion() → {Number}
- Source:
Returns:
The latest version of the object
- Type
- Number
format(format, …options) → {String|Array.<Object>}
Get formatted data from your object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
format |
String | format module name |
|
options |
* |
<repeatable> |
module options (see relevant documentation) |
- Source:
Returns:
formatted data
- Type
- String | Array.<Object>
get(optionsopt) → {String|Array.<Object>}
Get formatted data from your object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
module:@citation-js/core~OutputOptions |
<optional> |
{} | Output options |
- Deprecated:
- Source:
- Tutorials:
Returns:
The formatted data
- Type
- String | Array.<Object>
getIds() → {Array.<String>}
Get a list of the data entry IDs, in the order of that list
- Source:
Returns:
List of IDs
- Type
- Array.<String>
reset(logopt) → {module:@citation-js/core.Cite}
Reset a Cite
object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
log |
Boolean |
<optional> |
false | Show this call in the log |
- Source:
Returns:
The updated, empty parent object (except the log, the log lives)
retrieveLastVersion() → {module:@citation-js/core.Cite}
Returns the last saved image of the object.
- Source:
Returns:
The last version of the object. undefined
if used on first version.
retrieveVersion(versnumopt) → {module:@citation-js/core.Cite}
Returns an image of the object in the version specified.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
versnum |
Number |
<optional> |
1 | The number of the version you want to retrieve. Illegal numbers: numbers under or equal to zero, floats, numbers above the current version of the object. |
- Source:
Returns:
The version of the object with the version number passed. undefined
if an illegal number is passed.
save() → {module:@citation-js/core.Cite}
Save an image of the current version of the object.
- Source:
Returns:
The current version of the object.
set(data, optionsopt, logopt) → {module:@citation-js/core.Cite}
Recreate a Cite
object with almost any kind of data, and manipulate it with its default methods.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
module:@citation-js/core~InputData | Replacement data |
||
options |
module:@citation-js/core~InputOptions |
<optional> |
Options |
|
log |
Boolean |
<optional> |
false | Show this call in the log |
- Source:
Returns:
The updated parent object
(async) setAsync(data, optionsopt, logopt) → {Promise.<module:@citation-js/core.Cite>}
Recreate a Cite
object with almost any kind of data, and manipulate it with its default methods.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
module:@citation-js/core~InputData | Replacement data |
||
options |
module:@citation-js/core~InputOptions |
<optional> |
Options |
|
log |
Boolean |
<optional> |
false | Show this call in the log |
- Source:
Returns:
The updated parent object
- Type
- Promise.<module:@citation-js/core.Cite>
sort(methodopt, logopt) → {module:@citation-js/core.Cite}
Sort the dataset
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
method |
module:@citation-js/core.Cite#sort~sort | Array.<String> |
<optional> |
[] | How to sort |
log |
Boolean |
<optional> |
false | Show this call in the log |
- Source:
Returns:
The updated parent object
undo(numberopt) → {module:@citation-js/core.Cite}
Returns the second to last saved image of the object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
number |
Number |
<optional> |
1 | number of versions to go back. |
- Source:
Returns:
The second to last version of the object. undefined
if used on first version.
(static) async(data, optionsopt, callbackopt) → {Promise.<module:@citation-js/core.Cite>}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
module:@citation-js/core~InputData | input data |
||
options |
module:@citation-js/core~InputOptions |
<optional> |
{} | cite options |
callback |
module:@citation-js/core.Cite~asyncCallback |
<optional> |
if not given, function returns promise. |
- Source:
Returns:
if callback is omitted, returns a promise
- Type
- Promise.<module:@citation-js/core.Cite>
(static) valdiateOptions() → {Boolean}
Parameters:
Type | Description |
---|---|
module:@citation-js/core~InputOptions | options |
- Source:
- To Do:
-
- check registers if type is present
Throws:
-
-
Options not an object
- Type
- TypeError
-
-
-
Invalid options
- Type
- TypeError
-
Returns:
true (if valid)
- Type
- Boolean
(static) validateOutputOptions() → {Boolean}
Parameters:
Type | Description |
---|---|
module:@citation-js/core~OutputOptions | options |
- Deprecated:
- Yes
- Source:
- To Do:
-
- check registers if styles and langs are present
Throws:
-
-
Options not an object
- Type
- TypeError
-
-
-
Invalid options
- Type
- TypeError
-
-
-
Invalid options combination
- Type
- Error
-
Returns:
true (if valid)
- Type
- Boolean
Type Definitions
asyncCallback(data)
Parameters:
Name | Type | Description |
---|---|---|
data |
Cite | Cite object |
- Source: