larry babby and threejs for glsl

This commit is contained in:
Sam
2024-06-24 21:24:00 +12:00
parent 87d5dc634d
commit 907ebae4c0
6474 changed files with 1279596 additions and 8 deletions

View File

@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.8"
- "0.10"

View File

@@ -0,0 +1,18 @@
This software is released under the MIT license:
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.

View File

@@ -0,0 +1,9 @@
var copy = require('../');
var xs = [ 3, 4, 5, { f: 6, g: 7 } ];
var dup = copy(xs);
dup.unshift(1, 2);
dup[5].g += 100;
console.log('original: ', xs);
console.log('copy: ', dup);

View File

@@ -0,0 +1,9 @@
var copy = require('../');
var obj = { a: 3, b: 4, c: [5,6] };
var dup = copy(obj);
dup.b *= 111;
dup.c.push(7);
console.log('original: ', obj);
console.log('copy: ', dup);

View File

@@ -0,0 +1,35 @@
module.exports = function (obj) {
if (!obj || typeof obj !== 'object') return obj;
var copy;
if (isArray(obj)) {
var len = obj.length;
copy = Array(len);
for (var i = 0; i < len; i++) {
copy[i] = obj[i];
}
}
else {
var keys = objectKeys(obj);
copy = {};
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
copy[key] = obj[key];
}
}
return copy;
};
var objectKeys = Object.keys || function (obj) {
var keys = [];
for (var key in obj) {
if ({}.hasOwnProperty.call(obj, key)) keys.push(key);
}
return keys;
};
var isArray = Array.isArray || function (xs) {
return {}.toString.call(xs) === '[object Array]';
};

View File

@@ -0,0 +1,44 @@
{
"name": "shallow-copy",
"version": "0.0.1",
"description": "make a shallow copy of an object or array",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"tape": "~1.0.4"
},
"scripts": {
"test": "tape test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/8..latest",
"ff/latest",
"chrome/latest",
"safari/latest",
"opera/latest",
"android/latest",
"iphone/latest",
"ipad/latest"
]
},
"repository": {
"type": "git",
"url": "git://github.com/substack/shallow-copy.git"
},
"homepage": "https://github.com/substack/shallow-copy",
"keywords": [
"shallow",
"copy",
"data",
"object",
"array"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT"
}

View File

@@ -0,0 +1,64 @@
# shallow-copy
make a shallow copy of an object or array
[![testling badge](https://ci.testling.com/substack/shallow-copy.png)](https://ci.testling.com/substack/shallow-copy)
[![build status](https://secure.travis-ci.org/substack/shallow-copy.png)](http://travis-ci.org/substack/shallow-copy)
# example
you can copy objects shallowly:
``` js
var copy = require('shallow-copy');
var obj = { a: 3, b: 4, c: [5,6] };
var dup = copy(obj);
dup.b *= 111;
dup.c.push(7);
console.log('original: ', obj);
console.log('copy: ', dup);
```
and you can copy arrays shallowly:
``` js
var copy = require('shallow-copy');
var xs = [ 3, 4, 5, { f: 6, g: 7 } ];
var dup = copy(xs);
dup.unshift(1, 2);
dup[5].g += 100;
console.log('original: ', xs);
console.log('copy: ', dup);
```
# methods
``` js
var copy = require('shallow-copy')
```
## copy(obj)
Return a copy of the enumerable properties of the object `obj` without making
copies of nested objects inside of `obj`.
If `obj` is an array, the result will be an array.
If `obj` is an object, the result will be an object.
If `obj` is not an object, its value is returned.
# install
With [npm](https://npmjs.org) do:
```
npm install shallow-copy
```
# license
MIT

View File

@@ -0,0 +1,14 @@
var copy = require('../');
var test = require('tape');
test('array', function (t) {
t.plan(2);
var xs = [ 3, 4, 5, { f: 6, g: 7 } ];
var dup = copy(xs);
dup.unshift(1, 2);
dup[5].g += 100;
t.deepEqual(xs, [ 3, 4, 5, { f: 6, g: 107 } ]);
t.deepEqual(dup, [ 1, 2, 3, 4, 5, { f: 6, g: 107 } ]);
});

View File

@@ -0,0 +1,14 @@
var copy = require('../');
var test = require('tape');
test('object', function (t) {
t.plan(2);
var obj = { a: 3, b: 4, c: [5,6] };
var dup = copy(obj);
dup.b *= 111;
dup.c.push(7);
t.deepEqual(obj, { a: 3, b: 4, c: [ 5, 6, 7 ] });
t.deepEqual(dup, { a: 3, b: 444, c: [ 5, 6, 7 ] });
});