Skip to content
This repository has been archived by the owner on Aug 22, 2020. It is now read-only.

Commit

Permalink
feat(assertString): verifies that a value is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Kuzmenko committed Mar 4, 2019
1 parent 37a77c5 commit 3e758c0
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
26 changes: 26 additions & 0 deletions assertString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* @flow */

const assert = require('./assert')
const isString = require('lodash/isString')

/**
* verifies that `actual` is a string
*
* @throws {AssertionError} test failure
* @example
* import assertString from 'secondwheel/assertString'
*
* describe('assertString', () => {
* it('should be a string', () => {
* assertString('')
* })
* })
*/
const assertString = (
actual/*: any */,
message/*:: ?:string */ = 'expected value to be a string'
) => {
assert(actual, isString, message)
}

module.exports = assertString

0 comments on commit 3e758c0

Please sign in to comment.