Value Library

Contents

Assign a specific value type using JSON, e.g a specify Geo-point value type for a property when creating nodes in node-lib. This ensures validation, and proper indexing storage time

Usage

Add the following to your build.gradle file:

dependencies {
  include "com.enonic.xp:lib-value:${xpVersion}"
}

In your JavaScript controller, add a require statement:

var valueLib = require('/lib/xp/value');

You are now ready to use the library functionality.

Functions

binary

Creates a BinaryAttachment

Parameters

Name Type Description

name

string

The binary name

stream

The binary stream

Returns

object : BinaryAttachment

geoPoint

Creates a GeoPoint

Parameters

Name Type Description

lat

number

Latitude

lon

number

Longitude

Returns

object : GeoPoint

geoPointString

Creates a GeoPoint

Parameters

Name Type Description

value

string

Comma-separated latitude and longitude

Returns

object : GeoPoint

instant

Creates an Instant

Parameters

Name Type Description

value

string | Date

An ISO-8601-formatted instant (e.g '2011-12-03T10:15:30Z') or a Date object

Returns

object : Instant

localDate

Creates a LocalDate.

Parameters

Name Type Description

value

string | Date

A ISO local date-time string (e.g '2011-12-03') or a Date object

Returns

object : LocalDate

localDateTime

Creates a LocalDateTime

Parameters

Name Type Description

value

string | Date

A local date-time string (e.g '2007-12-03T10:15:30') or a Date object

Returns

object : LocalDateTime

localTime

Creates a LocalTime

Parameters

Name Type Description

value

string | Date

A ISO local date-time string (e.g '10:15:30') or a Date object

Returns

object : LocalTime

reference

Creates a Reference

Parameters

Name Type Description

value

string

A nodeId as string (e.g '1234-5678-91011')

Returns

object : Reference


Contents

Contents