Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
import React from 'react'
import { stringify } from 'chain-able-boost'
import { Schema, DangerouslySetInnerHTML, DefaultProps } from './typings'

/**
 * @class sameas JsonLd, but creating a factory is faster
 *
 * const script = React.createFactory('script')
 * const JsonLdAttributes = {type: 'application/ld+json'}
 * const JsonLd = props => script(JSON.stringify(props.data), JsonLdAttributes)
 */

/**
 * @description ensure we have valid json data
 */
export function validateSchema(data: Schema): boolean {
  // @todo
  return false
}

/**
 * simply create __html obj
 */
export function toInnerHTML(html: string): DangerouslySetInnerHTML {
  return { __html: html }
}

/**
 * turn props into innerHTML
 */
export function toStringifiedInnerHTML(props: DefaultProps): DangerouslySetInnerHTML {
  const stringified = stringify(props.data || props)
  const html = toInnerHTML(stringified)
  return html
}