1.1.0 • Published 9 years ago

is-sync-function v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

is-sync-function npmjs.com The MIT License

Opposite of is-async-function. Check that given function is synchronous.

code climate standard code style travis build status coverage status dependency status

Install

npm i is-sync-function --save
npm test

Usage

For more use-cases see the tests

var isSyncFunction = require('is-sync-function')

var fs = require('fs')
isSyncFunction(fs.readFileSync) //=> true
isSyncFunction(fs.renameSync) //=> true
isSyncFunction(fs.chownSync) //=> true
isSyncFunction(fs.statSync) //=> true

isSyncFunction(fs.readFile) //=> false
isSyncFunction(fs.rename) //=> false
isSyncFunction(fs.chown) //=> false
isSyncFunction(fs.stat) //=> false

isSyncFunction(JSON.stringify) //=> true
isSyncFunction(JSON.parse) //=> true

Related

  • always-callback: Create callback api for given sync function. Guarantee that given function (sync or async, no matter) will always have callback api and will handle errors correctly.
  • is-async-function: Check that given function is async (callback) function or not. Trying to guess that based on check if callback, cb, done or next exists as function argument name.
  • is-empty-function: Checks the given function (or fn.toString()) is with empty body - dont have body.
  • is-hexcolor: Check that given value is valid hex color, using hex-color-regex - the best regex for matching hex color values
  • is-ansi: Check that given string contain ANSI color codes, without CLI
  • make-callback: Make synchronous function or generator to support callback api

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github