Skip to content
Daniel Lacy edited this page Mar 24, 2015 · 2 revisions

#class: Tweemat Members

##new Tweemat(tweet, [options]) Params

  • tweet object - A single tweet JSON representation from the Twitter API.
  • [options] object - Options hash.
    • [linkToBlank=false] boolean - Give links a target="_blank" attribute.

##tweemat.createLink(text, replacements) Finds text in a string and replaces it with a link.

Params

  • text string - Full string that will be searched and replaced with links.
  • replacements object - Object containing the text to search for, text to replace with, and the URL to link to.

Returns: string - String with the replacements wrapped in anchors.
Since: 1.0.0
##tweemat.getReplacements(entity, type) Creates a hash of entity content to find, replace, and link.

Params

  • entity object - An entity object representation. Eg- an item from tweet.entities.
  • type string - The entity type to handle.

Returns: object - ['search'] is text to find. ['replace'] is text to replace. ['href'] is url.
Since: 1.0.0
##tweemat.linkAllEntities() Links all entities.

Returns: string - Tweet text with all entities linked.
Since: 1.0.0
##tweemat.linkAllOfEntity(type) Links all of a single entity type.

Params

  • type string - Entity type.

Returns: string - Tweet text with all of a single entity type replaced with links.
Since: 1.0.0

Clone this wiki locally