ICAL. Property

Provides a layer on top of the raw jCal object for manipulating a single property, with its parameters and value.

Constructor

new Property(jCal, parentopt)

Creates a new ICAL.Property instance.

It is important to note that mutations done in the wrapper directly mutate the jCal object used to initialize.

Can also be used to create new properties by passing the name of the property (as a String).

Parameters:
NameTypeAttributesDescription
jCalArray | String

Raw jCal representation OR the new name of the property

parentICAL.Component<optional>

Parent component

Members

name :String

The name of this property, in lowercase.

Type:
  • String

parent :ICAL.Component

The parent component for this property.

type :String

The value type for this property

Type:
  • String

Methods

getDefaultType() → {String}

Get the default type based on this property's name.

Returns:

The default type for this property

Type: 
String

getFirstParameter(name) → {String}

Gets first parameter on the property.

Parameters:
NameTypeDescription
nameString

Parameter name (lowercase)

Returns:

Parameter value

Type: 
String

getFirstValue() → {ICAL.Binary|ICAL.Duration|ICAL.Period|ICAL.Recur|ICAL.Time|ICAL.UtcOffset|Geo|string|null}

Finds the first property value.

Returns:

First property value

Type: 
ICAL.Binary | ICAL.Duration | ICAL.Period | ICAL.Recur | ICAL.Time | ICAL.UtcOffset | Geo | string | null

getParameter(name) → {Array|String}

Gets a parameter on the property.

Parameters:
NameTypeDescription
nameString

Parameter name (lowercase)

Returns:

Parameter value

Type: 
Array | String

getValues() → {Array}

Gets all values on the property.

NOTE: this creates an array during each call.

Returns:

List of values

Type: 
Array

removeAllValues()

Removes all values from this property

removeParameter(name)

Removes a parameter

Parameters:
NameTypeDescription
nameString

The parameter name

resetType(type)

Sets type of property and clears out any existing values of the current type.

Parameters:
NameTypeDescription
typeString

New iCAL type (see design.*.values)

setParameter(name, value)

Sets a parameter on the property.

Parameters:
NameTypeDescription
nameString

The parameter name

valueArray | String

The parameter value

setValue(value)

Sets the current value of the property. If this is a multi-value property, all other values will be removed.

Parameters:
NameTypeDescription
valueString | Object

New property value.

setValues(values)

Sets the values of the property. Will overwrite the existing values. This can only be used for multi-value properties.

Parameters:
NameTypeDescription
valuesArray

An array of values

toICALString() → {String}

The string representation of this component.

Returns:
Type: 
String

toJSON() → {Object}

Returns the Object representation of this component. The returned object is a live jCal object and should be cloned if modified.

Returns:
Type: 
Object

(static) fromString(str, designSetopt) → {ICAL.Property}

Create an ICAL.Property by parsing the passed iCalendar string.

Parameters:
NameTypeAttributesDescription
strString

The iCalendar string to parse

designSetICAL.design.designSet<optional>

The design data to use for this property

Returns:

The created iCalendar property

Type: 
ICAL.Property