All Projects → insin → Isomorph

insin / Isomorph

Licence: mit
Shared utilities for browsers and Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Isomorph

Universal
Seed project for Angular Universal apps featuring Server-Side Rendering (SSR), Webpack, CLI scaffolding, dev/prod modes, AoT compilation, HMR, SCSS compilation, lazy loading, config, cache, i18n, SEO, and TSLint/codelyzer
Stars: ✭ 669 (+7333.33%)
Mutual labels:  universal, isomorphic
Jackblog React
Jackblog react 版, 个人博客系统, 使用服务端渲染(Universal / Isomorphic), react, redux, react-router, react-bootstrap, immutablejs, redux-form等
Stars: ✭ 292 (+3144.44%)
Mutual labels:  universal, isomorphic
react-ssr-spa
Server side rendered single page app using reactjs official libraries.
Stars: ✭ 30 (+233.33%)
Mutual labels:  isomorphic, universal
Usus
Webpage pre-rendering service. ⚡️
Stars: ✭ 804 (+8833.33%)
Mutual labels:  universal, isomorphic
React Server
🚀 Blazing fast page load and seamless navigation.
Stars: ✭ 3,932 (+43588.89%)
Mutual labels:  universal, isomorphic
webpack-isomorphic-compiler
A compiler that makes your life easier if you are building isomorphic webpack powered apps, that is, single page applications with server-side rendering
Stars: ✭ 16 (+77.78%)
Mutual labels:  isomorphic, universal
Go Starter Kit
[abandoned] Golang isomorphic react/hot reloadable/redux/css-modules/SSR starter kit
Stars: ✭ 2,855 (+31622.22%)
Mutual labels:  universal, isomorphic
universal-progressive-todos
A Todo list with universal JavaScript & Progressive Enhancement
Stars: ✭ 30 (+233.33%)
Mutual labels:  isomorphic, universal
Hackernews
HackerNews clone built with Nuxt.js
Stars: ✭ 758 (+8322.22%)
Mutual labels:  universal, isomorphic
Isomorphic React
A simple but powerful React application built on a standards-compliant back-end
Stars: ✭ 318 (+3433.33%)
Mutual labels:  universal, isomorphic
react-ssr-starter
📚 Featuring Webpack 4, React 17-18, SSR, HMR, prefetching, universal lazy-loading, and more
Stars: ✭ 18 (+100%)
Mutual labels:  isomorphic, universal
Awesome Nextjs
📔 📚 A curated list of awesome resources : books, videos, articles about using Next.js (A minimalistic framework for universal server-rendered React applications)
Stars: ✭ 6,812 (+75588.89%)
Mutual labels:  universal, isomorphic
redux-pluto
redux pluto
Stars: ✭ 75 (+733.33%)
Mutual labels:  isomorphic, universal
Catberry
Catberry is an isomorphic framework for building universal front-end apps using components, Flux architecture and progressive rendering.
Stars: ✭ 793 (+8711.11%)
Mutual labels:  universal, isomorphic
react-ssr-hydration
Example of React Server Side Rendering with Styled Components and Client Side Hydration
Stars: ✭ 15 (+66.67%)
Mutual labels:  isomorphic, universal
FlipED
A LMS built specifically for Thailand's Education 4.0 system.
Stars: ✭ 24 (+166.67%)
Mutual labels:  isomorphic, universal
server
Serve one or more react apps! - Custom routes, HotReloading, Authenticated Apps/routes, Relay, Webpack..
Stars: ✭ 20 (+122.22%)
Mutual labels:  isomorphic, universal
fastify-vite
This plugin lets you load a Vite client application and set it up for Server-Side Rendering (SSR) with Fastify.
Stars: ✭ 497 (+5422.22%)
Mutual labels:  isomorphic, universal
Isomorphic Webpack
Abstracts universal consumption of application code base using webpack.
Stars: ✭ 294 (+3166.67%)
Mutual labels:  universal, isomorphic
Rill
🗺 Universal router for web applications.
Stars: ✭ 541 (+5911.11%)
Mutual labels:  universal, isomorphic

