API Docs for: 1.4.0
Show:

Kiwi.Utils.Common Class

Module: Utils
Parent Module: Kiwi

Methods to assist in working with Structs. A lot of the functions in this class are Copyright 2012 Mauricio Santos and used with permission. His work is licensed under the Apache License, Version 2.0 (the "License")

Item Index

Methods

Properties

Methods

compareToEquals

(
  • compareFunction
)
Boolean public static

Returns an equal function given a compare function.

Parameters:

  • compareFunction Any

Returns:

Boolean:

convertToBase2

(
  • imageFile
)
HTMLImageElement/HTMLCanvasElement public static

A method that checks to see if an Image or Canvas that is passed has base2 proportions. If it doesn't the image is created on a Canvas and that Canvas is returned. Used mainly when creating TextureAtlases for WebGL.

Parameters:

  • imageFile HTMLImageElement/HTMLCanvasElement

    The image or canvas element that is to be converted into a base2size.

Returns:

HTMLImageElement/HTMLCanvasElement:

The image that was passed (if it was already at base2 dimensions) or a new canvas element if it wasn't.

defaultCompare

(
  • a.
  • b.
)
Number static

Default function to compare element order.

Parameters:

  • a. Any
  • b. Any

Returns:

Number:

defaultEquals

(
  • a
  • b
)
Boolean public static

Default function to test equality.

Parameters:

  • a Any
  • b Any

Returns:

Boolean:

defaultToString

(
  • item
)
Any public static

Default function to convert an object to a string.

Parameters:

  • item Any

Returns:

Any:

isArray

(
  • obj
)
Boolean public static

Checks if the given argument is a array.

Parameters:

  • obj Any

Returns:

Boolean:

isBetween

(
  • x
  • min
  • max
)
Boolean public static

Returns a boolean indicating whether x is between two parameters passed.

Parameters:

  • x Number

    The values to be checked

  • min Number

    The minimum value

  • max Number

    The maximum value

Returns:

Boolean:

isFunction

(
  • func.
)
Boolean public static

Checks if the given argument is a function.

Parameters:

  • func. Any

Returns:

Boolean:

isNumeric

(
  • value
)
Boolean public static

Checks if the given value is numeric.

Parameters:

  • value Any

Returns:

Boolean:

isObject

(
  • obj
)
Boolean public static

Checks if the given argument is an object.

Parameters:

  • obj Any

Returns:

Boolean:

isString

(
  • obj
)
Boolean public static

Checks if the given argument is a string.

Parameters:

  • obj Any

Returns:

Boolean:

isUndefined

(
  • obj
)
Boolean public static

Checks if the given argument is undefined.

Parameters:

  • obj Any

Returns:

Boolean:

objType

() String public

The type of object that this is.

Returns:

String:

"Common"

reverseCompareFunction

(
  • compareFunction
)
Number public static

Reverses a compare function.

Parameters:

  • compareFunction Any

Returns:

Number:

shuffleArray

(
  • array
)
Any public static

Shuffles the contents of an array given into a random order.

Parameters:

  • array Any

Returns:

Any:

What you passed but the with the contents in a new order.

Properties

base2Sizes

Number public static

An array containing all of the base2sizes that are allowed. This is used when creating a new TextureAtlas/or resizing a Image to be rendered in WebGL.