Skip to content

gearcase/to-source-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

to-source-code

Converts function to its source code.

MIT License

build:? coverage:?

Install

$ npm install --save to-source-code 

Usage

For more use-cases see the tests

var toSourceCode = require('to-source-code');

toSourceCode(Math.min);               
// => 'function min() { [native code] }'

toSourceCode(function () { console.log(123); });              
// => 'function () { console.log(123); }'

toSourceCode();      // => ''
toSourceCode(null);  // => ''
toSourceCode(1);     // => '1'
toSourceCode('1');   // => '1'
toSourceCode(true);  // => 'true'
toSourceCode({});    // => '[object Object]'

Related

  • is-native - Checks if the given value is a native function.
  • to-num - Converts the given value to a number.
  • to-integer - Converts the given value to an integer.
  • to-length - Converts value to an integer suitable for use as the length of an array-like object.
  • to-str - Converts the given value to a string.
  • to-lower - Converts string, as a whole, to lower case.
  • to-upper - Converts string, as a whole, to upper case.
  • to-path - Converts value to a property path array.

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

About

Converts function to its source code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published