Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "spotlight", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An object crawler/property search library that works on nearly all JavaScript platforms.", | ||
@@ -11,3 +11,3 @@ "license": "MIT", | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Benjamin Tan <demoneaux@gmail.com> (http://d10.github.io/)" | ||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)" | ||
], | ||
@@ -17,17 +17,13 @@ "repository": "bestiejs/spotlight.js", | ||
"dependencies": { | ||
"lodash": "~2.4.1" | ||
"lodash": "^3.10.1" | ||
}, | ||
"devDependencies": { | ||
"qunit-extras": "~1.3.0", | ||
"qunitjs": "~1.11.0", | ||
"requirejs": "~2.1.15" | ||
"docdown": "~0.3.0", | ||
"qunit-extras": "^1.4.5", | ||
"qunitjs": "~1.20.0", | ||
"requirejs": "^2.1.22" | ||
}, | ||
"engines": [ | ||
"node", | ||
"rhino" | ||
], | ||
"files": [ | ||
"LICENSE.txt", | ||
"spotlight.js" | ||
] | ||
} |
@@ -1,2 +0,2 @@ | ||
# Spotlight.js v1.1.0 | ||
# Spotlight.js v1.2.0 | ||
@@ -7,11 +7,10 @@ An object crawler/property search library that works on nearly all JavaScript platforms. | ||
* [doc/README.md](https://github.com/bestiejs/spotlight.js/blob/master/doc/README.md#readme) | ||
* [wiki/Roadmap](https://github.com/bestiejs/spotlight.js/wiki/Roadmap) | ||
* [API Documentation](https://github.com/bestiejs/spotlight.js/blob/1.2.0/doc/README.md) | ||
* [Roadmap](https://github.com/bestiejs/spotlight.js/wiki/Roadmap) | ||
## Installation | ||
Spotlight.js’ only hard dependency is [Lo-Dash](https://lodash.com/). | ||
Spotlight.js’ only hard dependency is [lodash](https://lodash.com/). | ||
In a browser: | ||
```html | ||
@@ -23,3 +22,2 @@ <script src="lodash.js"></script> | ||
In an AMD loader: | ||
```js | ||
@@ -36,3 +34,2 @@ require({ | ||
Using npm: | ||
```bash | ||
@@ -43,3 +40,2 @@ $ npm i --save spotlight | ||
In Node.js: | ||
```js | ||
@@ -50,3 +46,2 @@ var spotlight = require('spotlight'); | ||
Usage example: | ||
```js | ||
@@ -86,3 +81,3 @@ // find all "length" properties | ||
Tested in Chrome 38-39, Firefox 32-33, IE 6-11, Opera 25-26, Safari 5-8, Node.js 0.8.26~0.10.33, PhantomJS 1.9.7, RingoJS 0.9, & Rhino 1.7RC5. | ||
Tested in Chrome 46-47, Firefox 42-43, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10.x, 0.12.x, 4.x, & 5.x, & PhantomJS 1.9.8. | ||
@@ -92,13 +87,1 @@ ## BestieJS | ||
Spotlight.js is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, & plenty of documentation. | ||
## Author | ||
| [](http://twitter.com/jdalton "Follow @jdalton on Twitter") | | ||
|---| | ||
| [John-David Dalton](http://allyoucanleet.com/) | | ||
## Contributors | ||
| [](https://twitter.com/demoneaux "Follow @demoneaux on Twitter") | | ||
|---| | ||
| [Benjamin Tan](http://d10.github.io/) | |
/*! | ||
* Spotlight.js v1.1.0 <https://github.com/bestiejs/spotlight.js/> | ||
* Copyright 2011-2014 John-David Dalton <http://allyoucanleet.com/> | ||
* Spotlight.js v1.2.0 <https://github.com/bestiejs/spotlight.js/> | ||
* Copyright 2011-2016 John-David Dalton <http://allyoucanleet.com/> | ||
* Based on Waldo <https://github.com/angus-c/waldo/>, | ||
* Copyright 2011-2014 Angus Croll <http://javascriptweblog.wordpress.com/> | ||
* Copyright 2011-2016 Angus Croll <http://javascriptweblog.wordpress.com/> | ||
* Both available under MIT license <http://mths.be/mit> | ||
@@ -77,3 +77,3 @@ */ | ||
function runInContext(context) { | ||
// exit early if unable to acquire Lo-Dash | ||
// Exit early if unable to acquire lodash. | ||
var _ = context && context._ || !freeDefine && req('lodash') || root._; | ||
@@ -131,3 +131,3 @@ if (!_) { | ||
? object[key] === value | ||
// special case for `NaN` | ||
// Special case for `NaN`. | ||
: object[key] !== object[key]; | ||
@@ -142,3 +142,3 @@ } | ||
'descriptors' : (function() { | ||
// IE 8 only accepts DOM elements | ||
// IE 8 only accepts DOM elements. | ||
try { | ||
@@ -168,10 +168,10 @@ var o = {}; | ||
// set `defaultRoots` for CLI environments like Narwhal, Node.js, or RingoJS | ||
// Set `defaultRoots` for CLI environments Node.js or RingoJS. | ||
if (freeGlobal) { | ||
defaultRoots = [{ 'object': freeGlobal, 'path': 'global' }]; | ||
// for the Narwhal REPL | ||
// For the Narwhal REPL. | ||
if (originalContext != freeGlobal) { | ||
defaultRoots.unshift({ 'object': originalContext, 'path': '<module scope>' }); | ||
} | ||
// avoid explicitly crawling `exports` if it's crawled indirectly | ||
// Avoid explicitly crawling `exports` if it's crawled indirectly. | ||
if (!(freeGlobal.exports == freeExports || context.exports == freeExports)) { | ||
@@ -181,3 +181,3 @@ defaultRoots.unshift({ 'object': freeExports, 'path': 'exports' }); | ||
} | ||
// for Rhino | ||
// For Rhino. | ||
else if (isHostType(context, 'environment') && isHostType(context, 'java')) { | ||
@@ -200,4 +200,4 @@ defaultRoots[0].path = '<global object>'; | ||
try { | ||
// avoid problems with iterators | ||
// https://github.com/ringo/ringojs/issues/157 | ||
// Avoid problems with iterators. | ||
// See https://github.com/ringo/ringojs/issues/157 for more details. | ||
if (support.iterators && _.isFunction(object.__iterator__)) { | ||
@@ -221,4 +221,4 @@ var iterator = support.descriptors | ||
} | ||
// some objects like Firefox 3's `XPCSafeJSObjectWrapper.prototype` may | ||
// throw errors when attempting to iterate over them | ||
// Some objects like Firefox 3's `XPCSafeJSObjectWrapper.prototype` may | ||
// throw errors when attempting to iterate over them. | ||
else { | ||
@@ -234,3 +234,3 @@ for (var key in object) { | ||
for (key in object) { | ||
// iterators will assign an array to `key` | ||
// Iterators will assign an array to `key`. | ||
callback(key[1], key[0]); | ||
@@ -245,4 +245,4 @@ } | ||
while (++index < length) { | ||
// some properties like Firefox's `console.constructor` or IE's | ||
// `element.offsetParent` may throw errors when accessed | ||
// Some properties like Firefox's `console.constructor` or IE's | ||
// `element.offsetParent` may throw errors when accessed. | ||
try { | ||
@@ -296,4 +296,4 @@ key = props[index]; | ||
else if (_.isFunction(value) && isHostType(value, 'prototype')) { | ||
// a function is assumed of kind "Constructor" if it has its own | ||
// enumerable prototype properties or doesn't have a `[[Class]]` of Object | ||
// A function is assumed of kind "Constructor" if it has its own | ||
// enumerable prototype properties or doesn't have a `[[Class]]` of Object. | ||
try { | ||
@@ -389,5 +389,5 @@ if (getClass(value.prototype) == 'Object') { | ||
// resolve object roots | ||
// Resolve object roots. | ||
if (object) { | ||
// resolve `undefined` path | ||
// Resolve `undefined` path. | ||
if (path == null) { | ||
@@ -398,3 +398,3 @@ path = _.result(_.find(roots, { 'object': object }), 'path') || '<object>'; | ||
} | ||
// crawl all root objects | ||
// Crawl all root objects. | ||
while ((data = roots.pop())) { | ||
@@ -407,4 +407,5 @@ index = 0; | ||
// a non-recursive solution to avoid call stack limits | ||
// http://www.jslab.dk/articles/non.recursive.preorder.traversal.part4 | ||
// A non-recursive solution to avoid call stack limits. | ||
// See http://www.jslab.dk/articles/non.recursive.preorder.traversal.part4 | ||
// for more details. | ||
do { | ||
@@ -416,15 +417,15 @@ object = data.object; | ||
forOwn(object, function(value, key) { | ||
// (IE may throw errors coercing properties like `window.external` or `window.navigator`) | ||
// IE may throw errors coercing properties like `window.external` or `window.navigator`. | ||
try { | ||
// inspect objects | ||
// Inspect objects. | ||
if (_.isPlainObject(value)) { | ||
// clone current pool per prop on the current `object` to avoid | ||
// sibling properties from polluting each others object pools | ||
// Clone current pool per prop on the current `object` to avoid | ||
// sibling properties from polluting each others object pools. | ||
pool = data.pool.slice(); | ||
// check if already pooled (prevents infinite loops when handling circular references) | ||
// Check if already pooled (prevents infinite loops when handling circular references). | ||
pooled = _.find(pool, function(data) { | ||
return value == data.object; | ||
}); | ||
// add to the "call" queue | ||
// Add to the "call" queue. | ||
if (!pooled) { | ||
@@ -435,3 +436,3 @@ pool.push({ 'object': value, 'path': path + separator + key, 'pool': pool }); | ||
} | ||
// if filter passed, log it | ||
// If filter passed, log it. | ||
if ( | ||
@@ -472,3 +473,3 @@ isCustom | ||
// lazy define | ||
// Lazy define `log`. | ||
log = function(type, message, value) { | ||
@@ -486,5 +487,5 @@ var argCount = defaultCount, | ||
} | ||
// avoid logging if in debug mode and running from the CLI | ||
// Avoid logging if in debug mode and running from the CLI. | ||
if (!isDebug || (document && !phantom)) { | ||
// because `console.log` is a host method we don't assume `.apply()` exists | ||
// Because `console.log` is a host method we don't assume `apply` exists. | ||
if (argCount < 2) { | ||
@@ -502,11 +503,11 @@ if (JSON) { | ||
// for Narwhal, Rhino, or RingoJS | ||
// For Rhino or RingoJS. | ||
if (!console && !document && _.isFunction(context.print)) { | ||
console = { 'log': print }; | ||
} | ||
// use noop for no log support | ||
// Use noop for no log support. | ||
if (!isHostType(console, 'log')) { | ||
log = function() {}; | ||
} | ||
// avoid Safari 2 crash bug when passing more than 1 argument | ||
// Avoid Safari 2 crash bug when passing more than 1 argument. | ||
else if (console.log.length == 1) { | ||
@@ -642,3 +643,3 @@ defaultCount = 1; | ||
*/ | ||
spotlight.version = '1.1.0'; | ||
spotlight.version = '1.2.0'; | ||
@@ -657,8 +658,8 @@ spotlight.byKind = byKind; | ||
// export spotlight | ||
// Export spotlight. | ||
var spotlight = runInContext(); | ||
// some AMD build optimizers like r.js check for condition patterns like the following: | ||
// Some AMD build optimizers like r.js check for condition patterns like the following: | ||
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { | ||
// define as an anonymous module so, through path mapping, it can be aliased | ||
// Define as an anonymous module so, through path mapping, it can be aliased. | ||
define(['lodash'], function(_) { | ||
@@ -670,5 +671,5 @@ return runInContext({ | ||
} | ||
// check for `exports` after `define` in case a build optimizer adds an `exports` object | ||
// Check for `exports` after `define` in case a build optimizer adds an `exports` object. | ||
else if (freeExports && freeModule) { | ||
// in Narwhal, Node.js, Rhino -require, or RingoJS | ||
// In Node.js, RhingoJS, or Rhino with CommonJS support. | ||
freeExports.byKind = spotlight.byKind; | ||
@@ -683,5 +684,5 @@ freeExports.byName = spotlight.byName; | ||
else { | ||
// in a browser or Rhino | ||
// In a browser or Rhino. | ||
root.spotlight = spotlight; | ||
} | ||
}.call(this)); |
602
26471
4
81
+ Addedlodash@3.10.1(transitive)
- Removedlodash@2.4.2(transitive)
Updatedlodash@^3.10.1