No Description

underscore.js 841B

1234567891011121314151617181920212223242526272829
  1. define(['./_setup'], function (_setup) {
  2. // If Underscore is called as a function, it returns a wrapped object that can
  3. // be used OO-style. This wrapper holds altered versions of all functions added
  4. // through `_.mixin`. Wrapped objects may be chained.
  5. function _(obj) {
  6. if (obj instanceof _) return obj;
  7. if (!(this instanceof _)) return new _(obj);
  8. this._wrapped = obj;
  9. }
  10. _.VERSION = _setup.VERSION;
  11. // Extracts the result from a wrapped and chained object.
  12. _.prototype.value = function() {
  13. return this._wrapped;
  14. };
  15. // Provide unwrapping proxies for some methods used in engine operations
  16. // such as arithmetic and JSON stringification.
  17. _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
  18. _.prototype.toString = function() {
  19. return String(this._wrapped);
  20. };
  21. return _;
  22. });