1.0.1 • Published 7 years ago

js.extend v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

jExtend

Defines usefull methods and functions in order to extend standard javascript

Methods

replaceAll

@param the pattern to search in the string @param the replacement for the matched string @return a new string with all the matches of the pattern replaced

str.replaceAll( 'pattern', 'replacement' )

sequenceAttributes

var obj = {
    a: {
        A: 1,
        B: 2
    },
    b: {
        C: 3,
        D: 4
    }:
    c: [ 5, 6, 7 ]
}

...

obj.sequenceAttributes('a', 'B' ) // 2
obj.sequenceAttributes('b', 'C' ) // 3
obj.sequenceAttributes('b', 'A' ) // undefined
obj.sequenceAttributes('c', 2 )   // 7

isNode

@return true if the element is a node, false otherwise

node.isNode()

isElement

@return true if the element is a html element, false otherwise

elem.isElement()

getVisibleArea

@return Returns element's visible area in percentual

elem.getVisibleArea()

isInViewport

@param full if true the element must be fully visible @return boolean returns true if the element is in the viewport (default: false)

elem.isInViewport(false)

Functions

isNull

@param the variable to check @return true if the variable is null, false otherwise

isNull( myVar )

isUndefined

@param the variable to check @return true if the variable is undefined, false otherwise

isUndefined( myVar )

Installation

npm install js.extend
1.0.1

7 years ago

1.0.0

7 years ago