GithubHelp home page GithubHelp logo

imclab / spotlight.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bestiejs/spotlight.js

0.0 2.0 0.0 1 MB

An object crawler and search utility.

Home Page: http://javascriptweblog.wordpress.com

License: Other

spotlight.js's Introduction

Spotlight.js v1.0.0-pre

An object crawler/property search library that works on nearly all JavaScript platforms1.

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, and plenty of documentation.

Documentation

The documentation for Spotlight.js can be viewed here: /doc/README.md

For a list of upcoming features, check out our roadmap.

Installation and usage

Spotlight.js’ only hard dependency is Lo-Dash.

In a browser:

<script src="lodash.js"></script>
<script src="spotlight.js"></script>

Via npm:

npm install spotlight

In Node.js and RingoJS:

var spotlight = require('spotlight');

In Rhino:

load('spotlight.js');

In an AMD loader like RequireJS:

require({
  'paths': {
    'spotlight': 'path/to/spotlight',
    'lodash': 'path/to/lodash'
  }
},
['spotlight'], function(spotlight) {
  spotlight.byKind('constructor');
});

Usage example:

// find all "length" properties
spotlight.byName('length');

// or find all "map" properties on jQuery
spotlight.byName('map', { 'object': jQuery, 'path': '$' });

// or all properties with `jQuery` objects
spotlight.byKind(jQuery);

// or all properties with `RegExp` values
spotlight.byKind('RegExp');

// or all properties with `null` values
spotlight.byKind('null');

// or all properties with `undefined` values
spotlight.byKind('undefined');

// or all constructors
spotlight.byKind('constructor');

// or all properties with the value `0`
spotlight.byValue(0);

// or all properties containing "oo" in their name
spotlight.custom(function(value, key) { return key.indexOf('oo') > -1; });

// or all properties with falsey values
spotlight.custom(function(value) { return !value; });

Footnotes

  1. Spotlight.js has been tested in at least Chrome 532, Firefox 227, IE 6-11, Opera 9.2519, Safari 3-7, Node.js 0.6.210.10.26, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, and Rhino 1.7RC5. ↩

Author

twitter/jdalton
John-David Dalton

spotlight.js's People

Contributors

jdalton avatar angus-c avatar bnjmnt4n avatar mathiasbynens avatar

Watchers

JT5D avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.