WIP - add extractor, generate snippet_data
This commit is contained in:
1
node_modules/type-of/.npmignore
generated
vendored
Normal file
1
node_modules/type-of/.npmignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
||||
4
node_modules/type-of/.travis.yml
generated
vendored
Normal file
4
node_modules/type-of/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
19
node_modules/type-of/LICENSE
generated
vendored
Normal file
19
node_modules/type-of/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2013 Forbes Lindesay
|
||||
|
||||
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.
|
||||
41
node_modules/type-of/Readme.md
generated
vendored
Normal file
41
node_modules/type-of/Readme.md
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# type-of
|
||||
|
||||
Type assertions aka less-broken `typeof`.
|
||||
|
||||
|
||||
[](https://travis-ci.org/ForbesLindesay/type-of)
|
||||
[](https://gemnasium.com/ForbesLindesay/type-of)
|
||||
[](http://badge.fury.io/js/type-of)
|
||||
|
||||
[](https://ci.testling.com/ForbesLindesay/type-of)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var type = require('type-of')
|
||||
|
||||
var obj = new Date
|
||||
if (type(obj) == 'date') ...
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
type(new Date) == 'date'
|
||||
type({}) == 'object'
|
||||
type(null) == 'null'
|
||||
type(undefined) == 'undefined'
|
||||
type("hey") == 'string'
|
||||
type(true) == 'boolean'
|
||||
type(false) == 'boolean'
|
||||
type(12) == 'number'
|
||||
type(type) == 'function'
|
||||
type(/asdf/) == 'regexp'
|
||||
type((function(){ return arguments })()) == 'arguments'
|
||||
type([]) == 'array'
|
||||
type(document.createElement('div')) == 'element'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
29
node_modules/type-of/index.js
generated
vendored
Normal file
29
node_modules/type-of/index.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
var toString = Object.prototype.toString
|
||||
|
||||
module.exports = function(val){
|
||||
switch (toString.call(val)) {
|
||||
case '[object Function]': return 'function'
|
||||
case '[object Date]': return 'date'
|
||||
case '[object RegExp]': return 'regexp'
|
||||
case '[object Arguments]': return 'arguments'
|
||||
case '[object Array]': return 'array'
|
||||
case '[object String]': return 'string'
|
||||
}
|
||||
|
||||
if (typeof val == 'object' && val && typeof val.length == 'number') {
|
||||
try {
|
||||
if (typeof val.callee == 'function') return 'arguments';
|
||||
} catch (ex) {
|
||||
if (ex instanceof TypeError) {
|
||||
return 'arguments';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (val === null) return 'null'
|
||||
if (val === undefined) return 'undefined'
|
||||
if (val && val.nodeType === 1) return 'element'
|
||||
if (val === Object(val)) return 'object'
|
||||
|
||||
return typeof val
|
||||
}
|
||||
76
node_modules/type-of/package.json
generated
vendored
Normal file
76
node_modules/type-of/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "type-of@^2.0.1",
|
||||
"_id": "type-of@2.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-5yoXQYllaOn2KDeNgW1pEvfyOXI=",
|
||||
"_location": "/type-of",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "type-of@^2.0.1",
|
||||
"name": "type-of",
|
||||
"escapedName": "type-of",
|
||||
"rawSpec": "^2.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/type-of/-/type-of-2.0.1.tgz",
|
||||
"_shasum": "e72a1741896568e9f628378d816d6912f7f23972",
|
||||
"_spec": "type-of@^2.0.1",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ForbesLindesay/type-of/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Type assertions aka less-broken typeof.",
|
||||
"devDependencies": {
|
||||
"tape": "~2.3.2"
|
||||
},
|
||||
"homepage": "https://github.com/ForbesLindesay/type-of#readme",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"name": "type-of",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ForbesLindesay/type-of.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/tests.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/tests.js",
|
||||
"browsers": [
|
||||
"iexplore/8.0",
|
||||
"iexplore/9.0",
|
||||
"iexplore/10.0",
|
||||
"chrome/30.0",
|
||||
"chrome/31.0",
|
||||
"chrome/canary",
|
||||
"firefox/4.0",
|
||||
"firefox/10.0",
|
||||
"firefox/15.0",
|
||||
"firefox/20.0",
|
||||
"firefox/21.0",
|
||||
"firefox/22.0",
|
||||
"firefox/23.0",
|
||||
"firefox/24.0",
|
||||
"firefox/25.0",
|
||||
"firefox/nightly",
|
||||
"opera/11.0",
|
||||
"opera/17.0",
|
||||
"opera/next",
|
||||
"safari/5.0.5",
|
||||
"safari/5.1",
|
||||
"safari/6.0",
|
||||
"iphone/6.0",
|
||||
"ipad/6.0"
|
||||
]
|
||||
},
|
||||
"version": "2.0.1"
|
||||
}
|
||||
70
node_modules/type-of/test/tests.js
generated
vendored
Normal file
70
node_modules/type-of/test/tests.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
var type = require('../')
|
||||
var test = require('tape')
|
||||
|
||||
test('should match objects', function (t) {
|
||||
function Foo(){}
|
||||
t.plan(4)
|
||||
t.equal(type({}), 'object')
|
||||
t.equal(type(new Foo), 'object')
|
||||
t.equal(type(new Boolean(true)), 'object')
|
||||
t.equal(type(new Number(123)), 'object')
|
||||
})
|
||||
|
||||
test('should match numbers', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type(12), 'number')
|
||||
})
|
||||
|
||||
test('should match strings', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type("test"), 'string')
|
||||
})
|
||||
|
||||
test('should match dates', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type(new Date), 'date')
|
||||
})
|
||||
|
||||
test('should match booleans', function (t) {
|
||||
t.plan(2)
|
||||
t.equal(type(true), 'boolean')
|
||||
t.equal(type(false), 'boolean')
|
||||
})
|
||||
|
||||
test('should match null', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type(null), 'null')
|
||||
})
|
||||
|
||||
test('should match undefined', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type(undefined), 'undefined')
|
||||
})
|
||||
|
||||
test('should match arrays', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type([]), 'array')
|
||||
})
|
||||
|
||||
test('should match regexps', function (t) {
|
||||
t.plan(2)
|
||||
t.equal(type(/asdf/), 'regexp')
|
||||
t.equal(type(new RegExp('weee')), 'regexp')
|
||||
})
|
||||
|
||||
test('should match functions', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type(function(){}), 'function')
|
||||
})
|
||||
|
||||
test('should match arguments', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type((function(){ return arguments })()), 'arguments')
|
||||
})
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
test('should match elements', function (t) {
|
||||
t.plan(1)
|
||||
t.equal(type(document.createElement('div')), 'element')
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user