You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
461 B
JavaScript
28 lines
461 B
JavaScript
"use strict";
|
|
|
|
const asExpression = require("./");
|
|
|
|
let stringValue = "two";
|
|
|
|
let someObject = {
|
|
someBoolean: true,
|
|
someString: "This is a dummy object",
|
|
someNumber: asExpression(() => {
|
|
if (stringValue === "one") {
|
|
return 1;
|
|
} else if (stringValue === "two") {
|
|
return 2;
|
|
} else if (stringValue === "three") {
|
|
return 3;
|
|
}
|
|
})
|
|
};
|
|
|
|
console.log(someObject);
|
|
|
|
/*
|
|
{ someBoolean: true,
|
|
someString: 'This is a dummy object',
|
|
someNumber: 2 }
|
|
*/
|