Skip to content
Jonathan Potter edited this page Jun 2, 2014 · 11 revisions

extend(x, y)

Types

x :: Object
y :: Object
return :: Object

Description

Returns an object that has all the keys/values of both x and y. If x and y have the same key then it will use y's value.

prop(propertyName, obj)

Types

propertyName :: String
obj :: Object
return :: Any

Description

Accesses the specified property of the object. tlc.prop(propertyName, obj) is equivalent to obj[propertyName].

Example

To get an array of the offset widths of all paragraph elements on the page you can do the following.

var ps = document.getElementsByTagName('p');
tlc.map(tlc.prop("offsetWidth"), ps); // [132, 493, ...]

propCall(propertyName, args, obj)

Types

propertyName :: String
args :: Array
obj :: Object
return :: Any

Description

Calls the specified property of the object. tlc.propCall(propertyName, [arg1, arg2, ...], obj) is equivalent to obj[propertyName](arg1, arg2, ...).

Example

To get the string representation of all elements on the page that have the class "test" you can do the following.

var tests = document.getElementsByClassName('test');
tlc.map(tlc.propCall("toString", []), tests); // ["[object HTMLParagraphElement]", "[object HTMLDivElement]", ...]

API

  • [Array](API Array)
  • [Function](API Function)
  • [Maybe](API Maybe)
  • [Object](API Object)
  • [Set](API Set)
  • [Typeclass](API Typeclass)

Guides

  • [Operators](Guide Operators)
  • [Typeclasses](Guide Typeclasses)
  • [Replacing OOP](Guide Replacing Object Oriented Programming)

General

Clone this wiki locally