From 824a2d9f587ca017fc71b84d835e72f54f9c87c4 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 7 Nov 2018 18:02:36 +0100 Subject: Began rewrite --- node_modules/locutus/php/funchand/create_function.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 node_modules/locutus/php/funchand/create_function.js (limited to 'node_modules/locutus/php/funchand/create_function.js') diff --git a/node_modules/locutus/php/funchand/create_function.js b/node_modules/locutus/php/funchand/create_function.js new file mode 100644 index 0000000..1d75b5d --- /dev/null +++ b/node_modules/locutus/php/funchand/create_function.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function create_function(args, code) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/create_function/ + // original by: Johnny Mast (http://www.phpvrouwen.nl) + // reimplemented by: Brett Zamir (http://brett-zamir.me) + // example 1: var $f = create_function('a, b', 'return (a + b)') + // example 1: $f(1, 2) + // returns 1: 3 + + try { + return Function.apply(null, args.split(',').concat(code)); + } catch (e) { + return false; + } +}; +//# sourceMappingURL=create_function.js.map \ No newline at end of file -- cgit v1.2.3