Sha256: 46fcd14f40c8c53b75ce22423c9512c4722eba188033cf4c1cfb727b878093a2

Contents?: true

Size: 623 Bytes

Versions: 26

Compression:

Stored size: 623 Bytes

Contents

'use strict';

var define = require('define-data-property');
var hasDescriptors = require('has-property-descriptors')();
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();

var $TypeError = TypeError;

module.exports = function setFunctionName(fn, name) {
	if (typeof fn !== 'function') {
		throw new $TypeError('`fn` is not a function');
	}
	var loose = arguments.length > 2 && !!arguments[2];
	if (!loose || functionsHaveConfigurableNames) {
		if (hasDescriptors) {
			define(fn, 'name', name, true, true);
		} else {
			define(fn, 'name', name);
		}
	}
	return fn;
};

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.32 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.31 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.30 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.29 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.28 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.27 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.26 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.25 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.24 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.23 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.22 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.21 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.20 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.19 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.18 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.17 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.16 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.14 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.13 node_modules/set-function-name/index.js
immosquare-cleaner-0.1.12 node_modules/set-function-name/index.js