MCPcopy Create free account
hub / github.com/eclipse-thingweb/playground / isStringObjectKeyValue

Function isStringObjectKeyValue

packages/core/shared.js:607–619  ·  view source on GitHub ↗

* subfunction of checkMultiLangConsistency * checks whether a given string exist as the value of key in an object * * @param {string} searchedString * @param {object} searchedObject

(searchedString, searchedObject)

Source from the content-addressed store, hash-verified

605 * @param {object} searchedObject
606 */
607function isStringObjectKeyValue(searchedString, searchedObject){
608 const objKeys = Object.keys(searchedObject)
609 if(objKeys.length === 0) return false // if the object is empty, then the string cannot exist here
610 for (let index = 0; index < objKeys.length; index++) {
611 const element = objKeys[index]
612 if (searchedObject[element] === searchedString) {
613 return true // found where the string is in the object
614 } else {
615 // nothing keep going, maybe in another key
616 }
617 }
618 return false
619}
620
621
622/**

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected