1.3.8 • Published 2 months ago

@taufik-nurrohman/f v1.3.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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

2 months ago

1.3.7

2 months ago

1.3.6

2 months ago

1.3.5

2 months ago

1.3.4

2 months ago

1.3.3

2 months ago

1.3.2

2 months ago

1.3.1

2 months ago

1.3.0

4 months ago

1.2.2

4 months ago

1.2.1

4 months ago

1.2.0

4 months ago

1.1.6

4 months ago

1.1.5

4 months ago

1.1.4

4 months ago

1.1.3

4 months ago

1.1.2

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago