1.3.8 • Published 8 months ago

@taufik-nurrohman/f v1.3.8

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Utility functions that do not fit into a specific category.

Usage

CommonJS

const {forEachArray} = require('@taufik-nurrohman/f');

forEachArray([1, 2, 3], function (value, key) {
    console.log(value);
});

ECMAScript

import {forEachArray} from '@taufik-nurrohman/f';

forEachArray([1, 2, 3], function (value, key) {
    console.log(value);
});

Methods

forEachArray(array, at)

forEachArray(array, function (value, index) {
    return -1; // Delete at index `index`
    return 0; // Break
    return 1; // Continue
    return; // Continue
});

forEachMap(map, at)

forEachMap(map, function (value, key) {
    return -1; // Delete entry `key`
    return 0; // Break
    return 1; // Continue
    return; // Continue
});

forEachObject(object, at)

forEachObject(object, function (value, key) {
    return -1; // Delete entry `key`
    return 0; // Break
    return 1; // Continue
    return; // Continue
});

forEachSet(object, at)

forEachSet(set, function (value) {
    return -1; // Delete entry `value`
    return 0; // Break
    return 1; // Continue
    return; // Continue
});

getPrototype(of)

getReference(key)

getValueInMap(key, map)

hasKeyInMap(key, map)

letReference(key)

letValueInMap(key)

onAnimationsEnd(node, task)

setObjectAttributes(of, attributes, asStaticAttributes)

function Editor(self, state) {
    this.self = self;
    this.state = state;
    return this;
}

setObjectAttributes(Editor, {
    'name': {
        value: 'Editor'
    }
}, true);

setObjectAttributes(Editor, {
    'value': {
        get: function () {
            return this.self.value;
        },
        set: function (value) {
            this.self.value = value;
        }
    }
});

setObjectMethods(of, methods, asStaticMethods)

function Editor(self, state) {
    this.self = self;
    this.state = state;
    return this;
}

setObjectMethods(Editor, {
    'restore': function () {
        this.value = localStorage.getItem('session');
        return this;
    },
    'save': function () {
        localStorage.setItem('session', this.value);
        return this;
    }
});

setPrototype(of, value)

setReference(key, value)

setValueInMap(key, value, map)

toKeyFirstFromMap(map)

toKeyLastFromMap(map)

toKeysFromMap(map)

toValueFirstFromMap(map)

toValueLastFromMap(map)

toValuesFromMap(map)

1.3.8

8 months ago

1.3.7

8 months ago

1.3.6

8 months ago

1.3.5

8 months ago

1.3.4

8 months ago

1.3.3

9 months ago

1.3.2

9 months ago

1.3.1

9 months ago

1.3.0

10 months ago

1.2.2

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.6

11 months ago

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago