How to use the superstruct.struct.record function in superstruct

To help you get started, we’ve selected a few superstruct 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 Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
videoId: 'string'
      })
    }),
  })],
  nextPageToken: 'string?'
});

const VideosResponse = struct.pick({
  items: [struct.pick({
    id: 'string',
    snippet: struct.pick({
      publishedAt: 'string', // 2007-03-05T08:22:25.000Z
      channelId: 'string',
      title: 'string',
      // description: 'string',
      thumbnails: struct.record(['string', struct.pick({
        url: 'string',
        width: 'number',
        height: 'number',
      })]),
      channelTitle: 'string',
      // tags: ['string'],
      // categoryId: 'string', // 10
      // liveBroadcastContent: 'string', // none
      // localized: struct.pick({
      //   title: 'string',
      //   description: 'string',
      // })
    }),
    contentDetails: struct.pick({
      duration: 'string', // PT2M57S
      // dimension: 'string', // 2d