MCPcopy Create free account
hub / github.com/ampproject/amphtml / getPropertyFromJsonString

Function getPropertyFromJsonString

third_party/subscriptions-project/swg.js:4143–4146  ·  view source on GitHub ↗

* Converts the passed string into a JSON object (if possible) and returns the * value of the propertyName on that object. * @param {string} jsonString * @param {string} propertyName * @return {*}

(jsonString, propertyName)

Source from the content-addressed store, hash-verified

4141 * @return {*}
4142 */
4143function getPropertyFromJsonString(jsonString, propertyName) {
4144 const json = tryParseJson(jsonString);
4145 return (json && json[propertyName]) || null;
4146}
4147
4148/**
4149 * Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.

Callers 3

getSkuMethod · 0.85

Calls 1

tryParseJsonFunction · 0.70

Tested by

no test coverage detected