mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action!
This commit is contained in:
parent
8deacc95b1
commit
4e3aad3b7f
3750 changed files with 1155519 additions and 0 deletions
37
node_modules/genfun/lib/util.js
generated
vendored
Normal file
37
node_modules/genfun/lib/util.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict'
|
||||
|
||||
module.exports.isObjectProto = isObjectProto
|
||||
function isObjectProto (obj) {
|
||||
return obj === Object.prototype
|
||||
}
|
||||
|
||||
const _null = {}
|
||||
const _undefined = {}
|
||||
const Bool = Boolean
|
||||
const Num = Number
|
||||
const Str = String
|
||||
const boolCache = {
|
||||
true: new Bool(true),
|
||||
false: new Bool(false)
|
||||
}
|
||||
const numCache = {}
|
||||
const strCache = {}
|
||||
|
||||
/*
|
||||
* Returns a useful dispatch object for value using a process similar to
|
||||
* the ToObject operation specified in http://es5.github.com/#x9.9
|
||||
*/
|
||||
module.exports.dispatchableObject = dispatchableObject
|
||||
function dispatchableObject (value) {
|
||||
// To shut up jshint, which doesn't let me turn off this warning.
|
||||
const Obj = Object
|
||||
if (value === null) { return _null }
|
||||
if (value === undefined) { return _undefined }
|
||||
switch (typeof value) {
|
||||
case 'object': return value
|
||||
case 'boolean': return boolCache[value]
|
||||
case 'number': return numCache[value] || (numCache[value] = new Num(value))
|
||||
case 'string': return strCache[value] || (strCache[value] = new Str(value))
|
||||
default: return new Obj(value)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue