Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / chain-able / test / fp / replace.js
Size: Mime:
const replace = require('../../src/deps/fp/replace')

test('replaces substrings of the input string', () => {
  expect(replace('1', 'one', '1 two three')).toEqual('one two three')
})

test('replaces regex matches of the input string', () => {
  expect(replace(/\d+/g, 'num', '1 2 three')).toEqual('num num three')
})

test('is curried up to 3 arguments', () => {
  expect(replace('').constructor, Function)
  expect(replace('', '').constructor, Function)

  var replaceSemicolon = replace(';')
  var removeSemicolon = replaceSemicolon('')
  expect(removeSemicolon('return 42;')).toEqual('return 42')
})