aboutsummaryrefslogtreecommitdiff
path: root/node_modules/deprecated
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/deprecated')
-rw-r--r--node_modules/deprecated/.npmignore6
-rw-r--r--node_modules/deprecated/.travis.yml6
-rwxr-xr-xnode_modules/deprecated/LICENSE20
-rw-r--r--node_modules/deprecated/README.md51
-rw-r--r--node_modules/deprecated/index.js39
-rw-r--r--node_modules/deprecated/package.json35
-rw-r--r--node_modules/deprecated/test/field.js44
-rw-r--r--node_modules/deprecated/test/method.js32
8 files changed, 233 insertions, 0 deletions
diff --git a/node_modules/deprecated/.npmignore b/node_modules/deprecated/.npmignore
new file mode 100644
index 000000000..b5ef13a3c
--- /dev/null
+++ b/node_modules/deprecated/.npmignore
@@ -0,0 +1,6 @@
+.DS_Store
+*.log
+node_modules
+build
+*.node
+components \ No newline at end of file
diff --git a/node_modules/deprecated/.travis.yml b/node_modules/deprecated/.travis.yml
new file mode 100644
index 000000000..33ad9f8c8
--- /dev/null
+++ b/node_modules/deprecated/.travis.yml
@@ -0,0 +1,6 @@
+language: node_js
+node_js:
+ - "0.9"
+ - "0.10"
+after_script:
+ - npm run coveralls \ No newline at end of file
diff --git a/node_modules/deprecated/LICENSE b/node_modules/deprecated/LICENSE
new file mode 100755
index 000000000..7cbe012c6
--- /dev/null
+++ b/node_modules/deprecated/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2014 Fractal <contact@wearefractal.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/deprecated/README.md b/node_modules/deprecated/README.md
new file mode 100644
index 000000000..493e6ea5f
--- /dev/null
+++ b/node_modules/deprecated/README.md
@@ -0,0 +1,51 @@
+# deprecated [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][david-image]][david-url]
+
+
+## Information
+
+<table>
+<tr>
+<td>Package</td><td>deprecated</td>
+</tr>
+<tr>
+<td>Description</td>
+<td>Tool for deprecating things</td>
+</tr>
+<tr>
+<td>Node Version</td>
+<td>>= 0.9</td>
+</tr>
+</table>
+
+## Usage
+
+```javascript
+var oldfn = function(a,b) {
+ return a+b;
+};
+
+// returns a new wrapper function that logs the deprecated function once
+var somefn = deprecated('dont use this anymore', console.log, oldfn);
+
+var someobj = {};
+
+// set up a getter/set for field that logs deprecated message once
+deprecated('dont use this anymore', console.log, someobj, 'a', 123);
+
+console.log(someobj.a); // 123
+```
+
+[npm-url]: https://npmjs.org/package/deprecated
+[npm-image]: https://badge.fury.io/js/deprecated.png
+
+[travis-url]: https://travis-ci.org/wearefractal/deprecated
+[travis-image]: https://travis-ci.org/wearefractal/deprecated.png?branch=master
+
+[coveralls-url]: https://coveralls.io/r/wearefractal/deprecated
+[coveralls-image]: https://coveralls.io/repos/wearefractal/deprecated/badge.png
+
+[depstat-url]: https://david-dm.org/wearefractal/deprecated
+[depstat-image]: https://david-dm.org/wearefractal/deprecated.png
+
+[david-url]: https://david-dm.org/wearefractal/deprecated
+[david-image]: https://david-dm.org/wearefractal/deprecated.png?theme=shields.io \ No newline at end of file
diff --git a/node_modules/deprecated/index.js b/node_modules/deprecated/index.js
new file mode 100644
index 000000000..f689e9cd1
--- /dev/null
+++ b/node_modules/deprecated/index.js
@@ -0,0 +1,39 @@
+var deprecated = {
+ method: function(msg, log, fn) {
+ var called = false;
+ return function(){
+ if (!called) {
+ called = true;
+ log(msg);
+ }
+ return fn.apply(this, arguments);
+ };
+ },
+
+ field: function(msg, log, parent, field, val) {
+ var called = false;
+ var getter = function(){
+ if (!called) {
+ called = true;
+ log(msg);
+ }
+ return val;
+ };
+ var setter = function(v) {
+ if (!called) {
+ called = true;
+ log(msg);
+ }
+ val = v;
+ return v;
+ };
+ Object.defineProperty(parent, field, {
+ get: getter,
+ set: setter,
+ enumerable: true
+ });
+ return;
+ }
+};
+
+module.exports = deprecated; \ No newline at end of file
diff --git a/node_modules/deprecated/package.json b/node_modules/deprecated/package.json
new file mode 100644
index 000000000..5556b908d
--- /dev/null
+++ b/node_modules/deprecated/package.json
@@ -0,0 +1,35 @@
+{
+ "name":"deprecated",
+ "description":"Tool for deprecating things",
+ "version":"0.0.1",
+ "homepage":"http://github.com/wearefractal/deprecated",
+ "repository":"git://github.com/wearefractal/deprecated.git",
+ "author":"Fractal <contact@wearefractal.com> (http://wearefractal.com/)",
+ "main":"./index.js",
+
+ "dependencies":{
+
+ },
+ "devDependencies": {
+ "mocha": "~1.17.0",
+ "should": "~3.1.0",
+ "mocha-lcov-reporter": "~0.0.1",
+ "coveralls": "~2.6.1",
+ "istanbul": "~0.2.3",
+ "rimraf": "~2.2.5",
+ "jshint": "~2.4.1"
+ },
+ "scripts": {
+ "test": "mocha --reporter spec && jshint",
+ "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"
+ },
+ "engines": {
+ "node": ">= 0.9"
+ },
+ "licenses":[
+ {
+ "type":"MIT",
+ "url":"http://github.com/wearefractal/deprecated/raw/master/LICENSE"
+ }
+ ]
+}
diff --git a/node_modules/deprecated/test/field.js b/node_modules/deprecated/test/field.js
new file mode 100644
index 000000000..91a7029c7
--- /dev/null
+++ b/node_modules/deprecated/test/field.js
@@ -0,0 +1,44 @@
+var deprecated = require('../');
+var should = require('should');
+require('mocha');
+
+describe('field()', function() {
+ it('should return a wrapped function that logs once on get', function(done) {
+ var message = 'testing';
+ var scope = {
+ a: 1
+ };
+ var obj = {};
+ var logged = false;
+ var log = function(msg){
+ msg.should.equal(message);
+ logged.should.equal(false);
+ logged = true;
+ };
+ deprecated.field(message, log, obj, 'a', 123);
+
+ obj.a.should.equal(123);
+ obj.a = 1234;
+ obj.a.should.equal(1234);
+ logged.should.equal(true);
+ done();
+ });
+ it('should return a wrapped function that logs once on set', function(done) {
+ var message = 'testing';
+ var scope = {
+ a: 1
+ };
+ var obj = {};
+ var logged = false;
+ var log = function(msg){
+ msg.should.equal(message);
+ logged.should.equal(false);
+ logged = true;
+ };
+ deprecated.field(message, log, obj, 'a', 123);
+
+ obj.a = 1234;
+ logged.should.equal(true);
+ done();
+ });
+}); \ No newline at end of file
diff --git a/node_modules/deprecated/test/method.js b/node_modules/deprecated/test/method.js
new file mode 100644
index 000000000..615ba9454
--- /dev/null
+++ b/node_modules/deprecated/test/method.js
@@ -0,0 +1,32 @@
+var deprecated = require('../');
+var should = require('should');
+require('mocha');
+
+describe('method()', function() {
+ it('should return a wrapped function that logs once', function(done) {
+ var message = 'testing';
+ var scope = {
+ a: 1
+ };
+ var logged = false;
+ var log = function(msg){
+ msg.should.equal(message);
+ logged.should.equal(false);
+ logged = true;
+ };
+ var fn = deprecated.method(message, log, function(one, two){
+ this.should.equal(scope);
+ one.should.equal(1);
+ two.should.equal(2);
+ return one+two;
+ });
+
+ fn.bind(scope)(1,2).should.equal(3);
+ fn.bind(scope)(1,2).should.equal(3);
+ fn.bind(scope)(1,2).should.equal(3);
+ fn.bind(scope)(1,2).should.equal(3);
+
+ logged.should.equal(true);
+ done();
+ });
+}); \ No newline at end of file