Code Monkey home page Code Monkey logo

underscore-angularized's Introduction

Underscore-Angularized

AngularJS wrapper for Underscore

Build Status

What is it?

Underscore is a fantastic JavaScript library and it's an invaluable tool for web developers. I made this wrapper to solve two particular issues for Angular developers.

  • Underscore is now fully in the Angular digest lifecycle: Underscore provides a number of asynchronous functions that falls outside of the angular lifecycle and it's up to you to manage it with manual $scope.$apply() calls. (_.throttle and _.debounce as examples) You can now use any function provided by Underscore and it will be in the angular lifecycle.
  • It's now off the global scope: Angular provides an excellent Dependency Injection system and Underscore is now an injectable service. This keeps it off the global namespace and helps with unit testing.

The only part of Underscore that's been modified is that all setTimeout and clearTimeout calls have been respectively replaced with $timeout and $timeout.cancel(). Besides those changes it's 100% stock Underscore.

Dependencies

AngularJS : 1.2+ (It's possible this will work on older versions of Angular . Older versions of Angular have not been tested and it's not currently supported.)

Installation

Project files are also available through Bower

bower install underscore-angularized

or GitHub:

git clone https://github.com/ng-angularized/underscore-angularized.git

Then load the module into your main module.

angular.module('myModule', ['underscore-angularized']);

Usage

To use underscore, just load it as a dependency into your module.

angular.module('myModule').controller('myController', ['underscore', function(_){
    //Use Underscore here...
}])

Supported browsers

Directives from this repository are automatically tested with the following browsers:

  • Chrome
  • Firefox
  • IE 9+
  • Opera
  • Safari

Modern mobile browsers should work without problems.

Tests (using PhantomJS)

Install Dependencies for Testing

  • Install Node.js and NPM
  • Install local dev dependencies: npm install while current directory is underscore-angularized repo

Run the tests

  • Run Default test: grunt run test

Browser Based Tests

  • Run Chrome tests: grunt run test-chrome
  • Run Firefox tests: grunt run test-firefox
  • Run IE tests: grunt run test-ie
NOTE: The tests are split apart to ensure it always runs in PhantomJS. If you want to test in a particular browser, just run that test!

underscore-angularized's People

Contributors

nicksterling avatar rlichlyterklein 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.