How to use just-extend - 10 common examples

To help you get started, we’ve selected a few just-extend 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 ritz078 / embed-js / packages / embed-plugin-url / src / index.js View on Github external
export default function url(opts) {
  const defaultOptions = {
    attributes: {},

    // setting this to true will mess up characters like "
    escape: false
  }

  const { attributes, escape } = extend({}, defaultOptions, opts)
  return {
    id,
    async transform(options) {
      return extend({}, options, {
        result: linkify(options.result, { attributes, escape })
      })
    }
  }
}
github ritz078 / embed-js / packages / embed-preset-basic / src / index.js View on Github external
const pluginOptions = presetOptions[id]

    if (presetOptions.exclude.indexOf(plugin.id) === -1) {
      if (id === "youtube" || id === "map") {
        return plugin(
          extend(
            {},
            {
              gAuthKey: options.gAuthKey
            },
            pluginOptions
          )
        )
      } else if (id === "noEmbed") {
        return plugin(
          extend({}, pluginOptions, {
            exclude: ["youtube"]
          })
        )
      }
      return plugin(pluginOptions)
    }
    return null
  })
github ritz078 / embed-js / packages / embed-plugin-base / src / index.js View on Github external
export default opts => {
  const defaultOptions = {
    _replaceAnyways: false,
    _ignoreAnchorCheck: false,
    _ignoreInlineCheck: false,
    onLoad() {}
  }

  const pluginOptions = extend({}, defaultOptions, opts)

  const { _onLoadInternal, onLoad, regex, template, id } = pluginOptions

  if (!regex) {
    throw new Error("regex not passed.")
  }
  if (!template) {
    throw new Error("template not passed.")
  }

  return {
    id,

    async transform(options) {
      return extend({}, options, await insert(options, pluginOptions))
    },
github angus-c / just / javascripts / components / App.js View on Github external
(acc, key, value) => {
    return extend(acc, value.utils);
  },
  {}
github uber / baseweb / src / locale / index.js View on Github external
const LocaleProvider = (props: {
  locale: $Shape,
  children: ?React.Node,
}) => {
  const {locale, children} = props;
  return (
    
      {children}
    
  );
};
github ritz078 / embed-js / packages / embed-plugin-utilities / src / string-replace-async.js View on Github external
return replacer.apply(null, args).then(function(res) {
    return extend({}, match, { replacement: res })
  })
}
github ritz078 / embed-js / packages / embed-plugin-highlight / src / index.js View on Github external
id,
    regex: /(`{3})(\s|[a-z]+)\s*([\s\S]*?[^`])\s*\1(?!`)/gm,
    prismjs: !isBrowser ? global.Prism : window.Prism,
    template(args, options, { prismjs }) {
      const language = args[2] === "\n" || !args[2] ? "markup" : args[2]
      const code = args[3]

      const className = `language-${language}`
      return `<pre class="${className}"><code class="${className}">${prismjs.highlight(
        code,
        prismjs.languages[language]
      )}</code></pre>`
    }
  }

  const pluginOptions = extend({}, defaultOptions, opts, {
    _replaceAnyways: true,
    _ignoreAnchorCheck: true,
    _ignoreInlineCheck: true
  })

  if (!pluginOptions.prismjs) {
    throw new Error(
      "You need to load prismjs as a global variable or pass it in options."
    )
  }

  return base(pluginOptions)
}
github ritz078 / embed-js / packages / embed-plugin-github / src / index.js View on Github external
async template(
      args,
      options,
      pluginOptions,
      { owner, description, html_url, full_name }
    ) {
      return withDetailsTemplate({
        thumbnail: owner.avatar_url,
        url: html_url,
        description,
        title: full_name
      })
    }
  }

  const pluginOptions = extend({}, defaultOptions, opts, {
    _process
  })
  return base(pluginOptions)
}
github ritz078 / embed-js / packages / embed-js / src / index.js View on Github external
resetOptions() {
    return extend({}, this.options, {
      _embeds: []
    })
  }
github ritz078 / embed-js / src / plugins / video / basic-video.js View on Github external
export default function basicVideo(opts) {
	const defaultOptions = {
		name,
		regex: /(?:https?):\/\/\S*\.(?:ogv|webm|mp4)/gi,
		template(args) {
			return `<video class="ejs-video" controls="" src="${args[0]}"></video>`
		}
	}
	const pluginOptions = extend({}, defaultOptions, opts)
	return base(pluginOptions)
}

just-extend

extend an object

MIT
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis

Popular just-extend functions