mjhm / lodash-match-pattern

Deep JSON pattern matching library
MIT License
50 stars 3 forks source link

add filter for extracting a JWT payload #33

Closed mjhm closed 7 years ago

mjhm commented 7 years ago

This is too special case for this library and hauls in too much jsonwebtoken machinery. But it can be easily done with an extension, which is an excellent practical example:

jwt = require 'jsonwebtoken'
_ = matchPattern.getLodashModule()

_.mixin {
  jwtDecode: (token) ->
    jwt.decode token, {json: true, complete: true}
}