How to use just-map-object - 9 common examples

To help you get started, we’ve selected a few just-map-object examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinajs / tina / src / core / layers / component.js View on Github external
constructor ({ options = {}, $source }) {
    super()

    // creating Tina-Component members
    let members = {
      data: options.data(),
      compute: options.compute || function () {
        return {}
      },
      ...options.methods,
      // hooks
      ...map(pick(options, COMPONENT_HOOKS), (name, handlers) => function (...args) {
        return handlers.reduce((memory, handler) => handler.apply(this, args.concat(memory)), void 0)
      }),
      pageLifetimes: map(pick(options.pageLifetimes, COMPONENT_PAGE_HOOKS), (name, handlers) => function (...args) {
        return handlers.reduce((memory, handler) => handler.apply(this, args.concat(memory)), void 0)
      }),
      adapters: options.adapters,
    }
    // apply members into instance
    for (let name in members) {
      this[name] = members[name]
    }

    return this
  }
}
github tinajs / tina / src / core / layers / page.js View on Github external
constructor ({ options = {}, $source }) {
    super()

    // creating Tina-Page members
    let members = {
      data: options.data(),
      compute: options.compute || function () {
        return {}
      },
      ...options.methods,
      // hooks
      ...map(pick(options, PAGE_HOOKS), (name, handlers) => function (...args) {
        return handlers.reduce((memory, handler) => handler.apply(this, args.concat(memory)), void 0)
      }),
      adapters: options.adapters,
    }
    // apply members into instance
    for (let name in members) {
      this[name] = members[name]
    }

    return this
  }
}
github tinajs / tina / src / translators / ant / component.js View on Github external
notSupported('behaviors')
  }
  if (!isEmpty(relations)) {
    notSupported('relations')
  }
  if (!isEmpty(options)) {
    notSupported('options')
  }
  if (!isEmpty(moved)) {
    notSupported('moved')
  }

  return new globals.Component({
    data,
    props,
    methods: map(methods, (key, method) => {
      return function () {
        return method.apply(this, arguments)
      }
    }),
    didMount () {
      // add missing property
      this.triggerEvent = function (name, detail, options) {
        let listener = this.props[`on${name[0].toUpperCase()}${name.slice(1)}`]
        if (listener) {
          listener({
            detail,
            options,
          })
        }
      }
      this.id = this.$id
github tinajs / tina / src / utils / mix-strategies.js View on Github external
const strategies = (toOptions, fromOptions) => ({
  ...toOptions,
  ...map(fromOptions, (key, extra) => {
    const strat = strategies[key] || strategies.default
    return strat(toOptions[key], extra)
  })
})
github tinajs / tina / src / adapters / data / sigmund.js View on Github external
static toPlainObject (data) {
    return map(data, (key, value) => value)
  }
}
github tinajs / tina / src / utils / wx-options-generator.js View on Github external
export function observers (object) {
  return map(object || {}, (name, method) => function observer (...args) {
    let context = this.__tina_instance__
    method.apply(context, args)
  })
}
github tinajs / tina / src / adapters / data / sigmund.js View on Github external
sign () {
    this.__signatures = map(this, (key, value) => sigmund(value))
  }
github tinajs / tina-hackernews / src / store / modules / config.js View on Github external
ads: (state) => {
    return map(state.ads, (key, ad) => {
      return {
        ...ad,
        message: JSON.stringify(ad.message),
      }
    })
  },
}
github angus-c / just / javascripts / components / Menu.js View on Github external
import React from 'react';
import data from '../data';
import objectMap from 'just-map-object';

var categoriesArr = [];
const sizeTipText =
  'minfied and gzipped size (data from https://www.npmjs.com/package/package-size)';

objectMap(data, (categoryName, categoryValue) => {
  var fnsArr = [];
  objectMap(categoryValue.utils, (name, value) => {
    fnsArr.push({ name, size: value.size });
  });
  categoriesArr.push({
    name: categoryName,
    symbol: categoryValue.symbol,
    fns: fnsArr
  });
});

export default ({ selected, onSelect }) => {
  return (
    <section style="{{">
      <ul>
        {categoriesArr.map((category, i) =&gt; (</ul></section>

just-map-object

map an object, passing key and value to predicates

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Popular just-map-object functions