Giter VIP home page Giter VIP logo

object.js's Introduction

  ___  _     _           _      _     
 / _ \| |__ (_) ___  ___| |_   (_)___ 
| | | | '_ \| |/ _ \/ __| __|  | / __|
| |_| | |_) | |  __/ (__| |_ _ | \__ \
 \___/|_.__// |\___|\___|\__(_)/ |___/
          |__/               |__/     

Motivation

This library provides functionality to support the composition of objects in a javascript-idiosyncratic style, giving us the conveniences that a class system provides while not trying to approximate a class system.

Object.js encourages composition over inheritance.

Features

  • Mixins
  • Override functions of an existing object
  • Easily specify defaults for an options argument
  • Iterate over object key-value pairs
  • Slice an objects members
  • Copy objects
  • Wrap and delegate to another object
  • Extensible: object(obj).yourFunctionHere()

Dependencies

Object.js has zero dependencies.

Usage

object(obj).mixin({ ... });
object(obj).qmixin({ ... });
object(obj).defaults({ ... });
object(obj).overwrite({ ... });
object(obj).override({ ... });
object(obj).copy();
object(obj).deepCopy();
object(obj).each(function (value, key) { ... });
object(obj).map(function (value, key) { ... });
object(obj).delegateTo(otherObj, 'this', 'that', 'theOther');
object(obj).toArray()
// use plugins to have ...
object(obj).yourFunctionHere();

object is not likely to be a javascript reserve word in the future

Browser and Platform Support

Works in

  • Chrome 17+
  • Firefox 7+
  • Safari 5.13+

Has not been tested in other browsers

Acknowledgements

Contributing

  1. Install node
  2. Install cup and read the docs
  3. Write some code or docs
  4. Make a pull request
  5. Live happily ever after

object.js's People

Contributors

s6577t avatar

Watchers

 avatar James Cloos 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.