How to use d - 10 common examples

To help you get started, we’ve selected a few d 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 seajs / seajs / tests / specs / config / alias / main.js View on Github external
define(function(require) {

  var test = require('../../../test')

  var a = require('a')
  var b = require('biz/b')
  var d = require('d')
  var e = require('e')
  var f = require('f')

  test.assert(a.name === 'a', a.name)
  test.assert(b.name === 'b', b.name)
  test.assert(d.name === 'd', d.name)
  test.assert(e.name === 'e', e.name)
  test.assert(f.name === 'f', f.name)


  seajs.config({
    alias: {
      'a': 'x', // override alias
      'c': './path/to/c'
    }
  })

  //var consoleMsg = global.consoleMsgStack.pop()
  //test.assert(consoleMsg === 'The config of alias["a"] is changed from "./path/to/a.js" to "x"', consoleMsg)

  require.async('c', function(c) {
    test.assert(c.name === 'c', c.name)
github imaginate / algorithmIV-question-manager / tests / pre-compiled-tests / classes / test-data.js View on Github external
function setupInputs() {
      // Add urls to inputs
      inputs['a.com'] = 'alpha';
      inputs['b.com'] = 'beta';
      inputs['c.com'] = 'gamma';
      inputs['d.com'] = 'alpha';
      inputs['e.com'] = 'alpha';
    }
github imaginate / algorithmIV-question-manager / tests / algorithmIV-tests.js View on Github external
function setupInputs() {
      // Add urls to inputs
      inputs['a.com'] = 'alpha';
      inputs['b.com'] = 'beta';
      inputs['c.com'] = 'gamma';
      inputs['d.com'] = 'alpha';
      inputs['e.com'] = 'alpha';
    }
github imaginate / algorithmIV-question-manager / test / algorithmIVData.js View on Github external
function setupInputs() {
          // Add urls to inputs
          inputs['a.com'] = 'alpha';
          inputs['b.com'] = 'beta';
          inputs['c.com'] = 'gamma';
          inputs['d.com'] = 'alpha';
          inputs['e.com'] = 'alpha';
        }
github medikoo / dbjs / lib / history.js View on Github external
'use strict';

var last    = require('es5-ext/array/#/last')
  , forEach = require('es5-ext/object/for-each')
  , d       = require('d/d')
  , proto   = require('./_proto')

  , history = exports;

Object.defineProperties(proto, {
	_lastEvent_: d.gs(function () {
		var data = history.hasOwnProperty(this._id_) && history[this._id_];
		return (data && data[0]) || null;
	}),
	_lastModified_: d.gs(function () {
		var event = this._lastEvent_;
		return (event && event.stamp) || 0;
	}),
	_lastModifiedDate_: d.gs(function () {
		var lastModified = this._lastModified_;
		return lastModified ? new Date(lastModified / 1000) : null;
	})
});

Object.defineProperty(history, '_snapshot', d(function (/* options */) {
	var data = [], result, options = Object(arguments[0])
	  , property = options.property;
github medikoo / dbjs / lib / _relation / indexx.js View on Github external
// Remove from old, and add to new
		forEach(this, function (index, key) {
			forEach(index, function (obj) {
				if (old) old.delete(key, obj);
				if (nu) nu.add(key, obj);
			}, this);
		}, this);

		if (nu) this.parent = nu;
		else delete this.parent;
	})
});

Object.defineProperties(relation, {
	_index_: d.gs(function () {
		var proto;
		// Get index
		if (!this.obj || (this.obj._type_ !== 'object')) return null;
		proto = getPrototypeOf(this);
		while (proto.obj && (proto.obj._type_ !== 'prototype')) {
			proto = getPrototypeOf(proto);
		}
		if (!proto.obj) return null;
		return proto._selfIndex_;
	}),
	_selfIndex_: d.gs(function () {
		var index, parent;
		// Get index
		if (!this.obj || (this.obj._type_ !== 'prototype')) return null;
		if ((this.obj.ns._childType_ !== 'object') ||
				(this.obj._id_ === 'Object#')) {
github medikoo / dbjs / lib / history.js View on Github external
, forEach = require('es5-ext/object/for-each')
  , d       = require('d/d')
  , proto   = require('./_proto')

  , history = exports;

Object.defineProperties(proto, {
	_lastEvent_: d.gs(function () {
		var data = history.hasOwnProperty(this._id_) && history[this._id_];
		return (data && data[0]) || null;
	}),
	_lastModified_: d.gs(function () {
		var event = this._lastEvent_;
		return (event && event.stamp) || 0;
	}),
	_lastModifiedDate_: d.gs(function () {
		var lastModified = this._lastModified_;
		return lastModified ? new Date(lastModified / 1000) : null;
	})
});

Object.defineProperty(history, '_snapshot', d(function (/* options */) {
	var data = [], result, options = Object(arguments[0])
	  , property = options.property;
	forEach(history, function (events, id) {
		var event = events[0];
		if (!event || (event.value === undefined)) return;
		if ((property != null) && !event.obj.hasOwnProperty(property)) return;
		data[last.call(events).index] = events[0];
	});
	result = [];
	data.forEach(function (event) { result.push(event); });
github imaginate / algorithmIV-question-manager / example / example-settings.js View on Github external
function setupInputs() {
      // Add urls to inputs
      inputs['a.com'] = 'alpha';
      inputs['b.com'] = 'beta';
      inputs['c.com'] = 'gamma';
      inputs['d.com'] = 'alpha';
      inputs['e.com'] = 'alpha';
    }
github imaginate / algorithmIV-question-manager / example / pre-compiled-settings / questions.js View on Github external
function setupInputs() {
      // Add urls to inputs
      inputs['a.com'] = 'alpha';
      inputs['b.com'] = 'beta';
      inputs['c.com'] = 'gamma';
      inputs['d.com'] = 'alpha';
      inputs['e.com'] = 'alpha';
    }
github jonschlinkert / templates / test / views.js View on Github external
it('should use a custom rename key function on view keys', function() {
        collection.addView('a/b/c/d.hbs', {content: 'foo bar baz'});
        assert.equal(collection.views['d.hbs'].contents.toString(), 'foo bar baz');
      });

d

Property descriptor factory

ISC
Latest version published 2 months ago

Package Health Score

72 / 100
Full package analysis