attr-accessor
Advanced tools
Comparing version 0.1.0 to 0.1.1
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.attr=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
var __slice = [].slice; | ||
var clone, | ||
__hasProp = {}.hasOwnProperty; | ||
clone = function(object) { | ||
var cloned, key, value; | ||
cloned = {}; | ||
for (key in object) { | ||
if (!__hasProp.call(object, key)) continue; | ||
value = object[key]; | ||
cloned[key] = value; | ||
} | ||
return cloned; | ||
}; | ||
module.exports = { | ||
reader: function(object) { | ||
reader: function(object, options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
options = clone(options); | ||
if (options.configurable == null) { | ||
options.configurable = true; | ||
} | ||
return function(properties) { | ||
@@ -10,6 +29,4 @@ var getter, name; | ||
getter = properties[name]; | ||
Object.defineProperty(object, name, { | ||
get: getter, | ||
enumerable: true | ||
}); | ||
options.get = getter; | ||
Object.defineProperty(object, name, options); | ||
} | ||
@@ -19,3 +36,10 @@ return void 0; | ||
}, | ||
writer: function(object) { | ||
writer: function(object, options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
options = clone(options); | ||
if (options.configurable == null) { | ||
options.configurable = true; | ||
} | ||
return function(properties) { | ||
@@ -25,6 +49,4 @@ var name, setter; | ||
setter = properties[name]; | ||
Object.defineProperty(object, name, { | ||
set: setter, | ||
enumerable: true | ||
}); | ||
options.set = setter; | ||
Object.defineProperty(object, name, options); | ||
} | ||
@@ -34,21 +56,12 @@ return void 0; | ||
}, | ||
readers: function() { | ||
var object, objects, _i, _len, _results; | ||
objects = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
_results = []; | ||
for (_i = 0, _len = objects.length; _i < _len; _i++) { | ||
object = objects[_i]; | ||
_results.push(this.reader(object)); | ||
accessor: function(object, options) { | ||
var ioptions; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
return _results; | ||
}, | ||
writers: function() { | ||
var object, objects, _i, _len, _results; | ||
objects = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
_results = []; | ||
for (_i = 0, _len = objects.length; _i < _len; _i++) { | ||
object = objects[_i]; | ||
_results.push(this.writer(object)); | ||
ioptions = clone(options); | ||
if (ioptions.enumerable == null) { | ||
ioptions.enumerable = true; | ||
} | ||
return _results; | ||
return [this.reader(object.prototype, ioptions), this.writer(object.prototype, ioptions), this.reader(object, options), this.writer(object, options)]; | ||
} | ||
@@ -55,0 +68,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.attr=e()}}(function(){return function e(r,n,t){function o(f,u){if(!n[f]){if(!r[f]){var a="function"==typeof require&&require;if(!u&&a)return a(f,!0);if(i)return i(f,!0);throw new Error("Cannot find module '"+f+"'")}var l=n[f]={exports:{}};r[f][0].call(l.exports,function(e){var n=r[f][1][e];return o(n?n:e)},l,l.exports,e,r,n,t)}return n[f].exports}for(var i="function"==typeof require&&require,f=0;f<t.length;f++)o(t[f]);return o}({1:[function(e,r){var n=[].slice;r.exports={reader:function(e){return function(r){var n,t;for(t in r)n=r[t],Object.defineProperty(e,t,{get:n,enumerable:!0});return void 0}},writer:function(e){return function(r){var n,t;for(n in r)t=r[n],Object.defineProperty(e,n,{set:t,enumerable:!0});return void 0}},readers:function(){var e,r,t,o,i;for(r=1<=arguments.length?n.call(arguments,0):[],i=[],t=0,o=r.length;o>t;t++)e=r[t],i.push(this.reader(e));return i},writers:function(){var e,r,t,o,i;for(r=1<=arguments.length?n.call(arguments,0):[],i=[],t=0,o=r.length;o>t;t++)e=r[t],i.push(this.writer(e));return i}}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.attr=e()}}(function(){return function e(r,n,t){function o(u,f){if(!n[u]){if(!r[u]){var l="function"==typeof require&&require;if(!f&&l)return l(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var a=n[u]={exports:{}};r[u][0].call(a.exports,function(e){var n=r[u][1][e];return o(n?n:e)},a,a.exports,e,r,n,t)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<t.length;u++)o(t[u]);return o}({1:[function(e,r){var n,t={}.hasOwnProperty;n=function(e){var r,n,o;r={};for(n in e)t.call(e,n)&&(o=e[n],r[n]=o);return r},r.exports={reader:function(e,r){return null==r&&(r={}),r=n(r),null==r.configurable&&(r.configurable=!0),function(n){var t,o;for(o in n)t=n[o],r.get=t,Object.defineProperty(e,o,r);return void 0}},writer:function(e,r){return null==r&&(r={}),r=n(r),null==r.configurable&&(r.configurable=!0),function(n){var t,o;for(t in n)o=n[t],r.set=o,Object.defineProperty(e,t,r);return void 0}},accessor:function(e,r){var t;return null==r&&(r={}),t=n(r),null==t.enumerable&&(t.enumerable=!0),[this.reader(e.prototype,t),this.writer(e.prototype,t),this.reader(e,r),this.writer(e,r)]}}},{}]},{},[1])(1)}); |
@@ -1,4 +0,14 @@ | ||
var clone; | ||
var clone, | ||
__hasProp = {}.hasOwnProperty; | ||
clone = require('clone'); | ||
clone = function(object) { | ||
var cloned, key, value; | ||
cloned = {}; | ||
for (key in object) { | ||
if (!__hasProp.call(object, key)) continue; | ||
value = object[key]; | ||
cloned[key] = value; | ||
} | ||
return cloned; | ||
}; | ||
@@ -11,2 +21,5 @@ module.exports = { | ||
options = clone(options); | ||
if (options.configurable == null) { | ||
options.configurable = true; | ||
} | ||
return function(properties) { | ||
@@ -27,2 +40,5 @@ var getter, name; | ||
options = clone(options); | ||
if (options.configurable == null) { | ||
options.configurable = true; | ||
} | ||
return function(properties) { | ||
@@ -44,5 +60,7 @@ var name, setter; | ||
ioptions = clone(options); | ||
ioptions.enumerable || (ioptions.enumerable = true); | ||
if (ioptions.enumerable == null) { | ||
ioptions.enumerable = true; | ||
} | ||
return [this.reader(object.prototype, ioptions), this.writer(object.prototype, ioptions), this.reader(object, options), this.writer(object, options)]; | ||
} | ||
}; |
{ | ||
"name": "attr-accessor", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Convenience factories for creating getter/setters", | ||
@@ -25,5 +25,2 @@ "main": "lib/attr.js", | ||
], | ||
"dependencies": { | ||
"clone": "^0.1.18" | ||
}, | ||
"devDependencies": { | ||
@@ -30,0 +27,0 @@ "chai": "^1.9.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9351
0
127
- Removedclone@^0.1.18
- Removedclone@0.1.19(transitive)