qipp-services-utils

    2.1.1 • Public • Published

    qipp-services-utils Build Status npm version js-standard-style

    General

    This module provides five factories as utilities: analytics, cssProperties, deepExtend, getScript, windowLocation.

    Install

    npm i qipp-services-utils

    Angular usage

    analytics

    The analytics() factory is a wrapper around the Google Analytics $window objet:

    analytics(args)

    See Google Analytics documentation for further help.

    cssProperties

    This factory returns the corresponding vendor css properties for transitionDuration, transitionEnd and transform of a given element:

    cssProperties(element)
    /*
    Object {
        transitionDuration: "transitionDuration",
        transitionEnd: "transitionend",
        transform: "transform"
    }
    */

    deepExtend

    This service provides a method to deep extend objects or array, like the jQuery extend method with the deep option:

    var ext
    var obj = {
        propA: 123,
        propB: 456
    }
    ext = deepExtend(obj, { propC: 789 })
    console.log(ext) // { propA: 123, propB: 456, propC: 789 }

    getScript

    This factory provides a method is a promise with .success and .error callbacks to dynamically append a given script to the DOM and load it:

    getScript('https://app.qipp.com/scriptToLoad.js')
        .success(function () {
            // Do something.
        })
        .error(function () {
            // Do something else.
        })

    windowLocation

    This factory is a wrapper around $window.location:

    windowLocation() // https://app.qipp.com

    Tools

    Linting with StandardJS

    Please refer to the JavaScript Standard Style for general rules.

    npm run lint

    Unit testing with Karma

    npm test

    Requirements

    Angular

    Google Analytics

    Licence

    Released under the MIT license by qipp.

    Install

    npm i qipp-services-utils

    DownloadsWeekly Downloads

    8

    Version

    2.1.1

    License

    MIT

    Last publish

    Collaborators

    • qipp