isomorph build status

Utilities extracted from my dual-sided projects, which can be shared between browsers and Node.js/io.js. This project is really a grab-bag, so modules are intended to be required individually as needed, e.g. for type-checking functions you would require('isomorph/is').

Install

npm install isomorph

Browser bundles export a global isomorph variable.

Module APIs

is

Type-checking and more - anything which is a generic, reusable test which would naturally have a function name starting with "is".

Type-checking functions

is.Array, is.Boolean, is.Date, is.Error, is.Function, is.Number, is.Object, is.RegExp, is.String

Determines if the given input is of the specified type.

Content-checking functions

is.Empty

Determines if the given Object has any enumerable properties.

array

Utilities for working with Arrays.

array.flatten(arr)

Flattens the given Array in place (and returns it, for chaining).

func

Utilities for working with Functions.

func.bind(fn, context[, arg1, ...])

Binds the given function to the given execution context (this when the function is called) and partially applies any additional arguments given.

The following properties are available on the binding function:

__func__ - the function which is bound.

__context__ - the context to which the function is bound.

object

Utilities for working with Objects.

object.hasOwn(obj, propertyName)

Wrapped version of 1Object.prototype.hasOwnProperty()` - use to avoid the "hasOwnProperty trap", as described in An Object is not a Hash.

object.type(obj)

Returns the type of an object as a lowercase string:

object.type({}) // "object"
object.type([]) // "array"

object.extend(dest[, src1, ...])

The classic extend method - copies own properties from src arguments to dest, returning dest.

Does nothing for any src arguments which are falsy, so it's safe to pass in an options argument which is potentially undefined, e.g.:

function quiz(kwargs) {
 kwargs = object.extend({answer: 42, question: 'Meaning?'}, kwargs)
 // ...
}

object.inherits(childConstructor, parentConstructor)

The classic inherits method - puts parentConstructor's prototype in childConstructor's prototype chain, returning childConstructor.

object.items(obj)

Creates an Array of [property, value] pairs from an Object.

object.fromItems(items)

Creates an Object from an Array of [property, value] pairs.

function sortedFieldObj(fieldObj) {
   var fields = object.items(fieldObj)
   fields.sort(function(a, b) {
     return a[1].creationCounter - b[1].creationCounter
   })
   return object.fromItems(fields)
}

object.lookup(arr)

Creates a lookup Object from an Array, coercing each item in the Array to String and adding it to a lookup Object as a property whose value is true:

var ALLOWED_TAGS = ['div', 'span', 'h1']
  , TAG_LOOKUP = object.lookup(ALLOWED_TAGS)

function elementify(tagName) {
   if (TAG_LOOKUP[tagName]) {
      console.log(tagName + ' is valid')
   }
   else {
      console.log(tagName + ' is not allowed')
   }
}

object.get(obj, prop, default)

If the object has an own property with the given name, returns its value, otherwise returns the given default.

object.pop(obj, prop, default)

If the object has an own property with the given name, deletes the property from the object and returns its value, otherwise returns the given default.

object.setDefault(obj, prop, default)

If the object has an own property with the given name, returns its value, otherwise sets the given default as the property and returns it.

format

Formatting utilities.

format.format(str[, r1, ...])

Replaces "%s" placeholders in the given string with positional arguments.

format.formatArr(str, arr)

Replaces "%s" placeholders in the given string with arguments passed as an Array.

To output a literal '%', escape percentage signs by doubling them up:

format.format('%% Complete: %s%%', 95) // '% Complete: 95%'

format.formatObj(str, obj)

Replaces "{varName}" placeholders in the given string with same-named properties from a given object.

To output a literal '{varName}', double up the opening brace:

format.formatObj('{{foo}={foo}, {{bar}={bar}', {foo: 1, bar: 2}) // '{foo}=1, {bar}=2'

format.fileSize(bytes[, threshold])

Formats a number of bytes as a file size with an appropriately-scaled unit. The threshold argument determines the point at which the next unit up is used, defaulting to 768.

File sizes are rounded to the second decimal point, with any trailing zeros being stripped off and the decimal point also being omitted if all decimals are zero.

format.fileSize(768) // '768 bytes'
format.fileSize(769) // '0.75 kB
format.fileSize(123456789) // '117.74 MB'

re

Regular Expression utilities.

re.findAll(regex, str[, flags])

Uses a regular expression (given as a String or a RegExp object) to find and return matches in the given String, in the vein of Python's re.findall.

If a single group is present in the RegExp, a list of matches will be returned. If more than one group is present, a list of lists of matches will be returned.

If regex is specified as a String, the flags argument can be used to specify the flags to be used when compiling the RegExp.

querystring

Utilities for working with query strings.

querystring.parse(str)

Creates an Object from a query string, providing values for names which are present more than once as an Array.

querystring.stringify(obj)

Creates a query string from an Object, expecting names with multiple values to be specified as an Array.

copy

Utilites for creating copies of objects. This implementation is from Oran Looney's Deep Copy in JavaScript and exposes the same interface.

copy.copy(obj)

Creates a shallow copy of an object.

copy.deepCopy(obj)

Creates a deep copy of an object.

time

Utilities for formatting and parsing times and dates.

Formatting Directives

The following formatting directives are supported by time.strftime and time.strptime:

Directive Meaning
%b Locale's abbreviated month name
%B Locale's full month name
%d Day of the month as a decimal number [01,31]
%H Hour (24-hour clock) as a decimal number [00,23]
%I Hour (12-hour clock) as a decimal number [00,12]
%m Month as a decimal number [01,12]
%M Minute as a decimal number [00,59]
%p Locale's equivalent of either AM or PM (only with %I)
%S Second as a decimal number [00,59]
%y Year without century as a decimal number [00,99]
%Y Year with century as a decimal number
%% A literal % character

time.strftime(date, format[, locale])

A partial implementation of strftime, which formats a Date according to a format string. An Error will be thrown if an invalid format string is given.

time.strpdate(string, format[, locale])

Parses time details from a string, based on a format string, returning a Date.

This is a convenience wrapper around time.strptime:

time.strptime(string, format[, locale])

A partial implementation of strptime, which parses time details from a string, based on a format string.

Returns an Array of numbers, each corresponding to a datetime field:

Index Represents Values
0 Year (for example, 2003
1 Month range [1,12]
2 Day range [1,31]
3 Hour range [0,23]
4 Minute range [0,59]
5 Second range [0,59]

This implementation largely takes its cue from the documentation for Python's time module, as documented at http://docs.python.org/lib/module-time.html with the exception of seconds formatting, which is restricted to the range [00,59] rather than [00,61].

Locales

The time module has basic support for using locales when parsing and formatting dates.

time.defaultLocale - the code for the default locale - defaults to 'en'.

time.locales - an object defining locale details, with locale codes as its properties. Only contains the locale definition for 'en' by default.

time.getLocale(code) - retrieves the locale with the given code, falling back to just the language code and finally to the default locale if a locale can't be found.

Locale codes can consist of a language code (e.g. 'en') or a language and region code (e.g. 'en-GB').

url

Utilities for working with URLs.

url.parseUri(url)

Splits any well-formed URI into its parts - from http://blog.stevenlevithan.com/archives/parseuri.

parseUri 1.2.2
(c) Steven Levithan <stevenlevithan.com>
MIT License

url.makeUri(obj)

Creates a URI from an object specification - from https://gist.github.com/1121696.

makeURI 1.2.2 - create a URI from an object specification
(c) Niall Smart <niallsmart.com>
MIT

MIT Licensed

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].