summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/delegates
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2015-10-09 23:13:57 -0700
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2015-10-22 13:56:09 -0400
commit41923c0c0795cfa6c465821387fca88fe8811367 (patch)
tree853587bc888fde98f714d72050edceb4785145de /deps/npm/node_modules/delegates
parent9b8886446dd183cee26adf9c603f8e1cd5da74bd (diff)
downloadandroid-node-v8-41923c0c0795cfa6c465821387fca88fe8811367.tar.gz
android-node-v8-41923c0c0795cfa6c465821387fca88fe8811367.tar.bz2
android-node-v8-41923c0c0795cfa6c465821387fca88fe8811367.zip
deps: upgrade npm to 3.3.6
PR-URL: https://github.com/nodejs/node/pull/3310 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/node_modules/delegates')
-rw-r--r--deps/npm/node_modules/delegates/.npmignore1
-rw-r--r--deps/npm/node_modules/delegates/History.md16
-rw-r--r--deps/npm/node_modules/delegates/Makefile8
-rw-r--r--deps/npm/node_modules/delegates/Readme.md94
-rw-r--r--deps/npm/node_modules/delegates/index.js121
-rw-r--r--deps/npm/node_modules/delegates/package.json71
-rw-r--r--deps/npm/node_modules/delegates/test/index.js94
7 files changed, 405 insertions, 0 deletions
diff --git a/deps/npm/node_modules/delegates/.npmignore b/deps/npm/node_modules/delegates/.npmignore
new file mode 100644
index 0000000000..c2658d7d1b
--- /dev/null
+++ b/deps/npm/node_modules/delegates/.npmignore
@@ -0,0 +1 @@
+node_modules/
diff --git a/deps/npm/node_modules/delegates/History.md b/deps/npm/node_modules/delegates/History.md
new file mode 100644
index 0000000000..aee31a4c35
--- /dev/null
+++ b/deps/npm/node_modules/delegates/History.md
@@ -0,0 +1,16 @@
+
+0.1.0 / 2014-10-17
+==================
+
+ * adds `.fluent()` to api
+
+0.0.3 / 2014-01-13
+==================
+
+ * fix receiver for .method()
+
+0.0.2 / 2014-01-13
+==================
+
+ * Object.defineProperty() sucks
+ * Initial commit
diff --git a/deps/npm/node_modules/delegates/Makefile b/deps/npm/node_modules/delegates/Makefile
new file mode 100644
index 0000000000..a9dcfd50db
--- /dev/null
+++ b/deps/npm/node_modules/delegates/Makefile
@@ -0,0 +1,8 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --reporter spec \
+ --bail
+
+.PHONY: test \ No newline at end of file
diff --git a/deps/npm/node_modules/delegates/Readme.md b/deps/npm/node_modules/delegates/Readme.md
new file mode 100644
index 0000000000..ab8cf4ace1
--- /dev/null
+++ b/deps/npm/node_modules/delegates/Readme.md
@@ -0,0 +1,94 @@
+
+# delegates
+
+ Node method and accessor delegation utilty.
+
+## Installation
+
+```
+$ npm install delegates
+```
+
+## Example
+
+```js
+var delegate = require('delegates');
+
+...
+
+delegate(proto, 'request')
+ .method('acceptsLanguages')
+ .method('acceptsEncodings')
+ .method('acceptsCharsets')
+ .method('accepts')
+ .method('is')
+ .access('querystring')
+ .access('idempotent')
+ .access('socket')
+ .access('length')
+ .access('query')
+ .access('search')
+ .access('status')
+ .access('method')
+ .access('path')
+ .access('body')
+ .access('host')
+ .access('url')
+ .getter('subdomains')
+ .getter('protocol')
+ .getter('header')
+ .getter('stale')
+ .getter('fresh')
+ .getter('secure')
+ .getter('ips')
+ .getter('ip')
+```
+
+# API
+
+## Delegate(proto, prop)
+
+Creates a delegator instance used to configure using the `prop` on the given
+`proto` object. (which is usually a prototype)
+
+## Delegate#method(name)
+
+Allows the given method `name` to be accessed on the host.
+
+## Delegate#getter(name)
+
+Creates a "getter" for the property with the given `name` on the delegated
+object.
+
+## Delegate#setter(name)
+
+Creates a "setter" for the property with the given `name` on the delegated
+object.
+
+## Delegate#access(name)
+
+Creates an "accessor" (ie: both getter *and* setter) for the property with the
+given `name` on the delegated object.
+
+## Delegate#fluent(name)
+
+A unique type of "accessor" that works for a "fluent" API. When called as a
+getter, the method returns the expected value. However, if the method is called
+with a value, it will return itself so it can be chained. For example:
+
+```js
+delegate(proto, 'request')
+ .fluent('query')
+
+// getter
+var q = request.query();
+
+// setter (chainable)
+request
+ .query({ a: 1 })
+ .query({ b: 2 });
+```
+
+# License
+
+ MIT
diff --git a/deps/npm/node_modules/delegates/index.js b/deps/npm/node_modules/delegates/index.js
new file mode 100644
index 0000000000..17c222d529
--- /dev/null
+++ b/deps/npm/node_modules/delegates/index.js
@@ -0,0 +1,121 @@
+
+/**
+ * Expose `Delegator`.
+ */
+
+module.exports = Delegator;
+
+/**
+ * Initialize a delegator.
+ *
+ * @param {Object} proto
+ * @param {String} target
+ * @api public
+ */
+
+function Delegator(proto, target) {
+ if (!(this instanceof Delegator)) return new Delegator(proto, target);
+ this.proto = proto;
+ this.target = target;
+ this.methods = [];
+ this.getters = [];
+ this.setters = [];
+ this.fluents = [];
+}
+
+/**
+ * Delegate method `name`.
+ *
+ * @param {String} name
+ * @return {Delegator} self
+ * @api public
+ */
+
+Delegator.prototype.method = function(name){
+ var proto = this.proto;
+ var target = this.target;
+ this.methods.push(name);
+
+ proto[name] = function(){
+ return this[target][name].apply(this[target], arguments);
+ };
+
+ return this;
+};
+
+/**
+ * Delegator accessor `name`.
+ *
+ * @param {String} name
+ * @return {Delegator} self
+ * @api public
+ */
+
+Delegator.prototype.access = function(name){
+ return this.getter(name).setter(name);
+};
+
+/**
+ * Delegator getter `name`.
+ *
+ * @param {String} name
+ * @return {Delegator} self
+ * @api public
+ */
+
+Delegator.prototype.getter = function(name){
+ var proto = this.proto;
+ var target = this.target;
+ this.getters.push(name);
+
+ proto.__defineGetter__(name, function(){
+ return this[target][name];
+ });
+
+ return this;
+};
+
+/**
+ * Delegator setter `name`.
+ *
+ * @param {String} name
+ * @return {Delegator} self
+ * @api public
+ */
+
+Delegator.prototype.setter = function(name){
+ var proto = this.proto;
+ var target = this.target;
+ this.setters.push(name);
+
+ proto.__defineSetter__(name, function(val){
+ return this[target][name] = val;
+ });
+
+ return this;
+};
+
+/**
+ * Delegator fluent accessor
+ *
+ * @param {String} name
+ * @return {Delegator} self
+ * @api public
+ */
+
+Delegator.prototype.fluent = function (name) {
+ var proto = this.proto;
+ var target = this.target;
+ this.fluents.push(name);
+
+ proto[name] = function(val){
+ if ('undefined' != typeof val) {
+ this[target][name] = val;
+ return this;
+ } else {
+ return this[target][name];
+ }
+ };
+
+ return this;
+};
diff --git a/deps/npm/node_modules/delegates/package.json b/deps/npm/node_modules/delegates/package.json
new file mode 100644
index 0000000000..3d6aaa8fa4
--- /dev/null
+++ b/deps/npm/node_modules/delegates/package.json
@@ -0,0 +1,71 @@
+{
+ "_args": [
+ [
+ "delegates@^0.1.0",
+ "/Users/rebecca/code/npm/node_modules/are-we-there-yet"
+ ]
+ ],
+ "_from": "delegates@>=0.1.0 <0.2.0",
+ "_id": "delegates@0.1.0",
+ "_inCache": true,
+ "_location": "/delegates",
+ "_npmUser": {
+ "email": "dominic@dbarnes.info",
+ "name": "dominicbarnes"
+ },
+ "_npmVersion": "1.4.9",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "delegates",
+ "raw": "delegates@^0.1.0",
+ "rawSpec": "^0.1.0",
+ "scope": null,
+ "spec": ">=0.1.0 <0.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/are-we-there-yet"
+ ],
+ "_resolved": "https://registry.npmjs.org/delegates/-/delegates-0.1.0.tgz",
+ "_shasum": "b4b57be11a1653517a04b27f0949bdc327dfe390",
+ "_shrinkwrap": null,
+ "_spec": "delegates@^0.1.0",
+ "_where": "/Users/rebecca/code/npm/node_modules/are-we-there-yet",
+ "bugs": {
+ "url": "https://github.com/visionmedia/node-delegates/issues"
+ },
+ "dependencies": {},
+ "description": "delegate methods and accessors to another property",
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "b4b57be11a1653517a04b27f0949bdc327dfe390",
+ "tarball": "http://registry.npmjs.org/delegates/-/delegates-0.1.0.tgz"
+ },
+ "homepage": "https://github.com/visionmedia/node-delegates",
+ "keywords": [
+ "delegate",
+ "delegation"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ {
+ "name": "dominicbarnes",
+ "email": "dominic@dbarnes.info"
+ }
+ ],
+ "name": "delegates",
+ "optionalDependencies": {},
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/visionmedia/node-delegates"
+ },
+ "version": "0.1.0"
+}
diff --git a/deps/npm/node_modules/delegates/test/index.js b/deps/npm/node_modules/delegates/test/index.js
new file mode 100644
index 0000000000..7b6e3d4df1
--- /dev/null
+++ b/deps/npm/node_modules/delegates/test/index.js
@@ -0,0 +1,94 @@
+
+var assert = require('assert');
+var delegate = require('..');
+
+describe('.method(name)', function(){
+ it('should delegate methods', function(){
+ var obj = {};
+
+ obj.request = {
+ foo: function(bar){
+ assert(this == obj.request);
+ return bar;
+ }
+ };
+
+ delegate(obj, 'request').method('foo');
+
+ obj.foo('something').should.equal('something');
+ })
+})
+
+describe('.getter(name)', function(){
+ it('should delegate getters', function(){
+ var obj = {};
+
+ obj.request = {
+ get type() {
+ return 'text/html';
+ }
+ }
+
+ delegate(obj, 'request').getter('type');
+
+ obj.type.should.equal('text/html');
+ })
+})
+
+describe('.setter(name)', function(){
+ it('should delegate setters', function(){
+ var obj = {};
+
+ obj.request = {
+ get type() {
+ return this._type.toUpperCase();
+ },
+
+ set type(val) {
+ this._type = val;
+ }
+ }
+
+ delegate(obj, 'request').setter('type');
+
+ obj.type = 'hey';
+ obj.request.type.should.equal('HEY');
+ })
+})
+
+describe('.access(name)', function(){
+ it('should delegate getters and setters', function(){
+ var obj = {};
+
+ obj.request = {
+ get type() {
+ return this._type.toUpperCase();
+ },
+
+ set type(val) {
+ this._type = val;
+ }
+ }
+
+ delegate(obj, 'request').access('type');
+
+ obj.type = 'hey';
+ obj.type.should.equal('HEY');
+ })
+})
+
+describe('.fluent(name)', function () {
+ it('should delegate in a fluent fashion', function () {
+ var obj = {
+ settings: {
+ env: 'development'
+ }
+ };
+
+ delegate(obj, 'settings').fluent('env');
+
+ obj.env().should.equal('development');
+ obj.env('production').should.equal(obj);
+ obj.settings.env.should.equal('production');
+ })
+})