Coder Social home page Coder Social logo

enhance-kony's Introduction

enhance-kony

A simple collection of functionality for the Kony SDK. I personally use this and Krōnin by Miguelángel Fernández.

kony.ui

fontAwesome

returns: object

An object that contains "The complete set of 675 icons in Font Awesome 4.7.0" found here

Accessing it is relatively easy

// access fa-user-circle icon
kony.ui.fontAwesome['fa-user-circle']
// access fa-sitemap icon
kony.ui.fontAwesome['fa-sitemap']

generateComponent(string, object, object, object, object)

returns: object

A function that generates components much like calling kony.ui.<component name here>(...) would. What makes this function different is that it is more geared towards applying additional properties.

Traditional way of creating button and setting it's width and adding an onClick method:

const btn = new kony.ui.Button(...);
btn.width = '100dp';
btn.onClick = <some function>

This library's way of doing so:

const btn = kony.ui.generateComponent('Button', ..., {
  width: '100dp',
  onClick: <some function>
});

In the end it boils down to preference...

kony.utils

getType(any)

returns: string

typeof is very limited in its use some might even call it broken, Angus Croll is one of them read more. This uses his code that aims to fix that issue.

typeof {a: 4}; //"object"
typeof [1, 2, 3]; //"object"
typeof new ReferenceError; //"object"
typeof new Date; //"object"
typeof /a-z/; //"object"
typeof Math; //"object"
typeof JSON; //"object"
typeof new Number(4); //"object"
typeof new String("abc"); //"object"
typeof new Boolean(true); //"object"

kony.utils.getType({a: 4}); //"object"
kony.utils.getType([1, 2, 3]); //"array"
kony.utils.getType(new ReferenceError); //"error"
kony.utils.getType(new Date); //"date"
kony.utils.getType(/a-z/); //"regexp"
kony.utils.getType(Math); //"math"
kony.utils.getType(JSON); //"json"
kony.utils.getType(new Number(4)); //"number"
kony.utils.getType(new String("abc")); //"string"
kony.utils.getType(new Boolean(true)); //"boolean"

isArray(any)

returns: boolean

checks to see if passed variable is an array, uses kony.utils.getType(...) internally.

isBoolean(any)

returns: boolean

checks to see if passed variable is a boolean, uses kony.utils.getType(...) internally.

isDate(any)

returns: boolean

checks to see if passed variable is a date instance, uses kony.utils.getType(...) internally.

isEmpty(any)

returns: boolean

checks to see if passed variable is empty (falsey).

isError(any)

returns: boolean

checks to see if passed variable is an error instance, uses kony.utils.getType(...) internally.

isFunction(any)

returns: boolean

checks to see if passed variable is a function, uses kony.utils.getType(...) internally.

isNull(any)

returns: boolean

checks to see if passed variable is null, uses kony.utils.getType(...) internally.

isNumber(any)

returns: boolean

checks to see if passed variable is a number, uses kony.utils.getType(...) internally.

isObject(any)

returns: boolean

checks to see if passed variable is an object, uses kony.utils.getType(...) internally.

isRegExp(any)

returns: boolean

checks to see if passed variable is a regular expression instance, uses kony.utils.getType(...) internally.

isString(any)

returns: boolean

checks to see if passed variable is a string, uses kony.utils.getType(...) internally.

isType(any, string)

returns: boolean

checks to see if passed variable is of type passed, uses kony.utils.getType(...) internally.

isUndefined(any)

returns: boolean

checks to see if passed variable is undefined, uses kony.utils.getType(...) internally.

prePad(any, string)

returns: string

uses the second parameter as a template and prepends that to the first parameter, used internally in kony.utils.transformDate(...).

prePad(1, '0000') // '0001'
prePad('hello', '0000') // 'hello'
prePad('hello', '000000') // '0hello'

transformDate(date)

returns: string

converts the passed date object to the format used by MSSQL as it differs slightly from Date.prototype.toISOString() the ISO 8601 Extended Format JavaScript follows.

enhance-kony's People

Contributors

phil-venter avatar philip-bidvest-mobility avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.