Skip to content

Instantly share code, notes, and snippets.

@petsel
petsel / Function.before.js
Last active September 1, 2020 21:36
possible implementation of prototypal method modifier [before].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.after.js
Last active September 1, 2020 21:48
possible implementation of prototypal method modifier [after].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.around.js
Last active September 1, 2020 21:45
possible implementation of prototypal method modifier [around].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.afterThrowing.js
Last active September 1, 2020 21:44
possible implementation of prototypal method modifier [afterThrowing].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.afterFinally.js
Last active September 1, 2020 21:55
possible implementation of prototypal method modifier [afterFinally].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Array.flatten.js
Last active October 10, 2016 09:45
"Math.average", "Math.sum", "Array.flatten", "Array.shuffle", "Enumerable.shuffle", "Array.unique", "Enumerable.unique"
composable("composites.Array_flatten", function (require, global) {
"use strict";
var
environment = require("environment_extended_introspective_core"),
environment_introspective = environment.introspective,
@petsel
petsel / Array.interlock.js
Last active February 23, 2021 19:22
Implementation of a prototypal `Array` method which, from both processed iterable structures, interlocks each item of same index, pairwise and repeatedly into a new array. Sparse locations on either side will be recognized and accordingly (re)assigned.
/**
*
* [Array.interlock.js]
*
* Implementation of a prototypal `Array` method which,
* from both processed iterable structures, interlocks
* each item of same index, pairwise and repeatedly
* into a new array.
* Sparse locations on either side will be recognized
* and accordingly (re)assigned.
@petsel
petsel / custom-module-system-core.js
Created May 19, 2015 19:09
module system core ... able of being custom named/branded but also with "white label" fall-back.
(function (global, moduleSystemName, namespace) {
"use strict";
var
moduleSystem, // the "custom named" module system core.
@petsel
petsel / Array.reject.js
Last active February 22, 2021 17:25
Implementation of a condition-function based, prototypal `Array` method which returns rejected array items and does mutate its processed array.
/**
*
* [Array.reject.js]
*
* Implementation of a condition-function based, prototypal `Array` method
* which returns rejected array items and does mutate its processed array.
*
* - `Array.prototype.reject`
*
*/
@petsel
petsel / Object.with.without.js
Created October 5, 2015 13:30
prototypal object (de)composition methods targeting function based Traits/Mixins working from an [Object] based view as antipode to [Function.call/apply].
(function (Object, Array) {
"use strict";
var
object_prototype = Object.prototype,
isObject = function is_object (type) {