コード例 #1
0
function _omit($object, $keys)
{
    return Underscore::omit($object, $keys);
}
コード例 #2
0
ファイル: Underscore.php プロジェクト: brombal/underscore.php
 /**
  * @tags objects
  */
 public function testOmit()
 {
     // it should be able to omit certain keys from a list and preserve the general type
     $this->array(_::omit(['a' => 1, 'b' => 2, 'c' => 3], ['b', 'c']))->isEqualTo(['a' => 1]);
     // 2nd form
     $this->array(_::omit(['a' => 1, 'b' => 2, 'c' => 3], 'b', 'c'))->isEqualTo(['a' => 1]);
     // it shoud ignore keys that are not part of the list/object
     $object = new \stdClass();
     $object->a = 1;
     $this->object(_::omit($object, 'b', 'c'))->isEqualTo((object) ['a' => 1]);
 }