Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
regex-native-function
Advanced tools
Regular expression to detect a native function.
$ npm install regex-native-function
var re = require( 'regex-native-function' );
Regular expression to detect a native function
.
var bool = re.test( Math.sqrt.toString() );
// returns true
bool = re.test( (function(){}).toString() );
// returns false
var re = require( 'regex-native-function' );
function isNative( fcn ) {
return re.test( fcn.toString() );
}
console.log( isNative( Math.sqrt ) );
// returns true
console.log( isNative( String ) );
// returns true
console.log( isNative( Int8Array ) );
// returns true
console.log( isNative( Date ) );
// returns true
console.log( isNative( function(){} ) );
// returns false
To run the example code from the top-level application directory,
$ node ./examples/index.js
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
Copyright © 2015. Athan Reines.
FAQs
Regular expression to detect a native function.
We found that regex-native-function demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.