JSPM

fancyarray

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q12407F
    • License MIT

    Easy Array Tools

    Package Exports

    • fancyarray

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fancyarray) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Easy Array Tools

    Installation

    $ npm i fancyarray

    Usage and Example

    import { is_array, in_array, in_deep_array, add_to_array, remove_array } from 'fancyarray';
    
    or
    
    var { is_array, in_array, in_deep_array, add_to_array, remove_array } = require('fancyarray');
    //Check value exists in array
    
    in_array( @STRING, @ARRAY ) // Output is Bool (true / false)
    
    
    //Check value exists in array
    
    in_deep_array(@STRING, @KEY, @ARRAY)  // Output is Bool (true / false)
    

    example:

    var arr = [
            {
                name: 'Jade'
            },
            {
                name: 'Scorpion'
            }
        ];
        
    if(in_deep_array('Scorpion', 'name', arr)){
        alert('Yes')
    }
        
    
    //Add value to array with index name
    
    add_to_array(@STRING, @KEY, @ARRAY)  // Output is Array
    
    

    example:

    
    var arr = [
            {
                name: 'Jade'
            },
            {
                name: 'Scorpion'
            }
        ];
        
    add_to_array('John', 'name', arr);
        
    //Output
    0: {name: "Jade"}
    1: {name: "Scorpion"}
    2: {name: "John"}
    
    
    //Remove Value from array with index name
    
    remove_array(@STING, @KEY, @ARRAY); // Output is Array
    
    //Validate array 
    
    is_array( @Variable ) // Output is Bool (true / false)