fix: multi-repo local dev (file:../ deps, package exports, missing deps)
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Mathias Buus
|
||||
|
||||
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.
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
# generate-object-property
|
||||
|
||||
Generate safe JS code that can used to reference a object property
|
||||
|
||||
npm install generate-object-property
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var gen = require('generate-object-property');
|
||||
console.log(gen('a','b')); // prints a.b
|
||||
console.log(gen('a', 'foo-bar')); // prints a["foo-bar"]
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
const isProperty = require('is-property')
|
||||
|
||||
gen.valid = isProperty
|
||||
|
||||
gen.property = function (prop) {
|
||||
return isProperty(prop) ? prop : JSON.stringify(prop)
|
||||
}
|
||||
|
||||
gen.optional = function (obj, prop) {
|
||||
return isProperty(prop) ? obj + '?.' + prop : obj + '?.[' + JSON.stringify(prop) + ']'
|
||||
}
|
||||
|
||||
module.exports = gen
|
||||
|
||||
function gen (obj, prop) {
|
||||
return isProperty(prop) ? obj + '.' + prop : obj + '[' + JSON.stringify(prop) + ']'
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "generate-object-property",
|
||||
"version": "2.0.0",
|
||||
"description": "Generate safe JS code that can used to reference a object property",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mafintosh/generate-object-property"
|
||||
},
|
||||
"devDependencies": {
|
||||
"brittle": "^3.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "brittle test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-property": "^1.0.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mafintosh/generate-object-property/issues"
|
||||
},
|
||||
"homepage": "https://github.com/mafintosh/generate-object-property",
|
||||
"main": "index.js",
|
||||
"author": "Mathias Buus (@mafintosh)",
|
||||
"license": "MIT"
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
const test = require('brittle')
|
||||
const gen = require('./')
|
||||
|
||||
test('valid', function (t) {
|
||||
t.is(gen('a', 'b'), 'a.b')
|
||||
})
|
||||
|
||||
test('invalid', function (t) {
|
||||
t.is(gen('a', '-b'), 'a["-b"]')
|
||||
})
|
||||
|
||||
test('valid (optional)', function (t) {
|
||||
t.is(gen.optional('a', 'b'), 'a?.b')
|
||||
})
|
||||
|
||||
test('invalid (optional)', function (t) {
|
||||
t.is(gen.optional('a', '-b'), 'a?.["-b"]')
|
||||
})
|
||||
Reference in New Issue
Block a user