The following describes the behaviour of several npm commands, particularly w.r.t. the scripts that are run in each, for NPM version 6.5.0.
npm run preinstall
- link binaries (node-gyp)
- for each
bin
command in other package:
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
.const foos = ['fubar'] | |
const foo = undefined | |
const defaultFoos = ['snafu'] | |
const fubar = foos ? foos : foo ? [foo] : defaultFoos | |
console.log(fubar) |
function makeCar(brand, model) { | |
return { | |
brand, | |
model, | |
}; | |
} | |
const makeToyota = makeCar.bind(null, 'Toyota'); | |
const makeVolvo = makeCar.bind(null, 'Volvo'); |
function isInTheDOM(element) { | |
return element.ownerDocument === getRootNode(element); | |
function getRootNode(element) { | |
var rootNode = element; | |
var parentNode; | |
while (parentNode = rootNode.parentNode) { | |
rootNode = parentNode; | |
} |
function A() { | |
this.name = 'A'; | |
} | |
A.prototype.log = function () { | |
console.log( 'A', this ); | |
}; | |
var a = new A(); | |
a.log(); |
angular.directive( 'myDirective', function () { | |
return { | |
link: function ( scope, element ) { | |
element.on( 'click', function ( event ) { | |
scope.foo = 'bar'; | |
// need to $scope.$apply here. Ugly! Should be automagic. | |
} ); | |
}, | |
restrict: 'E' | |
}; |
javascript:(function(){pubsub.subscribe('*',function%20(data,topic){console.log(topic+':%20'+JSON.stringify(data));});}()); |
var tweenWithReAnimator = (function () { | |
var defaults, | |
getStyleProperties; | |
defaults = { | |
frameRate: 24,// The human eye can only register motion at a rate of approximately 24 frames per second. Faster than that, and the brain just doesn't recognize the difference. | |
tweenTime: 400 | |
}; | |
getStyleProperties = function ( o ) { |