summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/prr
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/prr')
-rw-r--r--deps/npm/node_modules/prr/.npmignore1
-rw-r--r--deps/npm/node_modules/prr/.travis.yml10
-rw-r--r--deps/npm/node_modules/prr/LICENSE.md11
-rw-r--r--deps/npm/node_modules/prr/README.md47
-rw-r--r--deps/npm/node_modules/prr/package.json58
-rw-r--r--deps/npm/node_modules/prr/prr.js63
-rw-r--r--deps/npm/node_modules/prr/test.js169
7 files changed, 359 insertions, 0 deletions
diff --git a/deps/npm/node_modules/prr/.npmignore b/deps/npm/node_modules/prr/.npmignore
new file mode 100644
index 0000000000..b512c09d47
--- /dev/null
+++ b/deps/npm/node_modules/prr/.npmignore
@@ -0,0 +1 @@
+node_modules \ No newline at end of file
diff --git a/deps/npm/node_modules/prr/.travis.yml b/deps/npm/node_modules/prr/.travis.yml
new file mode 100644
index 0000000000..33dcbc3a86
--- /dev/null
+++ b/deps/npm/node_modules/prr/.travis.yml
@@ -0,0 +1,10 @@
+language: node_js
+node_js:
+ - 0.8
+ - "0.10"
+branches:
+ only:
+ - master
+notifications:
+ email:
+ - rod@vagg.org \ No newline at end of file
diff --git a/deps/npm/node_modules/prr/LICENSE.md b/deps/npm/node_modules/prr/LICENSE.md
new file mode 100644
index 0000000000..29b95e39a5
--- /dev/null
+++ b/deps/npm/node_modules/prr/LICENSE.md
@@ -0,0 +1,11 @@
+The MIT License (MIT)
+=====================
+
+Copyright (c) 2014 Rod Vagg
+---------------------------
+
+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/deps/npm/node_modules/prr/README.md b/deps/npm/node_modules/prr/README.md
new file mode 100644
index 0000000000..b934048235
--- /dev/null
+++ b/deps/npm/node_modules/prr/README.md
@@ -0,0 +1,47 @@
+# prr [![Build Status](https://secure.travis-ci.org/rvagg/prr.png)](http://travis-ci.org/rvagg/prr)
+
+An sensible alternative to `Object.defineProperty()`. Available in npm and Ender as **prr**.
+
+## Usage
+
+Set the property `'foo'` (`obj.foo`) to have the value `'bar'` with default options (`'enumerable'`, `'configurable'` and `'writable'` are all `false`):
+
+```js
+prr(obj, 'foo', 'bar')
+```
+
+Adjust the default options:
+
+```js
+prr(obj, 'foo', 'bar', { enumerable: true, writable: true })
+```
+
+Do the same operation for multiple properties:
+
+```js
+prr(obj, { one: 'one', two: 'two' })
+// or with options:
+prr(obj, { one: 'one', two: 'two' }, { enumerable: true, writable: true })
+```
+
+### Simplify!
+
+But obviously, having to write out the full options object makes it nearly as bad as the original `Object.defineProperty()` so we can simplify.
+
+As an alternative method we can use an options string where each character represents a option: `'e'=='enumerable'`, `'c'=='configurable'` and `'w'=='writable'`:
+
+```js
+prr(obj, 'foo', 'bar', 'ew') // enumerable and writable but not configurable
+// muliple properties:
+prr(obj, { one: 'one', two: 'two' }, 'ewc') // configurable too
+```
+
+## Where can I use it?
+
+Anywhere! For pre-ES5 environments *prr* will simply fall-back to an `object[property] = value` so you can get close to what you want.
+
+*prr* is Ender-compatible so you can include it in your Ender build and `$.prr(...)` or `var prr = require('prr'); prr(...)`.
+
+## Licence
+
+prr is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
diff --git a/deps/npm/node_modules/prr/package.json b/deps/npm/node_modules/prr/package.json
new file mode 100644
index 0000000000..e0f4dde38b
--- /dev/null
+++ b/deps/npm/node_modules/prr/package.json
@@ -0,0 +1,58 @@
+{
+ "_from": "prr@~1.0.1",
+ "_id": "prr@1.0.1",
+ "_inBundle": false,
+ "_integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
+ "_location": "/prr",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "prr@~1.0.1",
+ "name": "prr",
+ "escapedName": "prr",
+ "rawSpec": "~1.0.1",
+ "saveSpec": null,
+ "fetchSpec": "~1.0.1"
+ },
+ "_requiredBy": [
+ "/errno"
+ ],
+ "_resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
+ "_shasum": "d3fc114ba06995a45ec6893f484ceb1d78f5f476",
+ "_spec": "prr@~1.0.1",
+ "_where": "/Users/rebecca/code/npm/node_modules/errno",
+ "author": {
+ "name": "Rod Vagg",
+ "email": "rod@vagg.org",
+ "url": "https://github.com/rvagg"
+ },
+ "bugs": {
+ "url": "https://github.com/rvagg/prr/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "A better Object.defineProperty()",
+ "devDependencies": {
+ "tap": "*"
+ },
+ "homepage": "https://github.com/rvagg/prr",
+ "keywords": [
+ "property",
+ "properties",
+ "defineProperty",
+ "ender"
+ ],
+ "license": "MIT",
+ "main": "./prr.js",
+ "name": "prr",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/rvagg/prr.git"
+ },
+ "scripts": {
+ "test": "node ./test.js"
+ },
+ "version": "1.0.1"
+}
diff --git a/deps/npm/node_modules/prr/prr.js b/deps/npm/node_modules/prr/prr.js
new file mode 100644
index 0000000000..94f58628be
--- /dev/null
+++ b/deps/npm/node_modules/prr/prr.js
@@ -0,0 +1,63 @@
+/*!
+ * prr
+ * (c) 2013 Rod Vagg <rod@vagg.org>
+ * https://github.com/rvagg/prr
+ * License: MIT
+ */
+
+(function (name, context, definition) {
+ if (typeof module != 'undefined' && module.exports)
+ module.exports = definition()
+ else
+ context[name] = definition()
+})('prr', this, function() {
+
+ var setProperty = typeof Object.defineProperty == 'function'
+ ? function (obj, key, options) {
+ Object.defineProperty(obj, key, options)
+ return obj
+ }
+ : function (obj, key, options) { // < es5
+ obj[key] = options.value
+ return obj
+ }
+
+ , makeOptions = function (value, options) {
+ var oo = typeof options == 'object'
+ , os = !oo && typeof options == 'string'
+ , op = function (p) {
+ return oo
+ ? !!options[p]
+ : os
+ ? options.indexOf(p[0]) > -1
+ : false
+ }
+
+ return {
+ enumerable : op('enumerable')
+ , configurable : op('configurable')
+ , writable : op('writable')
+ , value : value
+ }
+ }
+
+ , prr = function (obj, key, value, options) {
+ var k
+
+ options = makeOptions(value, options)
+
+ if (typeof key == 'object') {
+ for (k in key) {
+ if (Object.hasOwnProperty.call(key, k)) {
+ options.value = key[k]
+ setProperty(obj, k, options)
+ }
+ }
+ return obj
+ }
+
+ return setProperty(obj, key, options)
+ }
+
+ return prr
+}) \ No newline at end of file
diff --git a/deps/npm/node_modules/prr/test.js b/deps/npm/node_modules/prr/test.js
new file mode 100644
index 0000000000..5222e3073c
--- /dev/null
+++ b/deps/npm/node_modules/prr/test.js
@@ -0,0 +1,169 @@
+const test = require('tap').test
+ , prr = require('./')
+
+test('test prr(o, key, value) form', function (t) {
+ t.plan(2)
+
+ var o = {}
+ prr(o, 'foo', 'bar')
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : false
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+ t.end()
+})
+
+test('test prr(o, { key: value }) form', function (t) {
+ t.plan(2)
+
+ var o = {}
+ prr(o, { foo: 'bar' })
+
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : false
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+ t.end()
+})
+
+test('test multiple key:value pairs', function (t) {
+ var o = { foo: 'bar' }
+
+ prr(o, { one: 'ONE', two: 'TWO', obj: { o: 'o' }})
+
+ t.deepEqual(o, { foo: 'bar' }, 'properties are not enumerable')
+ t.equal(o.one, 'ONE', 'correctly set property')
+ t.equal(o.two, 'TWO', 'correctly set property')
+ t.deepEqual(o.obj, { o: 'o' }, 'correctly set property')
+
+ ;[ 'one', 'two', 'obj' ].forEach(function (p) {
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, p)
+ , {
+ enumerable : false
+ , configurable : false
+ , writable : false
+ , value : p == 'obj' ? { o: 'o' } : p.toUpperCase()
+ }
+ , 'correct property descriptor'
+ )
+ })
+
+ t.end()
+})
+
+test('test descriptor options', function (t) {
+ var o = {}
+
+ prr(o, 'foo', 'bar', {
+ enumerable : true
+ , configurable : false
+ })
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : true
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo2', 'bar2', {
+ enumerable : true
+ , configurable : true
+ , writable : false
+ })
+ t.equal(o.foo2, 'bar2', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo2')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : false
+ , value : 'bar2'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo3', 'bar3', {
+ enumerable : true
+ , configurable : true
+ , writable : true
+ })
+ t.equal(o.foo3, 'bar3', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo3')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : true
+ , value : 'bar3'
+ }
+ , 'correct property descriptor'
+ )
+
+ t.end()
+})
+
+
+test('test descriptor options, string form', function (t) {
+ var o = {}
+
+ prr(o, 'foo', 'bar', 'e')
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : true
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo2', 'bar2', 'ec')
+ t.equal(o.foo2, 'bar2', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo2')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : false
+ , value : 'bar2'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo3', 'bar3', 'ecw')
+ t.equal(o.foo3, 'bar3', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo3')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : true
+ , value : 'bar3'
+ }
+ , 'correct property descriptor'
+ )
+
+ t.end()
+})