mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
lodash: Rename to lodash and update support files. [jddalton]
This commit is contained in:
103
README.md
103
README.md
@@ -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/)
|
||||
[](https://twitter.com/jdalton "Follow @jdalton on Twitter")
|
||||
|
||||
2131
doc/README.md
Normal file
2131
doc/README.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
50
package.json
50
package.json
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
7
test/run-test.sh
Executable 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
75
test/test.js
Normal 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));
|
||||
@@ -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>
|
||||
|
||||
1059
underscore.js
1059
underscore.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user