PropertyObject

PropertyObject

new PropertyObject(value, separator)

Source:
Make string, array to PropertyObject for the dot product
Example
var obj1 = new PropertyObject("1,2,3", ",");
var obj2 = new PropertyObject([1,2,3], " ");
var obj3 = new PropertyObject("1$2$3", "$");

// rgba(100, 100, 100, 0.5)
var obj4 = new PropertyObject([100,100,100,0.5], {
	"separator" : ",",
	"prefix" : "rgba(",
	"suffix" : ")"
});
Parameters:
Name Type Description
value String | Array This value is in the array format ..
separator String Array separator.

Members

(readonly) length

Source:
the number of values.
Example
const obj1 = new PropertyObject("1,2,3", ",");

console.log(obj1.length);
// 3

Methods

clone() → {PropertyObject}

Source:
create a copy of an instance itself.
Example
const obj1 = new PropertyObject("1,2,3", ",");
const obj2 = obj1.clone();
Returns:
clone
Type
PropertyObject

each(callback) → {String}

Source:
See:
executes a provided function once per array element.
Example
//rgba(100, 100, 100, 0.5)
var obj4 = new PropertyObject([100,100,100,0.5], {
	"separator" : ",",
	"prefix" : "rgba(",
	"suffix" : ")"
});

obj4.join();  // =>   "100,100,100,0.5"
Parameters:
Name Type Description
callback function Function to execute for each element, taking three arguments
Properties
Name Type Attributes Description
currentValue All <optional>
The current element being processed in the array.
index Number <optional>
The index of the current element being processed in the array.
array Array <optional>
the array.
Returns:
Join the elements of an array into a string
Type
String

get(index) → {Object}

Source:
retrieve one of values at the index
Example
const obj1 = new PropertyObject("1,2,3", ",");

console.log(obj1.get(0));
// 1
Parameters:
Name Type Description
index Number index
Returns:
one of values at the index
Type
Object

join() → {String}

Source:
Make Property Object's array to String
Example
//rgba(100, 100, 100, 0.5)
	var obj4 = new PropertyObject([100,100,100,0.5], {
		"separator" : ",",
		"prefix" : "rgba(",
		"suffix" : ")"
	});
	obj4.join();  // =>   "100,100,100,0.5"
Returns:
Join the elements of an array into a string
Type
String

set(index, value) → {Object}

Source:
Set the value at that index
Example
const obj1 = new PropertyObject("1,2,3", ",");
obj1.set(0, 2);
console.log(obj1.toValue());
// 2,2,3
Parameters:
Name Type Description
index Number index
value Object text, a number, object to set
Returns:
one of values at the index
Type
Object

toValue() → {String}

Source:
Make Property Object to String
Example
//rgba(100, 100, 100, 0.5)
const obj4 = new PropertyObject([100,100,100,0.5], {
	"separator" : ",",
	"prefix" : "rgba(",
	"suffix" : ")",
});
console.log(obj4.toValue());
// "rgba(100,100,100,0.5)"
Returns:
Make Property Object to String
Type
String