How to use the third-party-web.entities function in third-party-web

To help you get started, we’ve selected a few third-party-web 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 patrickhulce / third-party-web / www / src / components / data-visualizations / d3-viz.js View on Github external
import * as color from 'color'
import _ from 'lodash'
import * as thirdPartyWeb from 'third-party-web'
import * as d3plus from 'd3plus/build/d3plus.js'

const categories = _.uniq(thirdPartyWeb.entities.map(e => e.categories[0])).map((category, idx) => {
  return {
    id: category,
    displayName: _.startCase(category),
    color: color(`hsl(175, 75%, ${15 + idx * 5}%)`)
      .rgb()
      .string(),
  }
})

const data = thirdPartyWeb.entities
  .filter(entity => entity.totalOccurrences)
  .sort((a, b) => b.totalExecutionTime - a.totalExecutionTime)
  .slice(0, 100)
  .sort((a, b) => a.name.localeCompare(b.name))
  .map(entity => {
    const category = categories.find(c => c.id === entity.categories[0])

    return {
      ...entity,
      id: entity.name,
      category: category.displayName,
      color: category.color,
    }
  })

const tooltipConfig = {
github patrickhulce / third-party-web / www / src / components / data-visualizations / d3-viz.js View on Github external
import React, {useEffect, useState, useRef} from 'react'
import PropTypes from 'prop-types'
import * as color from 'color'
import _ from 'lodash'
import * as thirdPartyWeb from 'third-party-web'
import * as d3plus from 'd3plus/build/d3plus.js'

const categories = _.uniq(thirdPartyWeb.entities.map(e => e.categories[0])).map((category, idx) => {
  return {
    id: category,
    displayName: _.startCase(category),
    color: color(`hsl(175, 75%, ${15 + idx * 5}%)`)
      .rgb()
      .string(),
  }
})

const data = thirdPartyWeb.entities
  .filter(entity => entity.totalOccurrences)
  .sort((a, b) => b.totalExecutionTime - a.totalExecutionTime)
  .slice(0, 100)
  .sort((a, b) => a.name.localeCompare(b.name))
  .map(entity => {
    const category = categories.find(c => c.id === entity.categories[0])

third-party-web

Categorized data on third party entities on the web.

MIT
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis