(kernel, shortcut)
| 52 | } |
| 53 | |
| 54 | function bindKernelToShortcut(kernel, shortcut) { |
| 55 | if (shortcut.kernel) { |
| 56 | shortcut.kernel = kernel; |
| 57 | return; |
| 58 | } |
| 59 | const properties = utils.allPropertiesOf(kernel); |
| 60 | for (let i = 0; i < properties.length; i++) { |
| 61 | const property = properties[i]; |
| 62 | if (property[0] === '_' && property[1] === '_') continue; |
| 63 | if (typeof kernel[property] === 'function') { |
| 64 | if (property.substring(0, 3) === 'add' || property.substring(0, 3) === 'set') { |
| 65 | shortcut[property] = function() { |
| 66 | shortcut.kernel[property].apply(shortcut.kernel, arguments); |
| 67 | return shortcut; |
| 68 | }; |
| 69 | } else { |
| 70 | shortcut[property] = function() { |
| 71 | return shortcut.kernel[property].apply(shortcut.kernel, arguments); |
| 72 | }; |
| 73 | } |
| 74 | } else { |
| 75 | shortcut.__defineGetter__(property, () => shortcut.kernel[property]); |
| 76 | shortcut.__defineSetter__(property, (value) => { |
| 77 | shortcut.kernel[property] = value; |
| 78 | }); |
| 79 | } |
| 80 | } |
| 81 | shortcut.kernel = kernel; |
| 82 | } |
| 83 | module.exports = { |
| 84 | kernelRunShortcut |
| 85 | }; |
no outgoing calls
no test coverage detected
searching dependent graphs…