aboutsummaryrefslogtreecommitdiffhomepage
path: root/node_modules/object-component
diff options
context:
space:
mode:
authorYaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx>2017-11-29 11:44:34 +0300
committerYaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx>2017-11-29 11:44:34 +0300
commit67fdec20726e48ba3a934cb25bb30d47ec4a4f29 (patch)
tree37fd9f4f0b0c20103e1646fc83021e4765de3680 /node_modules/object-component
downloadspanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.tar.gz
spanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.zip
Initial commit, version 0.5.3
Diffstat (limited to 'node_modules/object-component')
-rw-r--r--node_modules/object-component/.npmignore3
-rw-r--r--node_modules/object-component/History.md10
-rw-r--r--node_modules/object-component/Makefile16
-rw-r--r--node_modules/object-component/Readme.md31
-rw-r--r--node_modules/object-component/component.json10
-rw-r--r--node_modules/object-component/index.js84
-rw-r--r--node_modules/object-component/package.json69
-rw-r--r--node_modules/object-component/test/object.js48
8 files changed, 271 insertions, 0 deletions
diff --git a/node_modules/object-component/.npmignore b/node_modules/object-component/.npmignore
new file mode 100644
index 0000000..665aa21
--- /dev/null
+++ b/node_modules/object-component/.npmignore
@@ -0,0 +1,3 @@
+components
+build
+node_modules
diff --git a/node_modules/object-component/History.md b/node_modules/object-component/History.md
new file mode 100644
index 0000000..15e0ee0
--- /dev/null
+++ b/node_modules/object-component/History.md
@@ -0,0 +1,10 @@
+
+0.0.3 / 2012-10-15
+==================
+
+ * package: added `component` namespace (fixes #1)
+
+0.0.2 / 2012-09-20
+==================
+
+ * add code smell to `.merge()`
diff --git a/node_modules/object-component/Makefile b/node_modules/object-component/Makefile
new file mode 100644
index 0000000..b6b9850
--- /dev/null
+++ b/node_modules/object-component/Makefile
@@ -0,0 +1,16 @@
+
+build: components index.js
+ @component build
+
+components:
+ @Component install
+
+clean:
+ rm -fr build components template.js
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --reporter spec
+
+.PHONY: clean test
diff --git a/node_modules/object-component/Readme.md b/node_modules/object-component/Readme.md
new file mode 100644
index 0000000..2c1f2d6
--- /dev/null
+++ b/node_modules/object-component/Readme.md
@@ -0,0 +1,31 @@
+
+# object
+
+ Object utils.
+
+## API
+
+### .keys(obj)
+
+ Return the keys for `obj`.
+
+### .values(obj)
+
+ Return the values for `obj`.
+
+### .length(obj)
+
+ Return the number of keys for `obj`.
+
+### .isEmpty(obj)
+
+ Check if `obj` is empty.
+
+### .merge(a, b)
+
+ Merge object `b` into `a`, returns `a`.
+ Precedence is given to `b`.
+
+## License
+
+ MIT \ No newline at end of file
diff --git a/node_modules/object-component/component.json b/node_modules/object-component/component.json
new file mode 100644
index 0000000..eebc82a
--- /dev/null
+++ b/node_modules/object-component/component.json
@@ -0,0 +1,10 @@
+{
+ "name": "object",
+ "description": "Object keys / values / length",
+ "version": "0.0.3",
+ "keywords": ["object", "keys", "utility"],
+ "dependencies": {},
+ "scripts": [
+ "index.js"
+ ]
+} \ No newline at end of file
diff --git a/node_modules/object-component/index.js b/node_modules/object-component/index.js
new file mode 100644
index 0000000..dba9eeb
--- /dev/null
+++ b/node_modules/object-component/index.js
@@ -0,0 +1,84 @@
+
+/**
+ * HOP ref.
+ */
+
+var has = Object.prototype.hasOwnProperty;
+
+/**
+ * Return own keys in `obj`.
+ *
+ * @param {Object} obj
+ * @return {Array}
+ * @api public
+ */
+
+exports.keys = Object.keys || function(obj){
+ var keys = [];
+ for (var key in obj) {
+ if (has.call(obj, key)) {
+ keys.push(key);
+ }
+ }
+ return keys;
+};
+
+/**
+ * Return own values in `obj`.
+ *
+ * @param {Object} obj
+ * @return {Array}
+ * @api public
+ */
+
+exports.values = function(obj){
+ var vals = [];
+ for (var key in obj) {
+ if (has.call(obj, key)) {
+ vals.push(obj[key]);
+ }
+ }
+ return vals;
+};
+
+/**
+ * Merge `b` into `a`.
+ *
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Object} a
+ * @api public
+ */
+
+exports.merge = function(a, b){
+ for (var key in b) {
+ if (has.call(b, key)) {
+ a[key] = b[key];
+ }
+ }
+ return a;
+};
+
+/**
+ * Return length of `obj`.
+ *
+ * @param {Object} obj
+ * @return {Number}
+ * @api public
+ */
+
+exports.length = function(obj){
+ return exports.keys(obj).length;
+};
+
+/**
+ * Check if `obj` is empty.
+ *
+ * @param {Object} obj
+ * @return {Boolean}
+ * @api public
+ */
+
+exports.isEmpty = function(obj){
+ return 0 == exports.length(obj);
+}; \ No newline at end of file
diff --git a/node_modules/object-component/package.json b/node_modules/object-component/package.json
new file mode 100644
index 0000000..1220f18
--- /dev/null
+++ b/node_modules/object-component/package.json
@@ -0,0 +1,69 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "object-component@0.0.3",
+ "scope": null,
+ "escapedName": "object-component",
+ "name": "object-component",
+ "rawSpec": "0.0.3",
+ "spec": "0.0.3",
+ "type": "version"
+ },
+ "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/socket.io-client"
+ ]
+ ],
+ "_from": "object-component@0.0.3",
+ "_id": "object-component@0.0.3",
+ "_inCache": true,
+ "_location": "/object-component",
+ "_npmUser": {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "_npmVersion": "1.1.61",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "object-component@0.0.3",
+ "scope": null,
+ "escapedName": "object-component",
+ "name": "object-component",
+ "rawSpec": "0.0.3",
+ "spec": "0.0.3",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/socket.io-client"
+ ],
+ "_resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz",
+ "_shasum": "f0c69aa50efc95b866c186f400a33769cb2f1291",
+ "_shrinkwrap": null,
+ "_spec": "object-component@0.0.3",
+ "_where": "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/socket.io-client",
+ "component": {
+ "scripts": {
+ "object/index.js": "index.js"
+ }
+ },
+ "dependencies": {},
+ "description": "Object utils.",
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "f0c69aa50efc95b866c186f400a33769cb2f1291",
+ "tarball": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz"
+ },
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ }
+ ],
+ "name": "object-component",
+ "optionalDependencies": {},
+ "readme": "\n# object\n\n Object utils.\n\n## API\n\n### .keys(obj)\n\n Return the keys for `obj`.\n\n### .values(obj)\n\n Return the values for `obj`.\n\n### .length(obj)\n\n Return the number of keys for `obj`.\n\n### .isEmpty(obj)\n\n Check if `obj` is empty.\n\n### .merge(a, b)\n\n Merge object `b` into `a`, returns `a`.\n Precedence is given to `b`.\n\n## License\n\n MIT",
+ "version": "0.0.3"
+}
diff --git a/node_modules/object-component/test/object.js b/node_modules/object-component/test/object.js
new file mode 100644
index 0000000..23a7423
--- /dev/null
+++ b/node_modules/object-component/test/object.js
@@ -0,0 +1,48 @@
+
+/**
+ * Module dependencies.
+ */
+
+var object = require('..');
+
+describe('.keys(obj)', function(){
+ it('should return the keys of an object', function(){
+ var obj = { name: 'tobi', age: 1 };
+ object.keys(obj).should.eql(['name', 'age']);
+ })
+})
+
+describe('.values(obj)', function(){
+ it('should return the values of an object', function(){
+ var obj = { name: 'tobi', age: 1 };
+ object.values(obj).should.eql(['tobi', 1]);
+ })
+})
+
+describe('.length(obj)', function(){
+ it('should return key count', function(){
+ var obj = { name: 'tobi', age: 1 };
+ object.length(obj).should.equal(2);
+ })
+})
+
+describe('.merge(a, b)', function(){
+ it('should merge two objects', function(){
+ var a = { foo: 'bar' };
+ var b = { bar: 'baz' };
+ object.merge(a, b).should.eql({ foo: 'bar', bar: 'baz' });
+ })
+
+ it('should give precedence to b', function(){
+ var a = { foo: 'bar' };
+ var b = { foo: 'baz' };
+ object.merge(a, b).should.eql({ foo: 'baz' });
+ })
+})
+
+describe('.isEmpty()', function(){
+ it('should check if the object is empty', function(){
+ object.isEmpty({}).should.be.true;
+ object.isEmpty({ foo: 'bar' }).should.be.false;
+ })
+}) \ No newline at end of file