lodash: Rename to lodash and update support files. [jddalton]

This commit is contained in:
John-David Dalton
2012-04-17 20:05:59 -04:00
parent c499d81633
commit 8e65243edf
10 changed files with 4948 additions and 1097 deletions

103
README.md
View File

@@ -1,19 +1,88 @@
__
/\ \ __
__ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____
/\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\
\ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\
\ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/
\/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/
\ \____/
\/___/
Underscore.js is a utility-belt library for JavaScript that provides
support for the usual functional suspects (each, map, reduce, filter...)
without extending any core JavaScript objects.
# Lo-Dash <sup>v0.1.0</sup>
For Docs, License, Tests, and pre-packed downloads, see:
http://documentcloud.github.com/underscore/
TBD
Many thanks to our contributors:
https://github.com/documentcloud/underscore/contributors
## BestieJS
Lo-Dash is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation.
## Documentation
The documentation for Lo-Dash can be viewed here: [lodash/doc](https://github.com/bestiejs/lodash/doc/README.md)
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap).
## Installation and usage
In a browser:
~~~ html
<script src="lodash.js"></script>
~~~
Via [npm](http://npmjs.org/):
~~~ bash
npm install lodash
~~~
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
~~~ js
var _ = require('lodash');
~~~
In [Narwhal](http://narwhaljs.org/) and [RingoJS v0.7.0-](http://ringojs.org/):
~~~ js
var _ = require('lodash')._;
~~~
In [Rhino](http://www.mozilla.org/rhino/):
~~~ js
load('lodash.js');
~~~
In an AMD loader like [RequireJS](http://requirejs.org/):
~~~ js
require({
'paths': {
'lodash': 'path/to/lodash'
}
},
['lodash'], function(_) {
console.log(_.VERSION);
});
~~~
Usage example:
~~~ js
// TBD
~~~
## Cloning this repo
To clone this repository including all submodules, using Git 1.6.5 or later:
~~~ bash
git clone --recursive https://github.com/bestiejs/lodash.git
cd lodash.js
~~~
For older Git versions, just use:
~~~ bash
git clone https://github.com/bestiejs/lodash.git
cd lodash
git submodule update --init
~~~
Feel free to fork if you see possible improvements!
## Author
* [John-David Dalton](http://allyoucanleet.com/)
[![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter")

2131
doc/README.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
<?php
// cleanup requested filepath
$file = isset($_GET['f']) ? $_GET['f'] : 'lowdash';
$file = isset($_GET['f']) ? $_GET['f'] : 'lodash';
$file = preg_replace('#(\.*[\/])+#', '', $file);
$file .= preg_match('/\.[a-z]+$/', $file) ? '' : '.js';
@@ -21,8 +21,8 @@
// generate Markdown
$markdown = docdown(array(
'path' => '../' . $file,
'title' => 'LowDash.js <sup>v0.1.0</sup>',
'url' => 'https://github.com/bestiejs/lowdash/blob/master/lowdash.js'
'title' => 'Lo-Dash <sup>v0.1.0</sup>',
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
));
// save to a .md file

2596
lodash.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,42 @@
{
"name" : "underscore",
"description" : "JavaScript's functional programming helper library.",
"homepage" : "http://documentcloud.github.com/underscore/",
"keywords" : ["util", "functional", "server", "client", "browser"],
"author" : "Jeremy Ashkenas <jeremy@documentcloud.org>",
"repository" : {"type": "git", "url": "git://github.com/documentcloud/underscore.git"},
"main" : "underscore.js",
"version" : "1.3.3"
}
"name": "lodash",
"version": "0.1.0",
"description": "TBD",
"homepage": "https://github.com/bestiejs/lodash",
"main": "lodash",
"keywords": [
"browser",
"client",
"functional",
"performance",
"server",
"speed",
"util"
],
"licenses": [
{
"type": "MIT",
"url": "http://mths.be/mit"
}
],
"author": {
"name": "John-David Dalton",
"email": "john@fusejs.com",
"web": "http://allyoucanleet.com/"
},
"bugs": {
"url": "https://github.com/bestiejs/lodash/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/bestiejs/lodash.git"
},
"engines": [
"node",
"rhino"
],
"directories": {
"doc": "./doc",
"test": "./test"
}
}

View File

@@ -2,18 +2,18 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>LowDash.js Test Suite</title>
<title>Lo-Dash Test Suite</title>
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
</head>
<body>
<h1 id="qunit-header">LowDash.js Test Suite</h1>
<h1 id="qunit-header">Lo-Dash Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<script src="../vendor/qunit/qunit/qunit.js"></script>
<script>var lowDash2, lowDash = 1;</script>
<script src="../lowdash.js"></script>
<script>var _2, _ = 1;</script>
<script src="../lodash.js"></script>
<script src="../vendor/requirejs/require.js"></script>
<script>
if (/[?&]norequire=true(?:&|$)/.test(location.search)) {
@@ -21,16 +21,16 @@
document.write('<script src="test.js"><\/script>');
}
else {
define.amd.lowDash = true;
define.amd.lodash = true;
require({
'baseUrl': '../vendor/requirejs/',
'urlArgs': 't=' + (+new Date),
'paths': {
'lowdash': '../../lowdash'
'lodash': '../../lodash'
}
},
['lowdash'], function(lowDash) {
lowDash2 = lowDash.noConflict();
['lodash'], function(_) {
_2 = _.noConflict();
require(['test.js']);
});
}

7
test/run-test.sh Executable file
View File

@@ -0,0 +1,7 @@
cd "$(dirname "$0")"
for cmd in rhino ringo narwhal node; do
echo "Testing in $cmd..."
$cmd test.js
done
echo "Testing in a browser..."
open index.html

75
test/test.js Normal file
View File

@@ -0,0 +1,75 @@
(function(window, undefined) {
/** Use a single load function */
var load = typeof require == 'function' ? require : window.load;
/** The unit testing framework */
var QUnit =
window.QUnit || (
window.setTimeout || (window.addEventListener = window.setTimeout = / /),
window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit,
load('../vendor/qunit-clib/qunit-clib.js'),
(window.addEventListener || 0).test && delete window.addEventListener,
window.QUnit
);
/** The `lodash` function to test */
var _ =
window._ || (
_ = load('../lodash.js') || window._,
_._ || _
);
/** Shortcut used to convert array-like objects to arrays */
var slice = [].slice;
/** Used to resolve a value's internal [[Class]] */
var toString = {}.toString;
/*--------------------------------------------------------------------------*/
/**
* Skips a given number of tests with a passing result.
*
* @private
* @param {Number} count The number of tests to skip.
*/
function skipTest(count) {
while (count--) {
ok(true, 'test skipped');
}
}
/*--------------------------------------------------------------------------*/
// must explicitly use `QUnit.module` instead of `module()`
// in case we are in a CLI environment
QUnit.module('lodash');
(function() {
test('supports loading lodash.js as a module', function() {
if (window.document && window.require) {
equal((_2 || {}).VERSION, _.VERSION);
} else {
skipTest(1)
}
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash constructor');
(function() {
test('creates a new instance when called without the `new` operator', function() {
ok(_() instanceof _);
});
}());
/*--------------------------------------------------------------------------*/
// explicitly call `QUnit.start()` in a CLI environment
if (!window.document) {
QUnit.start();
}
}(typeof global == 'object' && global || this));

View File

@@ -6,7 +6,7 @@
<script type="text/javascript" src="vendor/jquery.js"></script>
<script type="text/javascript" src="vendor/qunit.js"></script>
<script type="text/javascript" src="vendor/jslitmus.js"></script>
<script type="text/javascript" src="../../underscore.js"></script>
<script type="text/javascript" src="../../lodash.js"></script>
<script type="text/javascript" src="collections.js"></script>
<script type="text/javascript" src="arrays.js"></script>
<script type="text/javascript" src="functions.js"></script>

File diff suppressed because it is too large Load Diff