Updated script that can be controled by Nodejs web app

This commit is contained in:
mac OS
2024-11-25 12:24:18 +07:00
parent c440eda1f4
commit 8b0ab2bd3a
8662 changed files with 1803808 additions and 34 deletions

3
node_modules/object-component/.npmignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
components
build
node_modules

10
node_modules/object-component/History.md generated vendored Normal file
View File

@ -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()`

16
node_modules/object-component/Makefile generated vendored Normal file
View File

@ -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

31
node_modules/object-component/Readme.md generated vendored Normal file
View File

@ -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

10
node_modules/object-component/component.json generated vendored Normal file
View File

@ -0,0 +1,10 @@
{
"name": "object",
"description": "Object keys / values / length",
"version": "0.0.3",
"keywords": ["object", "keys", "utility"],
"dependencies": {},
"scripts": [
"index.js"
]
}

84
node_modules/object-component/index.js generated vendored Normal file
View File

@ -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);
};

13
node_modules/object-component/package.json generated vendored Normal file
View File

@ -0,0 +1,13 @@
{
"name": "object-component",
"version": "0.0.3",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"component": {
"scripts": {
"object/index.js": "index.js"
}
}
}

48
node_modules/object-component/test/object.js generated vendored Normal file
View File

@ -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;
})
})