Skip to content

jimbojw/php-extract.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-extract.js

PHP's extract() function, ported to JavaScript.

usage

Given an object, the extract() function produces code which you run through eval(). The generated code creates variables in the local scope for each key in the target object.

(function() {
  
  var obj = { foo: "bar" };
  
  eval(extract(obj));
  
  foo === obj.foo; // true

})();

extract() does not pass values through JSON serialization, they are strictly equal to the values in the original object.

About

PHP's extract() function, ported to JavaScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published