PropertyObject

Scene. PropertyObject

Make string, array to PropertyObject for the dot product

Constructor

new PropertyObject(value, separator)

Source:
Name Type Description
value String | Array This value is in the array format ..
separator String Array separator.
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" : ")"
});

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

forEach(callback) → {PropertyObject}

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

obj4.forEach(t => {
	console.log(t);
});  // =>   "100,100,100,0.5"
Returns:
An instance itself
Type
PropertyObject

get(index) → {Object}

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

console.log(obj1.get(0));
// 1
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) → {PropertyObject}

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

size()

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

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

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