1.0.8 • Published 4 years ago
pg-utilities v1.0.8
Commonly Used Utilities JavaScript Library
Functions
abs(inputObjectArray, propertyName)- Converts every negative value for propertyName to its absolute value across an array of objectsbase64Decode(base64Encoded)- Given a base64 encoded string, returns an ASCII stringbase64Encode(string)- Given a an ASCII string, returns a base64 encoded stringfilter(inputObjectArray, searchString)- Filters any objects from the array where any of their properties contain the passed in search stringguid()- GUID generatorjsonParseNumbers(inputObject)- Similar to JSON.parse() but parses all number propertiesjwt.decode(encodedJwt)- Decode the JSON Web Token and return its 3 parts (header, payload, and signature) still in JSON formatjwt.extractHeader(encodedJwt)- Decode the JSON Web Token and return just its header as an objectjwt.extractSignature(encodedJwt)- Decode the JSON Web Token and return just its signature as an objectjwt.extractToken(encodedJwt)- Decode the JSON Web Token and return just its payload as an objectjwt.verify(encodedJwt)- Asynchronous function that decodes the JSON Web Token and validate it against Azure AD. Other validations coming in the future.nameSort(a, b)- Used when a and b are objects containing name propertiessort(inputObjectArray, propertyName, descending = false)- Sort an array of objects by the value of a given propertyName either ascending (default) or descendingstreamToString(readableStream)- Asynchronous function that given a readable NodeJS stream, returns it as a string