pico-common

0.15.2 • Public • Published

pico-common

A pico sized (~ 7kb) with zero dependency javascript library for commonly overlooked utility functions for both nodejs and the browser.

this library goes well with commonly used libraries such as lodash and react with little or no overlapping.

features

Below are the main features

data validator

A data driven data validator, suitable for simple to very complicated data structure. all you need is

  1. define a schema/specification of your data
  2. pass the schema and your data to the validator
  3. it returns the result

read more

deep merging

Like Object.assign but it does deep merging for object and array

read more

route parser & route builder

building something like express router? this function can help you

/pico/common/str/route + /pico/:lib/:mod/:fun -> {lib: 'common', mod: 'str', fun: 'route}

/pico/:lib/:mod/:fun + {lib: 'common', mod: 'str', fun: 'route} -> /pico/common/str/route

read more

cronjob

Need a cron schedule expressions parser? this is a pure javascript implementation can run on the browsers and nodejs. designed to work with setTimeout

read more

a javascript test framework for javascript lovers

expect('style').is.very.hard.to.remember.and.use('?'). Javascript operators is all you need.

this framework supported serial and pararellel test cases execution.

read more

module

A list of functions to you help to build your own sandbox module/dependency with asynchronous loader (similar to AMD)

read more

call stack

printing javascript function call stack? this is for you

read more

cleaner JSON.parse and JSON.stringify

these parse and stringify functions are designed to avoid unnecessary json stringify and parse and stringify-again in your workflow

for example

  • A frontend stringified a big data structure for a request body
  • expressjs bodyparser parsed entire request body but only part of them are use in server-side logic
  • backend's model stringified part of the request body again and save it to db

with these functions

  • frontend specially stringify the server needed data and db needed data in one string
  • backend only parse backend needed data for server-side logic
  • database needed can be saved as it is to db without stringification

read more

json path

xpath for json

read more

optional chaining

A data driven optional chaining, a optional chaining that can be saved and transport over network

read more

html template engine

A 23 LOC html template engine

read more

installing

click here browser and nodejs installation instruction

Package Sidebar

Install

npm i pico-common

Weekly Downloads

11

Version

0.15.2

License

MIT

Unpacked Size

471 kB

Total Files

19

Last publish

Collaborators

  • ldarren