initial commit
This commit is contained in:
25
node_modules/hasown/.npmignore
generated
vendored
Normal file
25
node_modules/hasown/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# Deployed apps should consider commenting this line out:
|
||||
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
|
||||
node_modules
|
||||
21
node_modules/hasown/LICENSE
generated
vendored
Normal file
21
node_modules/hasown/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Radu Brehar
|
||||
|
||||
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.
|
||||
8
node_modules/hasown/Makefile
generated
vendored
Normal file
8
node_modules/hasown/Makefile
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
REPORTER = spec
|
||||
|
||||
test:
|
||||
./node_modules/.bin/mocha --recursive --reporter $(REPORTER) --require should
|
||||
test-w:
|
||||
./node_modules/.bin/mocha --recursive --reporter $(REPORTER) --require should --watch
|
||||
|
||||
.PHONY: test test-w
|
||||
55
node_modules/hasown/README.md
generated
vendored
Normal file
55
node_modules/hasown/README.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
hasown
|
||||
=======
|
||||
|
||||
JavaScript curried hasOwn helper.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install hasown
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
#### Simple usage
|
||||
|
||||
```js
|
||||
var hasOwn = require('hasown')
|
||||
var person = { name: 'bob' }
|
||||
|
||||
hasOwn(person, 'name') == true
|
||||
```
|
||||
|
||||
#### Curried usage
|
||||
|
||||
```js
|
||||
var hasOwn = require('hasown')
|
||||
var person = { lastName: 'willson' }
|
||||
var child = Object.create(person)
|
||||
child.age = 1
|
||||
child.firstName = 'bob'
|
||||
|
||||
var childHasOwn = hasOwn(child)
|
||||
|
||||
for (var k in child) if (childHasOwn(k)){
|
||||
console.log(k, ' = ', child[k])
|
||||
}
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
```sh
|
||||
$ make
|
||||
```
|
||||
|
||||
Watch mode
|
||||
|
||||
```sh
|
||||
$ make test-w
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
```
|
||||
MIT
|
||||
```
|
||||
9
node_modules/hasown/hasown.sublime-project
generated
vendored
Normal file
9
node_modules/hasown/hasown.sublime-project
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"follow_symlinks": true,
|
||||
"path": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
1168
node_modules/hasown/hasown.sublime-workspace
generated
vendored
Normal file
1168
node_modules/hasown/hasown.sublime-workspace
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
38
node_modules/hasown/index.js
generated
vendored
Normal file
38
node_modules/hasown/index.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict'
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty
|
||||
|
||||
function curry(fn, n){
|
||||
|
||||
if (typeof n !== 'number'){
|
||||
n = fn.length
|
||||
}
|
||||
|
||||
function getCurryClosure(prevArgs){
|
||||
|
||||
function curryClosure() {
|
||||
|
||||
var len = arguments.length
|
||||
var args = [].concat(prevArgs)
|
||||
|
||||
if (len){
|
||||
args.push.apply(args, arguments)
|
||||
}
|
||||
|
||||
if (args.length < n){
|
||||
return getCurryClosure(args)
|
||||
}
|
||||
|
||||
return fn.apply(this, args)
|
||||
}
|
||||
|
||||
return curryClosure
|
||||
}
|
||||
|
||||
return getCurryClosure([])
|
||||
}
|
||||
|
||||
|
||||
module.exports = curry(function(object, property){
|
||||
return hasOwn.call(object, property)
|
||||
})
|
||||
32
node_modules/hasown/package.json
generated
vendored
Normal file
32
node_modules/hasown/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "hasown",
|
||||
"version": "1.0.1",
|
||||
"description": "JavaScript curried hasOwn helper",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "make test",
|
||||
"test-w": "make test-w",
|
||||
"test-debug": "mocha --debug-brk"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~1.21.0",
|
||||
"should": "~4.0.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/radubrehar/hasown.git"
|
||||
},
|
||||
"keywords": [
|
||||
"own",
|
||||
"property",
|
||||
"hasOwn",
|
||||
"properties",
|
||||
"object",
|
||||
"key"
|
||||
],
|
||||
"author": "Radu Brehar",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/radubrehar/has-own/issues"
|
||||
}
|
||||
}
|
||||
61
node_modules/hasown/test/Test.js
generated
vendored
Normal file
61
node_modules/hasown/test/Test.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
'use strict'
|
||||
|
||||
describe('hasOwn test', function(){
|
||||
|
||||
var hasOwn = require('../index')
|
||||
|
||||
it('should return true for own props', function(){
|
||||
|
||||
hasOwn({name: 'x'}, 'name')
|
||||
.should
|
||||
.equal(true)
|
||||
|
||||
hasOwn({name: 'x'}, 'name')
|
||||
.should
|
||||
.equal(true)
|
||||
})
|
||||
|
||||
it('should return false for not own props', function(){
|
||||
var first = { name: 'x'}
|
||||
var second = Object.create(first)
|
||||
|
||||
hasOwn(first, 'name')
|
||||
.should
|
||||
.equal(true)
|
||||
|
||||
hasOwn(first, 'x')
|
||||
.should
|
||||
.equal(false)
|
||||
|
||||
hasOwn(second, 'name')
|
||||
.should
|
||||
.equal(false)
|
||||
|
||||
second.name = 'bil'
|
||||
hasOwn(second, 'name')
|
||||
.should
|
||||
.equal(true)
|
||||
})
|
||||
|
||||
it('should allow curry', function(){
|
||||
|
||||
var person = {
|
||||
name: 'x'
|
||||
}
|
||||
|
||||
var child = Object.create(person)
|
||||
child.age = 1
|
||||
child.firstName = 'bil'
|
||||
|
||||
var result = []
|
||||
var childHasOwn = hasOwn(child)
|
||||
|
||||
for(var k in child) if (childHasOwn(k)){
|
||||
result.push(k)
|
||||
}
|
||||
|
||||
result
|
||||
.should
|
||||
.eql(['age','firstName'])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user