How to use the leanengine.parseJSON function in leanengine

To help you get started, we’ve selected a few leanengine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leancloud / leanengine-nodejs-demos / functions / associated-data.js View on Github external
return redisClient.get(userId).then(function(cachedUser) {
    if (cachedUser) {
      // 反序列化为 AV.Object
      return AV.parseJSON(JSON.parse(cachedUser))
    } else {
      new AV.Query(AV.User).get(userId).then(function(user) {
        if (user) {
          // 将序列化后的 JSON 字符串存储到 LeanCache
          redisClient.set(redisUserKey(userId), JSON.stringify(user.toFullJSON())).catch(console.error)
        }

        return user
      })
    }
  })
}
github leancloud / leanengine-nodejs-demos / functions / readonly.js View on Github external
return categories.map( category => {
    return AV.parseJSON(JSON.parse(category))
  })
})