new MarcRecord(marc)
Parameters:
Name | Type | Description |
---|---|---|
marc |
object | A MARC-JSON object representing a record. |
Classes
Members
-
format :string
-
MARC format ('bib', 'auth' or 'mfhd')
Type:
- string
Methods
-
add_field(tag, indexopt) → {MarcField}
-
Creates a new (empty) MarcField object, inserts it into record BEFORE specified index. Will add in numeric order if index isn't passed.
Parameters:
Name Type Attributes Description tag
string 3-char MARC field label
index
<optional>
Position at which to insert.
Returns:
- Type
- MarcField
-
ctrl(ctrlspec) → {string}
-
Parameters:
Name Type Description ctrlspec
string A specifier indicating control field's tag, and optionally, a substring to select from the field data, e.g.
- ctrl('008')
- ctrl('008[7]') // position 7.
- ctrl('008[7-8]') // positions 7&8
Returns:
The control field's value or a substring derived from it.
- Type
- string
-
field(tag) → {Array.<MarcField>}
-
Return first Marc Field matching tag.
Parameters:
Name Type Description tag
string 3-char MARC field label
Returns:
(or null if no field in record)
- Type
- Array.<MarcField>
-
fields(tag_re) → {Array.<MarcField>}
-
Return Marc Fields matching regex.
Parameters:
Name Type Description tag_re
string Regex to match, e.g. '245', '2..' etc.
Returns:
- Type
- Array.<MarcField>
-
has(tag) → {boolean}
-
Test for existence of MARC field within record.
Parameters:
Name Type Description tag
string 3-char MARC field label.
Returns:
True if the record has one or more fields matching /tag/.
- Type
- boolean
-
leader() → {string}
-
Output MARC LDR.
Returns:
- Type
- string
-
rcn() → {string}
-
Returns:
For Authority records, return the rcn.
- Type
- string
-
rtype() → {string}
-
Returns:
The OCLC Code for Record Type (bibs), or 'AUTH' or 'MFHD' (See rtype_re for definition)
- Type
- string
-
subfield(tagspec) → {boolean}
-
Return first matching subfield value of /tagspec/
Parameters:
Name Type Description tagspec
string 4-char MARC field label and subfield code
Returns:
True if the record has one or more fields matching /tag/.
- Type
- boolean
Example
`record.subfield('245b');` // Returns subtitle.
-
title() → {string}
-
Returns:
Punctuation-chopped title.
- Type
- string