Galerie und tage
This commit is contained in:
3
node_modules/whet.extend/.npmignore
generated
vendored
Normal file
3
node_modules/whet.extend/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
support
|
||||
examples
|
||||
*.sock
|
||||
4
node_modules/whet.extend/.travis.yml
generated
vendored
Normal file
4
node_modules/whet.extend/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
52
node_modules/whet.extend/Cakefile
generated
vendored
Normal file
52
node_modules/whet.extend/Cakefile
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
fs = require 'fs'
|
||||
CoffeeScript = require 'coffee-script'
|
||||
{spawn, exec} = require 'child_process'
|
||||
|
||||
# ANSI Terminal Colors.
|
||||
enableColors = no
|
||||
unless process.platform is 'win32'
|
||||
enableColors = not process.env.NODE_DISABLE_COLORS
|
||||
|
||||
bold = red = green = reset = ''
|
||||
if enableColors
|
||||
bold = '\x1B[0;1m'
|
||||
red = '\x1B[0;31m'
|
||||
green = '\x1B[0;32m'
|
||||
reset = '\x1B[0m'
|
||||
|
||||
|
||||
###
|
||||
Just proc extender
|
||||
###
|
||||
proc_extender = (cb, proc) =>
|
||||
proc.stderr.on 'data', (buffer) -> console.log "#{buffer}"
|
||||
# proc.stdout.on 'data', (buffer) -> console.log "#{buffer}".info
|
||||
proc.on 'exit', (status) ->
|
||||
process.exit(1) if status != 0
|
||||
cb() if typeof cb is 'function'
|
||||
null
|
||||
|
||||
# Run a CoffeeScript through our node/coffee interpreter.
|
||||
run_coffee = (args, cb) =>
|
||||
proc_extender cb, spawn 'node', ['./node_modules/.bin/coffee'].concat(args)
|
||||
|
||||
# Run a mocha tests
|
||||
run_mocha = (args, cb) =>
|
||||
proc_extender cb, spawn 'node', ['./node_modules/.bin/mocha'].concat(args)
|
||||
|
||||
# Log a message with a color.
|
||||
log = (message, color, explanation) ->
|
||||
console.log color + message + reset + ' ' + (explanation or '')
|
||||
|
||||
|
||||
task 'build', 'build module from source', build = (cb) ->
|
||||
files = fs.readdirSync 'src'
|
||||
files = ('src/' + file for file in files when file.match(/\.coffee$/))
|
||||
run_coffee ['-c', '-o', 'lib/'].concat(files), cb
|
||||
log ' -> build done', green
|
||||
|
||||
task 'test', 'test builded module', ->
|
||||
build ->
|
||||
test_file = './test/extend_test.coffee'
|
||||
run_mocha test_file, -> log ' -> all tests passed :)', green
|
||||
|
||||
28
node_modules/whet.extend/History.md
generated
vendored
Normal file
28
node_modules/whet.extend/History.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
## 0.9.9 / 2013-01-28 01:20 AM
|
||||
|
||||
- Re-write tests to Mocha
|
||||
- Remove 'null' and 'undefined' filter
|
||||
- Fix Cakefile
|
||||
|
||||
## 0.9.7 / 2012-06-21 02:54 PM
|
||||
|
||||
- Rename extend.{ext} -> whet.extend.{ext}
|
||||
|
||||
## 0.9.5 / 2012-05-24 07:56 PM
|
||||
|
||||
- Add travis-ci tests
|
||||
- fix index.js
|
||||
|
||||
|
||||
## 0.9.4 / 2012-05-24 03:08 PM
|
||||
|
||||
- Move .coffee to ./scr, add compiled .js version to ./lib
|
||||
- Move CoffeeScript to develop dependencies
|
||||
- Add Cakefile
|
||||
- Doc improved
|
||||
- Small fix
|
||||
|
||||
|
||||
## 0.9.1 / 2012-05-17 11:05 AM
|
||||
|
||||
- Initial release
|
||||
22
node_modules/whet.extend/LICENSE
generated
vendored
Normal file
22
node_modules/whet.extend/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012 Dmitrii Karpich
|
||||
|
||||
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.
|
||||
21
node_modules/whet.extend/Readme.md
generated
vendored
Normal file
21
node_modules/whet.extend/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
[](http://travis-ci.org/Meettya/whet.extend)
|
||||
|
||||
# whet.extend
|
||||
|
||||
A sharped version of node.extend as port of jQuery.extend that **actually works** on node.js
|
||||
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
Its drop-in replacement of [node.extend](https://github.com/dreamerslab/node.extend), re-factored and re-written with CoffeeScript
|
||||
|
||||
I just need some more CS practice AND its fun :)
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Checkout the doc from [jQuery](http://api.jquery.com/jQuery.extend/)
|
||||
|
||||
|
||||
|
||||
1
node_modules/whet.extend/index.js
generated
vendored
Normal file
1
node_modules/whet.extend/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require( './lib/whet.extend' );
|
||||
104
node_modules/whet.extend/lib/whet.extend.js
generated
vendored
Normal file
104
node_modules/whet.extend/lib/whet.extend.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
|
||||
/*
|
||||
* whet.extend v0.9.7
|
||||
* Standalone port of jQuery.extend that actually works on node.js
|
||||
* https://github.com/Meettya/whet.extend
|
||||
*
|
||||
* Copyright 2012, Dmitrii Karpich
|
||||
* Released under the MIT License
|
||||
*/
|
||||
|
||||
|
||||
(function() {
|
||||
var extend, _findValue, _isClass, _isOwnProp, _isPlainObj, _isPrimitiveType, _isTypeOf, _prepareClone,
|
||||
__slice = [].slice;
|
||||
|
||||
module.exports = extend = function() {
|
||||
var args, copy, deep, name, options, target, _i, _len, _ref;
|
||||
deep = arguments[0], target = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
|
||||
if (!_isClass(deep, 'Boolean')) {
|
||||
args.unshift(target);
|
||||
_ref = [deep || {}, false], target = _ref[0], deep = _ref[1];
|
||||
}
|
||||
if (_isPrimitiveType(target)) {
|
||||
target = {};
|
||||
}
|
||||
for (_i = 0, _len = args.length; _i < _len; _i++) {
|
||||
options = args[_i];
|
||||
if (options != null) {
|
||||
for (name in options) {
|
||||
copy = options[name];
|
||||
target[name] = _findValue(deep, copy, target[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
/*
|
||||
Internal methods from now
|
||||
*/
|
||||
|
||||
|
||||
_isClass = function(obj, str) {
|
||||
return ("[object " + str + "]") === Object.prototype.toString.call(obj);
|
||||
};
|
||||
|
||||
_isOwnProp = function(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
};
|
||||
|
||||
_isTypeOf = function(obj, str) {
|
||||
return str === typeof obj;
|
||||
};
|
||||
|
||||
_isPlainObj = function(obj) {
|
||||
var key;
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
if (obj.nodeType || obj.setInterval || !_isClass(obj, 'Object')) {
|
||||
return false;
|
||||
}
|
||||
if (obj.constructor && !_isOwnProp(obj, 'constructor') && !_isOwnProp(obj.constructor.prototype, 'isPrototypeOf')) {
|
||||
return false;
|
||||
}
|
||||
for (key in obj) {
|
||||
key;
|
||||
|
||||
}
|
||||
return key === void 0 || _isOwnProp(obj, key);
|
||||
};
|
||||
|
||||
_isPrimitiveType = function(obj) {
|
||||
return !(_isTypeOf(obj, 'object') || _isTypeOf(obj, 'function'));
|
||||
};
|
||||
|
||||
_prepareClone = function(copy, src) {
|
||||
if (_isClass(copy, 'Array')) {
|
||||
if (_isClass(src, 'Array')) {
|
||||
return src;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
} else {
|
||||
if (_isPlainObj(src)) {
|
||||
return src;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_findValue = function(deep, copy, src) {
|
||||
var clone;
|
||||
if (deep && (_isClass(copy, 'Array') || _isPlainObj(copy))) {
|
||||
clone = _prepareClone(copy, src);
|
||||
return extend(deep, clone, copy);
|
||||
} else {
|
||||
return copy;
|
||||
}
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
32
node_modules/whet.extend/package.json
generated
vendored
Normal file
32
node_modules/whet.extend/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "whet.extend",
|
||||
"version": "0.9.9",
|
||||
"description": "A sharped version of port of jQuery.extend that actually works on node.js",
|
||||
"keywords": [
|
||||
"extend",
|
||||
"jQuery",
|
||||
"jQuery extend",
|
||||
"clone",
|
||||
"copy",
|
||||
"inherit"
|
||||
],
|
||||
"author": "Dmitrii Karpich <meettya@gmail.com>",
|
||||
"devDependencies": {
|
||||
"should": "0.5.1",
|
||||
"coffee-script": ">=1.3.3",
|
||||
"chai": "~1.4.2",
|
||||
"mocha": "~1.8.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "cake test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Meettya/whet.extend.git"
|
||||
},
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.6.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
68
node_modules/whet.extend/src/whet.extend.coffee
generated
vendored
Normal file
68
node_modules/whet.extend/src/whet.extend.coffee
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
###
|
||||
* whet.extend v0.9.7
|
||||
* Standalone port of jQuery.extend that actually works on node.js
|
||||
* https://github.com/Meettya/whet.extend
|
||||
*
|
||||
* Copyright 2012, Dmitrii Karpich
|
||||
* Released under the MIT License
|
||||
###
|
||||
|
||||
module.exports = extend = (deep, target, args...) ->
|
||||
|
||||
unless _isClass deep, 'Boolean'
|
||||
args.unshift target
|
||||
[ target, deep ] = [ deep or {}, false ]
|
||||
|
||||
#Handle case when target is a string or something (possible in deep copy)
|
||||
target = {} if _isPrimitiveType target
|
||||
|
||||
for options in args when options?
|
||||
for name, copy of options
|
||||
target[name] = _findValue deep, copy, target[name]
|
||||
|
||||
target
|
||||
|
||||
###
|
||||
Internal methods from now
|
||||
###
|
||||
|
||||
_isClass = (obj, str) ->
|
||||
"[object #{str}]" is Object::toString.call obj
|
||||
|
||||
_isOwnProp = (obj, prop) ->
|
||||
Object::hasOwnProperty.call obj, prop
|
||||
|
||||
_isTypeOf = (obj, str) ->
|
||||
str is typeof obj
|
||||
|
||||
_isPlainObj = (obj) ->
|
||||
|
||||
return false unless obj
|
||||
return false if obj.nodeType or obj.setInterval or not _isClass obj, 'Object'
|
||||
|
||||
# Not own constructor property must be Object
|
||||
return false if obj.constructor and
|
||||
not _isOwnProp(obj, 'constructor') and
|
||||
not _isOwnProp(obj.constructor::, 'isPrototypeOf')
|
||||
|
||||
# Own properties are enumerated firstly, so to speed up,
|
||||
# if last one is own, then all properties are own.
|
||||
key for key of obj
|
||||
key is undefined or _isOwnProp obj, key
|
||||
|
||||
_isPrimitiveType = (obj) ->
|
||||
not ( _isTypeOf(obj, 'object') or _isTypeOf(obj, 'function') )
|
||||
|
||||
_prepareClone = (copy, src) ->
|
||||
if _isClass copy, 'Array'
|
||||
if _isClass src, 'Array' then src else []
|
||||
else
|
||||
if _isPlainObj src then src else {}
|
||||
|
||||
_findValue = (deep, copy, src) ->
|
||||
# if we're merging plain objects or arrays
|
||||
if deep and ( _isClass(copy, 'Array') or _isPlainObj copy )
|
||||
clone = _prepareClone copy, src
|
||||
extend deep, clone, copy
|
||||
else
|
||||
copy
|
||||
566
node_modules/whet.extend/test/extend_test.coffee
generated
vendored
Normal file
566
node_modules/whet.extend/test/extend_test.coffee
generated
vendored
Normal file
@@ -0,0 +1,566 @@
|
||||
###
|
||||
Test suite for node AND browser in one file
|
||||
So, we are need some data from global
|
||||
Its so wrong, but its OK for test
|
||||
###
|
||||
# resolve require from [window] or by require()
|
||||
# _ = @_ ? require 'lodash'
|
||||
|
||||
lib_path = GLOBAL?.lib_path || ''
|
||||
|
||||
extend = require "#{lib_path}whet.extend"
|
||||
|
||||
describe 'whet.extend:', ->
|
||||
|
||||
str = int = arr = date = obj = deep = null
|
||||
|
||||
beforeEach ->
|
||||
str = 'me a test'
|
||||
int = 10
|
||||
arr = [ 1, 'what', new Date( 81, 8, 4 )];
|
||||
date = new Date( 81, 4, 13 );
|
||||
|
||||
obj =
|
||||
str : str
|
||||
int : int
|
||||
arr : arr
|
||||
date : date
|
||||
|
||||
deep =
|
||||
ori : obj
|
||||
layer :
|
||||
int : 10
|
||||
str : 'str'
|
||||
date : new Date( 84, 5, 12 )
|
||||
arr : [ 101, 'dude', new Date( 82, 10, 4 )]
|
||||
deep :
|
||||
str : obj.str
|
||||
int : int
|
||||
arr : obj.arr
|
||||
date : new Date( 81, 7, 4 )
|
||||
|
||||
describe 'should merge string with:', ->
|
||||
|
||||
it 'string', ->
|
||||
ori = 'what u gonna say';
|
||||
target = extend ori, str
|
||||
|
||||
ori.should.eql 'what u gonna say'
|
||||
str.should.eql 'me a test'
|
||||
target.should.eql
|
||||
'0' : 'm',
|
||||
'1' : 'e',
|
||||
'2' : ' ',
|
||||
'3' : 'a',
|
||||
'4' : ' ',
|
||||
'5' : 't',
|
||||
'6' : 'e',
|
||||
'7' : 's',
|
||||
'8' : 't'
|
||||
|
||||
it 'number', ->
|
||||
ori = 'what u gonna say'
|
||||
target = extend ori, int
|
||||
|
||||
ori.should.eql 'what u gonna say'
|
||||
int.should.eql 10
|
||||
target.should.eql {}
|
||||
|
||||
it 'array', ->
|
||||
ori = 'what u gonna say'
|
||||
target = extend ori, arr
|
||||
|
||||
ori.should.eql 'what u gonna say'
|
||||
arr.should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
target.should.eql
|
||||
'0' : 1,
|
||||
'1' : 'what',
|
||||
'2' : new Date( 81, 8, 4 )
|
||||
|
||||
it 'date', ->
|
||||
ori = 'what u gonna say'
|
||||
target = extend ori, date
|
||||
|
||||
ori.should.eql 'what u gonna say'
|
||||
date.should.eql new Date( 81, 4, 13 )
|
||||
target.should.eql new Date( 81, 4, 13 )
|
||||
|
||||
it 'object', ->
|
||||
ori = 'what u gonna say'
|
||||
target = extend ori, obj
|
||||
|
||||
ori.should.eql 'what u gonna say'
|
||||
obj.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
target.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
describe 'should merge number with:', ->
|
||||
|
||||
it 'string', ->
|
||||
ori = 20
|
||||
target = extend ori, str
|
||||
|
||||
ori.should.eql 20
|
||||
str.should.eql 'me a test'
|
||||
target.should.eql
|
||||
'0' : 'm',
|
||||
'1' : 'e',
|
||||
'2' : ' ',
|
||||
'3' : 'a',
|
||||
'4' : ' ',
|
||||
'5' : 't',
|
||||
'6' : 'e',
|
||||
'7' : 's',
|
||||
'8' : 't'
|
||||
|
||||
it 'number', ->
|
||||
ori = 20
|
||||
target = extend ori, int
|
||||
|
||||
ori.should.eql 20
|
||||
int.should.eql 10
|
||||
target.should.eql {}
|
||||
|
||||
it 'array', ->
|
||||
ori = 20
|
||||
target = extend ori, arr
|
||||
|
||||
ori.should.eql 20
|
||||
arr.should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
target.should.eql
|
||||
'0' : 1,
|
||||
'1' : 'what',
|
||||
'2' : new Date( 81, 8, 4 )
|
||||
|
||||
it 'date', ->
|
||||
ori = 20
|
||||
target = extend ori, date
|
||||
|
||||
ori.should.eql 20
|
||||
date.should.eql new Date( 81, 4, 13 )
|
||||
target.should.eql new Date( 81, 4, 13 )
|
||||
|
||||
it 'object', ->
|
||||
ori = 20
|
||||
target = extend ori, obj
|
||||
|
||||
ori.should.eql 20
|
||||
obj.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
target.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
describe 'should merge array with:', ->
|
||||
|
||||
it 'string', ->
|
||||
ori = [ 1, 2, 3, 4, 5, 6 ]
|
||||
target = extend ori, str
|
||||
|
||||
ori.should.eql [ 'm', 'e', ' ', 'a', ' ', 't', 'e', 's', 't' ]
|
||||
str.should.eql 'me a test'
|
||||
target.should.eql
|
||||
'0' : 'm',
|
||||
'1' : 'e',
|
||||
'2' : ' ',
|
||||
'3' : 'a',
|
||||
'4' : ' ',
|
||||
'5' : 't',
|
||||
'6' : 'e',
|
||||
'7' : 's',
|
||||
'8' : 't'
|
||||
|
||||
it 'number', ->
|
||||
ori = [ 1, 2, 3, 4, 5, 6 ]
|
||||
target = extend ori, int
|
||||
|
||||
ori.should.eql [ 1, 2, 3, 4, 5, 6 ]
|
||||
int.should.eql 10
|
||||
target.should.eql [ 1, 2, 3, 4, 5, 6 ]
|
||||
|
||||
it 'array', ->
|
||||
ori = [ 1, 2, 3, 4, 5, 6 ]
|
||||
target = extend ori, arr
|
||||
|
||||
ori.should.eql [ 1, 'what', new Date( 81, 8, 4 ), 4, 5, 6 ]
|
||||
arr.should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
target.should.eql [ 1, 'what', new Date( 81, 8, 4 ), 4, 5, 6 ]
|
||||
|
||||
it 'date', ->
|
||||
ori = [ 1, 2, 3, 4, 5, 6 ]
|
||||
target = extend ori, date
|
||||
|
||||
ori.should.eql [ 1, 2, 3, 4, 5, 6 ]
|
||||
date.should.eql new Date( 81, 4, 13 )
|
||||
target.should.eql [ 1, 2, 3, 4, 5, 6 ]
|
||||
|
||||
it 'object', ->
|
||||
ori = [ 1, 2, 3, 4, 5, 6 ]
|
||||
target = extend ori, obj
|
||||
|
||||
ori.length.should.equal 6
|
||||
ori[ 'str' ].should.eql 'me a test'
|
||||
ori[ 'int' ].should.eql 10
|
||||
ori[ 'arr' ].should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
ori[ 'date' ].should.eql new Date( 81, 4, 13 )
|
||||
obj.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
target.length.should.equal 6
|
||||
target[ 'str' ].should.eql 'me a test'
|
||||
target[ 'int' ].should.eql 10
|
||||
target[ 'arr' ].should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
target[ 'date' ].should.eql new Date( 81, 4, 13 )
|
||||
|
||||
describe 'should merge date with:', ->
|
||||
|
||||
it 'string', ->
|
||||
ori = new Date( 81, 9, 20 )
|
||||
target = extend ori, str
|
||||
|
||||
ori.should.eql
|
||||
'0' : 'm',
|
||||
'1' : 'e',
|
||||
'2' : ' ',
|
||||
'3' : 'a',
|
||||
'4' : ' ',
|
||||
'5' : 't',
|
||||
'6' : 'e',
|
||||
'7' : 's',
|
||||
'8' : 't'
|
||||
|
||||
str.should.eql 'me a test'
|
||||
target.should.eql
|
||||
'0' : 'm',
|
||||
'1' : 'e',
|
||||
'2' : ' ',
|
||||
'3' : 'a',
|
||||
'4' : ' ',
|
||||
'5' : 't',
|
||||
'6' : 'e',
|
||||
'7' : 's',
|
||||
'8' : 't'
|
||||
|
||||
it 'number', ->
|
||||
ori = new Date( 81, 9, 20 )
|
||||
target = extend ori, int
|
||||
|
||||
ori.should.eql {}
|
||||
int.should.eql 10
|
||||
target.should.eql {}
|
||||
|
||||
it 'array', ->
|
||||
ori = new Date( 81, 9, 20 )
|
||||
target = extend ori, arr
|
||||
|
||||
ori.should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
int.should.eql 10
|
||||
target.should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
|
||||
it 'date', ->
|
||||
ori = new Date( 81, 9, 20 )
|
||||
target = extend ori, date
|
||||
|
||||
ori.should.eql {}
|
||||
date.should.eql new Date( 81, 4, 13 )
|
||||
target.should.eql {}
|
||||
|
||||
it 'object', ->
|
||||
ori = new Date( 81, 9, 20 )
|
||||
target = extend ori, obj
|
||||
|
||||
ori.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
obj.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
target.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
describe 'should merge object with:', ->
|
||||
|
||||
it 'string', ->
|
||||
ori =
|
||||
str : 'no shit'
|
||||
int : 76
|
||||
arr : [ 1, 2, 3, 4 ]
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
target = extend ori, str
|
||||
|
||||
ori.should.eql
|
||||
'0' : 'm',
|
||||
'1' : 'e',
|
||||
'2' : ' ',
|
||||
'3' : 'a',
|
||||
'4' : ' ',
|
||||
'5' : 't',
|
||||
'6' : 'e',
|
||||
'7' : 's',
|
||||
'8' : 't',
|
||||
str: 'no shit',
|
||||
int: 76,
|
||||
arr: [ 1, 2, 3, 4 ],
|
||||
date: new Date( 81, 7, 26 )
|
||||
|
||||
str.should.eql 'me a test'
|
||||
target.should.eql
|
||||
'0' : 'm',
|
||||
'1' : 'e',
|
||||
'2' : ' ',
|
||||
'3' : 'a',
|
||||
'4' : ' ',
|
||||
'5' : 't',
|
||||
'6' : 'e',
|
||||
'7' : 's',
|
||||
'8' : 't',
|
||||
str: 'no shit',
|
||||
int: 76,
|
||||
arr: [ 1, 2, 3, 4 ],
|
||||
date: new Date( 81, 7, 26 )
|
||||
|
||||
it 'number', ->
|
||||
ori =
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
target = extend ori, int
|
||||
|
||||
ori.should.eql
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
int.should.eql 10
|
||||
target.should.eql
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
it 'array', ->
|
||||
ori =
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
target = extend ori, arr
|
||||
|
||||
ori.should.eql
|
||||
'0' : 1,
|
||||
'1' : 'what',
|
||||
'2' : new Date( 81, 8, 4 ),
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
arr.should.eql [ 1, 'what', new Date( 81, 8, 4 )]
|
||||
target.should.eql
|
||||
'0' : 1,
|
||||
'1' : 'what',
|
||||
'2' : new Date( 81, 8, 4 ),
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
it 'date', ->
|
||||
ori =
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
target = extend ori, date
|
||||
|
||||
ori.should.eql
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
date.should.eql new Date( 81, 4, 13 )
|
||||
target.should.eql
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
it 'object', ->
|
||||
ori =
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
target = extend ori, obj
|
||||
|
||||
ori.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
obj.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
target.should.eql
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
|
||||
describe 'should make deep clone: ', ->
|
||||
|
||||
it 'object with object', ->
|
||||
ori =
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 )
|
||||
|
||||
target = extend true, ori, deep
|
||||
|
||||
ori.should.eql
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 ),
|
||||
ori :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
layer :
|
||||
int : 10,
|
||||
str : 'str',
|
||||
date : new Date( 84, 5, 12 ),
|
||||
arr : [ 101, 'dude', new Date( 82, 10, 4 )],
|
||||
deep :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 7, 4 )
|
||||
|
||||
deep.should.eql
|
||||
ori :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
layer :
|
||||
int : 10,
|
||||
str : 'str',
|
||||
date : new Date( 84, 5, 12 ),
|
||||
arr : [ 101, 'dude', new Date( 82, 10, 4 )],
|
||||
deep :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 7, 4 )
|
||||
|
||||
target.should.eql
|
||||
str : 'no shit',
|
||||
int : 76,
|
||||
arr : [ 1, 2, 3, 4 ],
|
||||
date : new Date( 81, 7, 26 ),
|
||||
ori :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
layer :
|
||||
int : 10,
|
||||
str : 'str',
|
||||
date : new Date( 84, 5, 12 ),
|
||||
arr : [ 101, 'dude', new Date( 82, 10, 4 )],
|
||||
deep :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 7, 4 )
|
||||
|
||||
target.layer.deep = 339;
|
||||
deep.should.eql
|
||||
ori :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 4, 13 )
|
||||
layer :
|
||||
int : 10,
|
||||
str : 'str',
|
||||
date : new Date( 84, 5, 12 ),
|
||||
arr : [ 101, 'dude', new Date( 82, 10, 4 )],
|
||||
deep :
|
||||
str : 'me a test',
|
||||
int : 10,
|
||||
arr : [ 1, 'what', new Date( 81, 8, 4 )],
|
||||
date : new Date( 81, 7, 4 )
|
||||
|
||||
###
|
||||
NEVER USE EXTEND WITH THE ABOVE SITUATION
|
||||
###
|
||||
|
||||
describe 'must pass additional test: ', ->
|
||||
|
||||
it 'should merge objects with \'null\' and \'undefined\'', ->
|
||||
ori =
|
||||
a : 10
|
||||
b : null
|
||||
c : 'test data'
|
||||
d : undefined
|
||||
|
||||
additional =
|
||||
x : 'googol'
|
||||
y : 8939843
|
||||
z : null
|
||||
az : undefined
|
||||
|
||||
target = extend ori, additional
|
||||
target.should.to.be.eql
|
||||
a : 10
|
||||
b : null
|
||||
c : 'test data'
|
||||
d : undefined
|
||||
x : 'googol'
|
||||
y : 8939843
|
||||
z : null
|
||||
az : undefined
|
||||
|
||||
|
||||
7
node_modules/whet.extend/test/mocha.opts
generated
vendored
Normal file
7
node_modules/whet.extend/test/mocha.opts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
--compilers coffee:coffee-script
|
||||
--require coffee-script
|
||||
--require ./test/test_helper.coffee
|
||||
--reporter spec
|
||||
--colors
|
||||
--growl
|
||||
--ui bdd
|
||||
11
node_modules/whet.extend/test/test_helper.coffee
generated
vendored
Normal file
11
node_modules/whet.extend/test/test_helper.coffee
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
###
|
||||
global helper for chai.should()
|
||||
###
|
||||
chai = require 'chai'
|
||||
GLOBAL.should = chai.should()
|
||||
GLOBAL.expect = chai.expect # to work with 'undefined' - should cant it
|
||||
|
||||
###
|
||||
addon for lib_path
|
||||
###
|
||||
GLOBAL.lib_path = '../lib/'
|
||||
Reference in New Issue
Block a user