feliz.util
Various utilities ready to use for any project, but if you use feliz.js you'll be extra happy.
API Documentation (WIP)
- util
- .is(target) ⇒
checkers
- ~checkers
- .object() ⇒
boolean
- .string() ⇒
boolean
- .array() ⇒
boolean
- .number() ⇒
boolean
- .date() ⇒
boolean
- .regex() ⇒
boolean
- .function() ⇒
boolean
- .null() ⇒
boolean
- .undefined() ⇒
boolean
- .arrayish() ⇒
boolean
- .objectish() ⇒
boolean
- .feliz() ⇒
boolean
- .object() ⇒
- ~checkers
- .object(target) ⇒
actions
- ~actions
- .merge(...reference) ⇒
object
- .merge(...reference) ⇒
- ~actions
- .string(target) ⇒
actions
- .is(target) ⇒
checkers
util.is(target) ⇒ Type checker for feliz.util
Kind: static method of util
Returns: checkers
- Functions that will validate the target.
Param | Type | Description |
---|---|---|
target | mixed |
The target value to be checked. |
Example
const is = ;const str = 'hello world';if console; // will log 'hello world'
- .is(target) ⇒
checkers
- ~checkers
- .object() ⇒
boolean
- .string() ⇒
boolean
- .array() ⇒
boolean
- .number() ⇒
boolean
- .date() ⇒
boolean
- .regex() ⇒
boolean
- .function() ⇒
boolean
- .null() ⇒
boolean
- .undefined() ⇒
boolean
- .arrayish() ⇒
boolean
- .objectish() ⇒
boolean
- .feliz() ⇒
boolean
- .object() ⇒
- ~checkers
is~checkers
Available type-checkers for given target.
Kind: inner class of is
- ~checkers
- .object() ⇒
boolean
- .string() ⇒
boolean
- .array() ⇒
boolean
- .number() ⇒
boolean
- .date() ⇒
boolean
- .regex() ⇒
boolean
- .function() ⇒
boolean
- .null() ⇒
boolean
- .undefined() ⇒
boolean
- .arrayish() ⇒
boolean
- .objectish() ⇒
boolean
- .feliz() ⇒
boolean
- .object() ⇒
boolean
checkers.object() ⇒ Kind: instance method of checkers
Example
object // trueobject // trueobject // true
boolean
checkers.string() ⇒ Kind: instance method of checkers
Example
// true // true // true // true
boolean
checkers.array() ⇒ Kind: instance method of checkers
Example
// true // true // true
boolean
checkers.number() ⇒ Kind: instance method of checkers
boolean
checkers.date() ⇒ Kind: instance method of checkers
boolean
checkers.regex() ⇒ Kind: instance method of checkers
boolean
checkers.function() ⇒ Kind: instance method of checkers
boolean
checkers.null() ⇒ Kind: instance method of checkers
boolean
checkers.undefined() ⇒ Kind: instance method of checkers
boolean
checkers.arrayish() ⇒ An array, but not strictly an array.
Kind: instance method of checkers
Example
const ex1 = ;const ex2 = ;const ex3 = new {};const is = ;// prints: true true falseconsole// prints: true true trueconsole
boolean
checkers.objectish() ⇒ An object, but not strictly an object.
Kind: instance method of checkers
Example
const ex1 = {};const ex2 = ;const ex3 = new {};const is = ;// prints: true true falseconsole// prints: true true trueconsole
boolean
checkers.feliz() ⇒ A feliz instance.
Kind: instance method of checkers
actions
util.object(target) ⇒ Given a target, operate using actions
Kind: static method of util
Param | Type | Description |
---|---|---|
target | object |
The object used as target/source. |
- .object(target) ⇒
actions
- ~actions
- .merge(...reference) ⇒
object
- .merge(...reference) ⇒
- ~actions
object~actions
Available actions for the target object.
Kind: inner class of object
object
actions.merge(...reference) ⇒ Recursively merge reference(s) with target.
Kind: instance method of actions
Returns: object
- The resulting object.
Param | Type | Description |
---|---|---|
...reference | object |
Objects to be merged with target. |
actions
util.string(target) ⇒ String utilities for feliz.util
Kind: static method of util
Param | Type | Description |
---|---|---|
target | string |
The string to target. |
Example
const str = ;const ops = ;// returns object with actions for target string
string~actions
Actions to be applied to given string target.
Kind: inner class of string
actions.template(context)
Allows given string to be converted according to a context.
Kind: instance method of actions
Param | Type | Description |
---|---|---|
context | object |
The object defining the context to resolve. |
Example
const str = ;const foo = ; // Hello Bar
License
The MIT License (MIT)
Copyright (c) 2016 Héctor Adán Menéndez Rivera
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.